OLD | NEW |
1 ; This test checks that undef values are represented as zero. | 1 ; This test checks that undef values are represented as zero. |
2 | 2 |
3 ; RUN: %llvm2ice --verbose none %s | FileCheck %s | 3 ; RUN: %llvm2ice --verbose none %s | FileCheck %s |
4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s | 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice -mattr=sse4.1 --verbose none %s | FileCheck %s |
| 6 ; RUN: %llvm2ice -mattr=sse4.1 -O2 --verbose none %s | FileCheck %s |
5 ; RUN: %llvm2ice -O2 --verbose none %s \ | 7 ; RUN: %llvm2ice -O2 --verbose none %s \ |
6 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj | 8 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
7 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 9 ; RUN: %llvm2ice -Om1 --verbose none %s \ |
8 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj | 10 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
| 11 ; RUN: %llvm2ice -mattr=sse4.1 -O2 --verbose none %s \ |
| 12 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
| 13 ; RUN: %llvm2ice -mattr=sse4.1 -Om1 --verbose none %s \ |
| 14 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
9 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 15 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
10 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 16 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
11 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 17 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
12 ; RUN: | FileCheck --check-prefix=DUMP %s | 18 ; RUN: | FileCheck --check-prefix=DUMP %s |
13 | 19 |
14 define i32 @undef_i32() { | 20 define i32 @undef_i32() { |
15 entry: | 21 entry: |
16 ret i32 undef | 22 ret i32 undef |
17 ; CHECK-LABEL: undef_i32: | 23 ; CHECK-LABEL: undef_i32: |
18 ; CHECK: mov eax, 0 | 24 ; CHECK: mov eax, 0 |
19 ; CHECK: ret | |
20 } | 25 } |
21 | 26 |
22 define i64 @undef_i64() { | 27 define i64 @undef_i64() { |
23 entry: | 28 entry: |
24 ret i64 undef | 29 ret i64 undef |
25 ; CHECK-LABEL: undef_i64: | 30 ; CHECK-LABEL: undef_i64: |
26 ; CHECK-DAG: mov eax, 0 | 31 ; CHECK-DAG: mov eax, 0 |
27 ; CHECK-DAG: mov edx, 0 | 32 ; CHECK-DAG: mov edx, 0 |
28 ; CHECK: ret | 33 ; CHECK: ret |
29 } | 34 } |
30 | 35 |
31 define float @undef_float() { | 36 define float @undef_float() { |
32 entry: | 37 entry: |
33 ret float undef | 38 ret float undef |
34 ; CHECK-LABEL: undef_float: | 39 ; CHECK-LABEL: undef_float: |
35 ; CHECK-NOT: sub esp | 40 ; CHECK-NOT: sub esp |
36 ; CHECK: fld | 41 ; CHECK: fld |
37 ; CHECK: ret | |
38 } | 42 } |
39 | 43 |
40 define <4 x i1> @undef_v4i1() { | 44 define <4 x i1> @undef_v4i1() { |
41 entry: | 45 entry: |
42 ret <4 x i1> undef | 46 ret <4 x i1> undef |
43 ; CHECK-LABEL: undef_v4i1: | 47 ; CHECK-LABEL: undef_v4i1: |
44 ; CHECK: pxor | 48 ; CHECK: pxor |
45 ; CHECK: ret | |
46 } | 49 } |
47 | 50 |
48 define <8 x i1> @undef_v8i1() { | 51 define <8 x i1> @undef_v8i1() { |
49 entry: | 52 entry: |
50 ret <8 x i1> undef | 53 ret <8 x i1> undef |
51 ; CHECK-LABEL: undef_v8i1: | 54 ; CHECK-LABEL: undef_v8i1: |
52 ; CHECK: pxor | 55 ; CHECK: pxor |
53 ; CHECK: ret | |
54 } | 56 } |
55 | 57 |
56 define <16 x i1> @undef_v16i1() { | 58 define <16 x i1> @undef_v16i1() { |
57 entry: | 59 entry: |
58 ret <16 x i1> undef | 60 ret <16 x i1> undef |
59 ; CHECK-LABEL: undef_v16i1: | 61 ; CHECK-LABEL: undef_v16i1: |
60 ; CHECK: pxor | 62 ; CHECK: pxor |
61 ; CHECK: ret | |
62 } | 63 } |
63 | 64 |
64 define <16 x i8> @undef_v16i8() { | 65 define <16 x i8> @undef_v16i8() { |
65 entry: | 66 entry: |
66 ret <16 x i8> undef | 67 ret <16 x i8> undef |
67 ; CHECK-LABEL: undef_v16i8: | 68 ; CHECK-LABEL: undef_v16i8: |
68 ; CHECK: pxor | 69 ; CHECK: pxor |
69 ; CHECK: ret | |
70 } | 70 } |
71 | 71 |
72 define <8 x i16> @undef_v8i16() { | 72 define <8 x i16> @undef_v8i16() { |
73 entry: | 73 entry: |
74 ret <8 x i16> undef | 74 ret <8 x i16> undef |
75 ; CHECK-LABEL: undef_v8i16: | 75 ; CHECK-LABEL: undef_v8i16: |
76 ; CHECK: pxor | 76 ; CHECK: pxor |
77 ; CHECK: ret | |
78 } | 77 } |
79 | 78 |
80 define <4 x i32> @undef_v4i32() { | 79 define <4 x i32> @undef_v4i32() { |
81 entry: | 80 entry: |
82 ret <4 x i32> undef | 81 ret <4 x i32> undef |
83 ; CHECK-LABEL: undef_v4i32: | 82 ; CHECK-LABEL: undef_v4i32: |
84 ; CHECK: pxor | 83 ; CHECK: pxor |
85 ; CHECK: ret | |
86 } | 84 } |
87 | 85 |
88 define <4 x float> @undef_v4f32() { | 86 define <4 x float> @undef_v4f32() { |
89 entry: | 87 entry: |
90 ret <4 x float> undef | 88 ret <4 x float> undef |
91 ; CHECK-LABEL: undef_v4f32: | 89 ; CHECK-LABEL: undef_v4f32: |
92 ; CHECK: pxor | 90 ; CHECK: pxor |
93 ; CHECK: ret | 91 } |
| 92 |
| 93 define <4 x i32> @vector_arith(<4 x i32> %arg) { |
| 94 entry: |
| 95 %val = add <4 x i32> undef, %arg |
| 96 ret <4 x i32> %val |
| 97 ; CHECK-LABEL: vector_arith: |
| 98 ; CHECK: pxor |
| 99 } |
| 100 |
| 101 define <4 x float> @vector_bitcast() { |
| 102 entry: |
| 103 %val = bitcast <4 x i32> undef to <4 x float> |
| 104 ret <4 x float> %val |
| 105 ; CHECK-LABEL: vector_bitcast: |
| 106 ; CHECK: pxor |
| 107 } |
| 108 |
| 109 define <4 x i32> @vector_sext() { |
| 110 entry: |
| 111 %val = sext <4 x i1> undef to <4 x i32> |
| 112 ret <4 x i32> %val |
| 113 ; CHECK-LABEL: vector_sext: |
| 114 ; CHECK: pxor |
| 115 } |
| 116 |
| 117 define <4 x i32> @vector_zext() { |
| 118 entry: |
| 119 %val = zext <4 x i1> undef to <4 x i32> |
| 120 ret <4 x i32> %val |
| 121 ; CHECK-LABEL: vector_zext: |
| 122 ; CHECK: pxor |
| 123 } |
| 124 |
| 125 define <4 x i1> @vector_trunc() { |
| 126 entry: |
| 127 %val = trunc <4 x i32> undef to <4 x i1> |
| 128 ret <4 x i1> %val |
| 129 ; CHECK-LABEL: vector_trunc: |
| 130 ; CHECK: pxor |
| 131 } |
| 132 |
| 133 define <4 x i1> @vector_icmp(<4 x i32> %arg) { |
| 134 entry: |
| 135 %val = icmp eq <4 x i32> undef, %arg |
| 136 ret <4 x i1> %val |
| 137 ; CHECK-LABEL: vector_icmp: |
| 138 ; CHECK: pxor |
| 139 } |
| 140 |
| 141 define <4 x i1> @vector_fcmp(<4 x float> %arg) { |
| 142 entry: |
| 143 %val = fcmp ueq <4 x float> undef, %arg |
| 144 ret <4 x i1> %val |
| 145 ; CHECK-LABEL: vector_fcmp: |
| 146 ; CHECK: pxor |
| 147 } |
| 148 |
| 149 define <4 x i32> @vector_fptosi() { |
| 150 entry: |
| 151 %val = fptosi <4 x float> undef to <4 x i32> |
| 152 ret <4 x i32> %val |
| 153 ; CHECK-LABEL: vector_fptosi: |
| 154 ; CHECK: pxor |
| 155 } |
| 156 |
| 157 define <4 x i32> @vector_fptoui() { |
| 158 entry: |
| 159 %val = fptoui <4 x float> undef to <4 x i32> |
| 160 ret <4 x i32> %val |
| 161 ; CHECK-LABEL: vector_fptoui: |
| 162 ; CHECK: pxor |
| 163 } |
| 164 |
| 165 define <4 x float> @vector_sitofp() { |
| 166 entry: |
| 167 %val = sitofp <4 x i32> undef to <4 x float> |
| 168 ret <4 x float> %val |
| 169 ; CHECK-LABEL: vector_sitofp: |
| 170 ; CHECK: pxor |
| 171 } |
| 172 |
| 173 define <4 x float> @vector_uitofp() { |
| 174 entry: |
| 175 %val = uitofp <4 x i32> undef to <4 x float> |
| 176 ret <4 x float> %val |
| 177 ; CHECK-LABEL: vector_uitofp: |
| 178 ; CHECK: pxor |
| 179 } |
| 180 |
| 181 define <4 x float> @vector_insertelement_arg1() { |
| 182 entry: |
| 183 %val = insertelement <4 x float> undef, float 1.0, i32 0 |
| 184 ret <4 x float> %val |
| 185 ; CHECK-LABEL: vector_insertelement_arg1: |
| 186 ; CHECK: pxor |
| 187 } |
| 188 |
| 189 define <4 x float> @vector_insertelement_arg2(<4 x float> %arg) { |
| 190 entry: |
| 191 %val = insertelement <4 x float> %arg, float undef, i32 0 |
| 192 ret <4 x float> %val |
| 193 ; CHECK-LABEL: vector_insertelement_arg2: |
| 194 ; CHECK: [L$float$ |
| 195 } |
| 196 |
| 197 define float @vector_extractelement_v4f32_index_0() { |
| 198 entry: |
| 199 %val = extractelement <4 x float> undef, i32 0 |
| 200 ret float %val |
| 201 ; CHECK-LABEL: vector_extractelement_v4f32_index_0: |
| 202 ; CHECK: pxor |
| 203 } |
| 204 |
| 205 define float @vector_extractelement_v4f32_index_1() { |
| 206 entry: |
| 207 %val = extractelement <4 x float> undef, i32 1 |
| 208 ret float %val |
| 209 ; CHECK-LABEL: vector_extractelement_v4f32_index_1: |
| 210 ; CHECK: pxor |
| 211 } |
| 212 |
| 213 define i32 @vector_extractelement_v16i1_index_7() { |
| 214 entry: |
| 215 %val.trunc = extractelement <16 x i1> undef, i32 7 |
| 216 %val = sext i1 %val.trunc to i32 |
| 217 ret i32 %val |
| 218 ; CHECK-LABEL: vector_extractelement_v16i1_index_7: |
| 219 ; CHECK: pxor |
| 220 } |
| 221 |
| 222 define <4 x i32> @vector_select_v4i32_cond(<4 x i32> %a, <4 x i32> %b) { |
| 223 entry: |
| 224 %val = select <4 x i1> undef, <4 x i32> %a, <4 x i32> %b |
| 225 ret <4 x i32> %val |
| 226 ; CHECK-LABEL: vector_select_v4i32_cond: |
| 227 ; CHECK: pxor |
| 228 } |
| 229 |
| 230 define <4 x i32> @vector_select_v4i32_arg1(<4 x i1> %cond, <4 x i32> %b) { |
| 231 entry: |
| 232 %val = select <4 x i1> %cond, <4 x i32> undef, <4 x i32> %b |
| 233 ret <4 x i32> %val |
| 234 ; CHECK-LABEL: vector_select_v4i32_arg1: |
| 235 ; CHECK: pxor |
| 236 } |
| 237 |
| 238 define <4 x i32> @vector_select_v4i32_arg2(<4 x i1> %cond, <4 x i32> %a) { |
| 239 entry: |
| 240 %val = select <4 x i1> %cond, <4 x i32> %a, <4 x i32> undef |
| 241 ret <4 x i32> %val |
| 242 ; CHECK-LABEL: vector_select_v4i32_arg2: |
| 243 ; CHECK: pxor |
| 244 } |
| 245 |
| 246 define <4 x i1> @vector_select_v4i1_cond(<4 x i1> %a, <4 x i1> %b) { |
| 247 entry: |
| 248 %val = select <4 x i1> undef, <4 x i1> %a, <4 x i1> %b |
| 249 ret <4 x i1> %val |
| 250 ; CHECK-LABEL: vector_select_v4i1_cond: |
| 251 ; CHECK: pxor |
| 252 } |
| 253 |
| 254 define <4 x i1> @vector_select_v4i1_arg1(<4 x i1> %cond, <4 x i1> %b) { |
| 255 entry: |
| 256 %val = select <4 x i1> %cond, <4 x i1> undef, <4 x i1> %b |
| 257 ret <4 x i1> %val |
| 258 ; CHECK-LABEL: vector_select_v4i1_arg1: |
| 259 ; CHECK: pxor |
| 260 } |
| 261 |
| 262 define <4 x i1> @vector_select_v4i1_arg2(<4 x i1> %cond, <4 x i1> %a) { |
| 263 entry: |
| 264 %val = select <4 x i1> %cond, <4 x i1> %a, <4 x i1> undef |
| 265 ret <4 x i1> %val |
| 266 ; CHECK-LABEL: vector_select_v4i1_arg2: |
| 267 ; CHECK: pxor |
| 268 } |
| 269 |
| 270 define <4 x float> @vector_select_v4f32_cond(<4 x float> %a, <4 x float> %b) { |
| 271 entry: |
| 272 %val = select <4 x i1> undef, <4 x float> %a, <4 x float> %b |
| 273 ret <4 x float> %val |
| 274 ; CHECK-LABEL: vector_select_v4f32_cond: |
| 275 ; CHECK: pxor |
| 276 } |
| 277 |
| 278 define <4 x float> @vector_select_v4f32_arg1(<4 x i1> %cond, <4 x float> %b) { |
| 279 entry: |
| 280 %val = select <4 x i1> %cond, <4 x float> undef, <4 x float> %b |
| 281 ret <4 x float> %val |
| 282 ; CHECK-LABEL: vector_select_v4f32_arg1: |
| 283 ; CHECK: pxor |
| 284 } |
| 285 |
| 286 define <4 x float> @vector_select_v4f32_arg2(<4 x i1> %cond, <4 x float> %a) { |
| 287 entry: |
| 288 %val = select <4 x i1> %cond, <4 x float> %a, <4 x float> undef |
| 289 ret <4 x float> %val |
| 290 ; CHECK-LABEL: vector_select_v4f32_arg2: |
| 291 ; CHECK: pxor |
94 } | 292 } |
95 | 293 |
96 ; ERRORS-NOT: ICE translation error | 294 ; ERRORS-NOT: ICE translation error |
97 ; DUMP-NOT: SZ | 295 ; DUMP-NOT: SZ |
OLD | NEW |