OLD | NEW |
(Empty) | |
| 1 ; This file tests casting / conversion operations that apply to vector types. |
| 2 ; bitcast operations are in vector-bitcast.ll. |
| 3 |
| 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s |
| 6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 7 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 8 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 9 ; RUN: | FileCheck --check-prefix=DUMP %s |
| 10 |
| 11 ; sext operations |
| 12 |
| 13 define <16 x i8> @test_sext_v16i1_to_v16i8(<16 x i1> %arg) { |
| 14 entry: |
| 15 %res = sext <16 x i1> %arg to <16 x i8> |
| 16 ret <16 x i8> %res |
| 17 |
| 18 ; CHECK-LABEL: test_sext_v16i1_to_v16i8: |
| 19 ; CHECK: pxor |
| 20 ; CHECK: pcmpeqb |
| 21 ; CHECK: psubb |
| 22 ; CHECK: pand |
| 23 ; CHECK: pxor |
| 24 ; CHECK: pcmpgtb |
| 25 } |
| 26 |
| 27 define <8 x i16> @test_sext_v8i1_to_v8i16(<8 x i1> %arg) { |
| 28 entry: |
| 29 %res = sext <8 x i1> %arg to <8 x i16> |
| 30 ret <8 x i16> %res |
| 31 |
| 32 ; CHECK-LABEL: test_sext_v8i1_to_v8i16: |
| 33 ; CHECK: psllw {{.*}}, 15 |
| 34 ; CHECK: psraw {{.*}}, 15 |
| 35 } |
| 36 |
| 37 define <4 x i32> @test_sext_v4i1_to_v4i32(<4 x i1> %arg) { |
| 38 entry: |
| 39 %res = sext <4 x i1> %arg to <4 x i32> |
| 40 ret <4 x i32> %res |
| 41 |
| 42 ; CHECK-LABEL: test_sext_v4i1_to_v4i32: |
| 43 ; CHECK: pslld {{.*}}, 31 |
| 44 ; CHECK: psrad {{.*}}, 31 |
| 45 } |
| 46 |
| 47 ; zext operations |
| 48 |
| 49 define <16 x i8> @test_zext_v16i1_to_v16i8(<16 x i1> %arg) { |
| 50 entry: |
| 51 %res = zext <16 x i1> %arg to <16 x i8> |
| 52 ret <16 x i8> %res |
| 53 |
| 54 ; CHECK-LABEL: test_zext_v16i1_to_v16i8: |
| 55 ; CHECK: pxor |
| 56 ; CHECK: pcmpeqb |
| 57 ; CHECK: psubb |
| 58 ; CHECK: pand |
| 59 } |
| 60 |
| 61 define <8 x i16> @test_zext_v8i1_to_v8i16(<8 x i1> %arg) { |
| 62 entry: |
| 63 %res = zext <8 x i1> %arg to <8 x i16> |
| 64 ret <8 x i16> %res |
| 65 |
| 66 ; CHECK-LABEL: test_zext_v8i1_to_v8i16: |
| 67 ; CHECK: pxor |
| 68 ; CHECK: pcmpeqw |
| 69 ; CHECK: psubw |
| 70 ; CHECK: pand |
| 71 } |
| 72 |
| 73 define <4 x i32> @test_zext_v4i1_to_v4i32(<4 x i1> %arg) { |
| 74 entry: |
| 75 %res = zext <4 x i1> %arg to <4 x i32> |
| 76 ret <4 x i32> %res |
| 77 |
| 78 ; CHECK-LABEL: test_zext_v4i1_to_v4i32: |
| 79 ; CHECK: pxor |
| 80 ; CHECK: pcmpeqd |
| 81 ; CHECK: psubd |
| 82 ; CHECK: pand |
| 83 } |
| 84 |
| 85 ; trunc operations |
| 86 |
| 87 define <16 x i1> @test_trunc_v16i8_to_v16i1(<16 x i8> %arg) { |
| 88 entry: |
| 89 %res = trunc <16 x i8> %arg to <16 x i1> |
| 90 ret <16 x i1> %res |
| 91 |
| 92 ; CHECK-LABEL: test_trunc_v16i8_to_v16i1: |
| 93 ; CHECK: pxor |
| 94 ; CHECK: pcmpeqb |
| 95 ; CHECK: psubb |
| 96 ; CHECK: pand |
| 97 } |
| 98 |
| 99 define <8 x i1> @test_trunc_v8i16_to_v8i1(<8 x i16> %arg) { |
| 100 entry: |
| 101 %res = trunc <8 x i16> %arg to <8 x i1> |
| 102 ret <8 x i1> %res |
| 103 |
| 104 ; CHECK-LABEL: test_trunc_v8i16_to_v8i1: |
| 105 ; CHECK: pxor |
| 106 ; CHECK: pcmpeqw |
| 107 ; CHECK: psubw |
| 108 ; CHECK: pand |
| 109 } |
| 110 |
| 111 define <4 x i1> @test_trunc_v4i32_to_v4i1(<4 x i32> %arg) { |
| 112 entry: |
| 113 %res = trunc <4 x i32> %arg to <4 x i1> |
| 114 ret <4 x i1> %res |
| 115 |
| 116 ; CHECK-LABEL: test_trunc_v4i32_to_v4i1: |
| 117 ; CHECK: pxor |
| 118 ; CHECK: pcmpeqd |
| 119 ; CHECK: psubd |
| 120 ; CHECK: pand |
| 121 } |
| 122 |
| 123 ; fpto[us]i operations |
| 124 |
| 125 define <4 x i32> @test_fptosi_v4f32_to_v4i32(<4 x float> %arg) { |
| 126 entry: |
| 127 %res = fptosi <4 x float> %arg to <4 x i32> |
| 128 ret <4 x i32> %res |
| 129 |
| 130 ; CHECK-LABEL: test_fptosi_v4f32_to_v4i32: |
| 131 ; CHECK: cvtps2dq |
| 132 } |
| 133 |
| 134 define <4 x i32> @test_fptoui_v4f32_to_v4i32(<4 x float> %arg) { |
| 135 entry: |
| 136 %res = fptoui <4 x float> %arg to <4 x i32> |
| 137 ret <4 x i32> %res |
| 138 |
| 139 ; CHECK-LABEL: test_fptoui_v4f32_to_v4i32: |
| 140 ; CHECK: call Sz_fptoui_v4f32 |
| 141 } |
| 142 |
| 143 ; [su]itofp operations |
| 144 |
| 145 define <4 x float> @test_sitofp_v4i32_to_v4f32(<4 x i32> %arg) { |
| 146 entry: |
| 147 %res = sitofp <4 x i32> %arg to <4 x float> |
| 148 ret <4 x float> %res |
| 149 |
| 150 ; CHECK-LABEL: test_sitofp_v4i32_to_v4f32: |
| 151 ; CHECK: cvtdq2ps |
| 152 } |
| 153 |
| 154 define <4 x float> @test_uitofp_v4i32_to_v4f32(<4 x i32> %arg) { |
| 155 entry: |
| 156 %res = uitofp <4 x i32> %arg to <4 x float> |
| 157 ret <4 x float> %res |
| 158 |
| 159 ; CHECK-LABEL: test_uitofp_v4i32_to_v4f32: |
| 160 ; CHECK: call Sz_uitofp_v4i32 |
| 161 } |
| 162 |
| 163 ; ERRORS-NOT: ICE translation error |
| 164 ; DUMP-NOT: SZ |
OLD | NEW |