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