1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=CHECK-LINUX64
3 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=CHECK-WIN32-64
4 ; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefix=CHECK-X86
6 define void @g64xh(i64 inreg %x) nounwind {
7 ; CHECK-LINUX64-LABEL: g64xh:
8 ; CHECK-LINUX64: # %bb.0:
9 ; CHECK-LINUX64-NEXT: testl $2048, %edi # imm = 0x800
10 ; CHECK-LINUX64-NEXT: jne .LBB0_2
11 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
12 ; CHECK-LINUX64-NEXT: pushq %rax
13 ; CHECK-LINUX64-NEXT: callq bar
14 ; CHECK-LINUX64-NEXT: popq %rax
15 ; CHECK-LINUX64-NEXT: .LBB0_2: # %no
16 ; CHECK-LINUX64-NEXT: retq
18 ; CHECK-WIN32-64-LABEL: g64xh:
19 ; CHECK-WIN32-64: # %bb.0:
20 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
21 ; CHECK-WIN32-64-NEXT: testl $2048, %ecx # imm = 0x800
22 ; CHECK-WIN32-64-NEXT: jne .LBB0_2
23 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
24 ; CHECK-WIN32-64-NEXT: callq bar
25 ; CHECK-WIN32-64-NEXT: .LBB0_2: # %no
26 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
27 ; CHECK-WIN32-64-NEXT: retq
29 ; CHECK-X86-LABEL: g64xh:
31 ; CHECK-X86-NEXT: testl $2048, %eax # imm = 0x800
32 ; CHECK-X86-NEXT: jne .LBB0_2
33 ; CHECK-X86-NEXT: # %bb.1: # %yes
34 ; CHECK-X86-NEXT: calll bar
35 ; CHECK-X86-NEXT: .LBB0_2: # %no
36 ; CHECK-X86-NEXT: retl
38 %s = icmp eq i64 %t, 0
39 br i1 %s, label %yes, label %no
48 define void @g64xl(i64 inreg %x) nounwind {
49 ; CHECK-LINUX64-LABEL: g64xl:
50 ; CHECK-LINUX64: # %bb.0:
51 ; CHECK-LINUX64-NEXT: testb $8, %dil
52 ; CHECK-LINUX64-NEXT: jne .LBB1_2
53 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
54 ; CHECK-LINUX64-NEXT: pushq %rax
55 ; CHECK-LINUX64-NEXT: callq bar
56 ; CHECK-LINUX64-NEXT: popq %rax
57 ; CHECK-LINUX64-NEXT: .LBB1_2: # %no
58 ; CHECK-LINUX64-NEXT: retq
60 ; CHECK-WIN32-64-LABEL: g64xl:
61 ; CHECK-WIN32-64: # %bb.0:
62 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
63 ; CHECK-WIN32-64-NEXT: testb $8, %cl
64 ; CHECK-WIN32-64-NEXT: jne .LBB1_2
65 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
66 ; CHECK-WIN32-64-NEXT: callq bar
67 ; CHECK-WIN32-64-NEXT: .LBB1_2: # %no
68 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
69 ; CHECK-WIN32-64-NEXT: retq
71 ; CHECK-X86-LABEL: g64xl:
73 ; CHECK-X86-NEXT: testb $8, %al
74 ; CHECK-X86-NEXT: jne .LBB1_2
75 ; CHECK-X86-NEXT: # %bb.1: # %yes
76 ; CHECK-X86-NEXT: calll bar
77 ; CHECK-X86-NEXT: .LBB1_2: # %no
78 ; CHECK-X86-NEXT: retl
80 %s = icmp eq i64 %t, 0
81 br i1 %s, label %yes, label %no
90 define void @g32xh(i32 inreg %x) nounwind {
91 ; CHECK-LINUX64-LABEL: g32xh:
92 ; CHECK-LINUX64: # %bb.0:
93 ; CHECK-LINUX64-NEXT: testl $2048, %edi # imm = 0x800
94 ; CHECK-LINUX64-NEXT: jne .LBB2_2
95 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
96 ; CHECK-LINUX64-NEXT: pushq %rax
97 ; CHECK-LINUX64-NEXT: callq bar
98 ; CHECK-LINUX64-NEXT: popq %rax
99 ; CHECK-LINUX64-NEXT: .LBB2_2: # %no
100 ; CHECK-LINUX64-NEXT: retq
102 ; CHECK-WIN32-64-LABEL: g32xh:
103 ; CHECK-WIN32-64: # %bb.0:
104 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
105 ; CHECK-WIN32-64-NEXT: testl $2048, %ecx # imm = 0x800
106 ; CHECK-WIN32-64-NEXT: jne .LBB2_2
107 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
108 ; CHECK-WIN32-64-NEXT: callq bar
109 ; CHECK-WIN32-64-NEXT: .LBB2_2: # %no
110 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
111 ; CHECK-WIN32-64-NEXT: retq
113 ; CHECK-X86-LABEL: g32xh:
114 ; CHECK-X86: # %bb.0:
115 ; CHECK-X86-NEXT: testl $2048, %eax # imm = 0x800
116 ; CHECK-X86-NEXT: jne .LBB2_2
117 ; CHECK-X86-NEXT: # %bb.1: # %yes
118 ; CHECK-X86-NEXT: calll bar
119 ; CHECK-X86-NEXT: .LBB2_2: # %no
120 ; CHECK-X86-NEXT: retl
121 %t = and i32 %x, 2048
122 %s = icmp eq i32 %t, 0
123 br i1 %s, label %yes, label %no
132 define void @g32xl(i32 inreg %x) nounwind {
133 ; CHECK-LINUX64-LABEL: g32xl:
134 ; CHECK-LINUX64: # %bb.0:
135 ; CHECK-LINUX64-NEXT: testb $8, %dil
136 ; CHECK-LINUX64-NEXT: jne .LBB3_2
137 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
138 ; CHECK-LINUX64-NEXT: pushq %rax
139 ; CHECK-LINUX64-NEXT: callq bar
140 ; CHECK-LINUX64-NEXT: popq %rax
141 ; CHECK-LINUX64-NEXT: .LBB3_2: # %no
142 ; CHECK-LINUX64-NEXT: retq
144 ; CHECK-WIN32-64-LABEL: g32xl:
145 ; CHECK-WIN32-64: # %bb.0:
146 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
147 ; CHECK-WIN32-64-NEXT: testb $8, %cl
148 ; CHECK-WIN32-64-NEXT: jne .LBB3_2
149 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
150 ; CHECK-WIN32-64-NEXT: callq bar
151 ; CHECK-WIN32-64-NEXT: .LBB3_2: # %no
152 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
153 ; CHECK-WIN32-64-NEXT: retq
155 ; CHECK-X86-LABEL: g32xl:
156 ; CHECK-X86: # %bb.0:
157 ; CHECK-X86-NEXT: testb $8, %al
158 ; CHECK-X86-NEXT: jne .LBB3_2
159 ; CHECK-X86-NEXT: # %bb.1: # %yes
160 ; CHECK-X86-NEXT: calll bar
161 ; CHECK-X86-NEXT: .LBB3_2: # %no
162 ; CHECK-X86-NEXT: retl
164 %s = icmp eq i32 %t, 0
165 br i1 %s, label %yes, label %no
174 define void @g16xh(i16 inreg %x) nounwind {
175 ; CHECK-LINUX64-LABEL: g16xh:
176 ; CHECK-LINUX64: # %bb.0:
177 ; CHECK-LINUX64-NEXT: testl $2048, %edi # imm = 0x800
178 ; CHECK-LINUX64-NEXT: jne .LBB4_2
179 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
180 ; CHECK-LINUX64-NEXT: pushq %rax
181 ; CHECK-LINUX64-NEXT: callq bar
182 ; CHECK-LINUX64-NEXT: popq %rax
183 ; CHECK-LINUX64-NEXT: .LBB4_2: # %no
184 ; CHECK-LINUX64-NEXT: retq
186 ; CHECK-WIN32-64-LABEL: g16xh:
187 ; CHECK-WIN32-64: # %bb.0:
188 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
189 ; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
190 ; CHECK-WIN32-64-NEXT: testl $2048, %ecx # imm = 0x800
191 ; CHECK-WIN32-64-NEXT: jne .LBB4_2
192 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
193 ; CHECK-WIN32-64-NEXT: callq bar
194 ; CHECK-WIN32-64-NEXT: .LBB4_2: # %no
195 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
196 ; CHECK-WIN32-64-NEXT: retq
198 ; CHECK-X86-LABEL: g16xh:
199 ; CHECK-X86: # %bb.0:
200 ; CHECK-X86-NEXT: testl $2048, %eax # imm = 0x800
201 ; CHECK-X86-NEXT: jne .LBB4_2
202 ; CHECK-X86-NEXT: # %bb.1: # %yes
203 ; CHECK-X86-NEXT: calll bar
204 ; CHECK-X86-NEXT: .LBB4_2: # %no
205 ; CHECK-X86-NEXT: retl
206 %t = and i16 %x, 2048
207 %s = icmp eq i16 %t, 0
208 br i1 %s, label %yes, label %no
217 define void @g16xl(i16 inreg %x) nounwind {
218 ; CHECK-LINUX64-LABEL: g16xl:
219 ; CHECK-LINUX64: # %bb.0:
220 ; CHECK-LINUX64-NEXT: testb $8, %dil
221 ; CHECK-LINUX64-NEXT: jne .LBB5_2
222 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
223 ; CHECK-LINUX64-NEXT: pushq %rax
224 ; CHECK-LINUX64-NEXT: callq bar
225 ; CHECK-LINUX64-NEXT: popq %rax
226 ; CHECK-LINUX64-NEXT: .LBB5_2: # %no
227 ; CHECK-LINUX64-NEXT: retq
229 ; CHECK-WIN32-64-LABEL: g16xl:
230 ; CHECK-WIN32-64: # %bb.0:
231 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
232 ; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
233 ; CHECK-WIN32-64-NEXT: testb $8, %cl
234 ; CHECK-WIN32-64-NEXT: jne .LBB5_2
235 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
236 ; CHECK-WIN32-64-NEXT: callq bar
237 ; CHECK-WIN32-64-NEXT: .LBB5_2: # %no
238 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
239 ; CHECK-WIN32-64-NEXT: retq
241 ; CHECK-X86-LABEL: g16xl:
242 ; CHECK-X86: # %bb.0:
243 ; CHECK-X86-NEXT: testb $8, %al
244 ; CHECK-X86-NEXT: jne .LBB5_2
245 ; CHECK-X86-NEXT: # %bb.1: # %yes
246 ; CHECK-X86-NEXT: calll bar
247 ; CHECK-X86-NEXT: .LBB5_2: # %no
248 ; CHECK-X86-NEXT: retl
250 %s = icmp eq i16 %t, 0
251 br i1 %s, label %yes, label %no
260 define void @g64x16(i64 inreg %x) nounwind {
261 ; CHECK-LINUX64-LABEL: g64x16:
262 ; CHECK-LINUX64: # %bb.0:
263 ; CHECK-LINUX64-NEXT: testl $32896, %edi # imm = 0x8080
264 ; CHECK-LINUX64-NEXT: je .LBB6_1
265 ; CHECK-LINUX64-NEXT: # %bb.2: # %no
266 ; CHECK-LINUX64-NEXT: retq
267 ; CHECK-LINUX64-NEXT: .LBB6_1: # %yes
268 ; CHECK-LINUX64-NEXT: pushq %rax
269 ; CHECK-LINUX64-NEXT: callq bar
270 ; CHECK-LINUX64-NEXT: popq %rax
271 ; CHECK-LINUX64-NEXT: retq
273 ; CHECK-WIN32-64-LABEL: g64x16:
274 ; CHECK-WIN32-64: # %bb.0:
275 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
276 ; CHECK-WIN32-64-NEXT: testl $32896, %ecx # imm = 0x8080
277 ; CHECK-WIN32-64-NEXT: je .LBB6_1
278 ; CHECK-WIN32-64-NEXT: # %bb.2: # %no
279 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
280 ; CHECK-WIN32-64-NEXT: retq
281 ; CHECK-WIN32-64-NEXT: .LBB6_1: # %yes
282 ; CHECK-WIN32-64-NEXT: callq bar
283 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
284 ; CHECK-WIN32-64-NEXT: retq
286 ; CHECK-X86-LABEL: g64x16:
287 ; CHECK-X86: # %bb.0:
288 ; CHECK-X86-NEXT: testl $32896, %eax # imm = 0x8080
289 ; CHECK-X86-NEXT: je .LBB6_1
290 ; CHECK-X86-NEXT: # %bb.2: # %no
291 ; CHECK-X86-NEXT: retl
292 ; CHECK-X86-NEXT: .LBB6_1: # %yes
293 ; CHECK-X86-NEXT: calll bar
294 ; CHECK-X86-NEXT: retl
295 %t = and i64 %x, 32896
296 %s = icmp eq i64 %t, 0
297 br i1 %s, label %yes, label %no
306 define void @g64x16minsize(i64 inreg %x) nounwind minsize {
307 ; CHECK-LINUX64-LABEL: g64x16minsize:
308 ; CHECK-LINUX64: # %bb.0:
309 ; CHECK-LINUX64-NEXT: testw $-32640, %di # imm = 0x8080
310 ; CHECK-LINUX64-NEXT: je .LBB7_1
311 ; CHECK-LINUX64-NEXT: # %bb.2: # %no
312 ; CHECK-LINUX64-NEXT: retq
313 ; CHECK-LINUX64-NEXT: .LBB7_1: # %yes
314 ; CHECK-LINUX64-NEXT: pushq %rax
315 ; CHECK-LINUX64-NEXT: callq bar
316 ; CHECK-LINUX64-NEXT: popq %rax
317 ; CHECK-LINUX64-NEXT: retq
319 ; CHECK-WIN32-64-LABEL: g64x16minsize:
320 ; CHECK-WIN32-64: # %bb.0:
321 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
322 ; CHECK-WIN32-64-NEXT: testw $-32640, %cx # imm = 0x8080
323 ; CHECK-WIN32-64-NEXT: jne .LBB7_2
324 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
325 ; CHECK-WIN32-64-NEXT: callq bar
326 ; CHECK-WIN32-64-NEXT: .LBB7_2: # %no
327 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
328 ; CHECK-WIN32-64-NEXT: retq
330 ; CHECK-X86-LABEL: g64x16minsize:
331 ; CHECK-X86: # %bb.0:
332 ; CHECK-X86-NEXT: testw $-32640, %ax # imm = 0x8080
333 ; CHECK-X86-NEXT: je .LBB7_1
334 ; CHECK-X86-NEXT: # %bb.2: # %no
335 ; CHECK-X86-NEXT: retl
336 ; CHECK-X86-NEXT: .LBB7_1: # %yes
337 ; CHECK-X86-NEXT: calll bar
338 ; CHECK-X86-NEXT: retl
339 %t = and i64 %x, 32896
340 %s = icmp eq i64 %t, 0
341 br i1 %s, label %yes, label %no
350 define void @g32x16(i32 inreg %x) nounwind {
351 ; CHECK-LINUX64-LABEL: g32x16:
352 ; CHECK-LINUX64: # %bb.0:
353 ; CHECK-LINUX64-NEXT: testl $32896, %edi # imm = 0x8080
354 ; CHECK-LINUX64-NEXT: je .LBB8_1
355 ; CHECK-LINUX64-NEXT: # %bb.2: # %no
356 ; CHECK-LINUX64-NEXT: retq
357 ; CHECK-LINUX64-NEXT: .LBB8_1: # %yes
358 ; CHECK-LINUX64-NEXT: pushq %rax
359 ; CHECK-LINUX64-NEXT: callq bar
360 ; CHECK-LINUX64-NEXT: popq %rax
361 ; CHECK-LINUX64-NEXT: retq
363 ; CHECK-WIN32-64-LABEL: g32x16:
364 ; CHECK-WIN32-64: # %bb.0:
365 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
366 ; CHECK-WIN32-64-NEXT: testl $32896, %ecx # imm = 0x8080
367 ; CHECK-WIN32-64-NEXT: je .LBB8_1
368 ; CHECK-WIN32-64-NEXT: # %bb.2: # %no
369 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
370 ; CHECK-WIN32-64-NEXT: retq
371 ; CHECK-WIN32-64-NEXT: .LBB8_1: # %yes
372 ; CHECK-WIN32-64-NEXT: callq bar
373 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
374 ; CHECK-WIN32-64-NEXT: retq
376 ; CHECK-X86-LABEL: g32x16:
377 ; CHECK-X86: # %bb.0:
378 ; CHECK-X86-NEXT: testl $32896, %eax # imm = 0x8080
379 ; CHECK-X86-NEXT: je .LBB8_1
380 ; CHECK-X86-NEXT: # %bb.2: # %no
381 ; CHECK-X86-NEXT: retl
382 ; CHECK-X86-NEXT: .LBB8_1: # %yes
383 ; CHECK-X86-NEXT: calll bar
384 ; CHECK-X86-NEXT: retl
385 %t = and i32 %x, 32896
386 %s = icmp eq i32 %t, 0
387 br i1 %s, label %yes, label %no
396 define void @g32x16minsize(i32 inreg %x) nounwind minsize {
397 ; CHECK-LINUX64-LABEL: g32x16minsize:
398 ; CHECK-LINUX64: # %bb.0:
399 ; CHECK-LINUX64-NEXT: testw $-32640, %di # imm = 0x8080
400 ; CHECK-LINUX64-NEXT: je .LBB9_1
401 ; CHECK-LINUX64-NEXT: # %bb.2: # %no
402 ; CHECK-LINUX64-NEXT: retq
403 ; CHECK-LINUX64-NEXT: .LBB9_1: # %yes
404 ; CHECK-LINUX64-NEXT: pushq %rax
405 ; CHECK-LINUX64-NEXT: callq bar
406 ; CHECK-LINUX64-NEXT: popq %rax
407 ; CHECK-LINUX64-NEXT: retq
409 ; CHECK-WIN32-64-LABEL: g32x16minsize:
410 ; CHECK-WIN32-64: # %bb.0:
411 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
412 ; CHECK-WIN32-64-NEXT: testw $-32640, %cx # imm = 0x8080
413 ; CHECK-WIN32-64-NEXT: jne .LBB9_2
414 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
415 ; CHECK-WIN32-64-NEXT: callq bar
416 ; CHECK-WIN32-64-NEXT: .LBB9_2: # %no
417 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
418 ; CHECK-WIN32-64-NEXT: retq
420 ; CHECK-X86-LABEL: g32x16minsize:
421 ; CHECK-X86: # %bb.0:
422 ; CHECK-X86-NEXT: testw $-32640, %ax # imm = 0x8080
423 ; CHECK-X86-NEXT: je .LBB9_1
424 ; CHECK-X86-NEXT: # %bb.2: # %no
425 ; CHECK-X86-NEXT: retl
426 ; CHECK-X86-NEXT: .LBB9_1: # %yes
427 ; CHECK-X86-NEXT: calll bar
428 ; CHECK-X86-NEXT: retl
429 %t = and i32 %x, 32896
430 %s = icmp eq i32 %t, 0
431 br i1 %s, label %yes, label %no
440 define void @g64x32(i64 inreg %x) nounwind {
441 ; CHECK-LINUX64-LABEL: g64x32:
442 ; CHECK-LINUX64: # %bb.0:
443 ; CHECK-LINUX64-NEXT: testl $268468352, %edi # imm = 0x10008080
444 ; CHECK-LINUX64-NEXT: je .LBB10_1
445 ; CHECK-LINUX64-NEXT: # %bb.2: # %no
446 ; CHECK-LINUX64-NEXT: retq
447 ; CHECK-LINUX64-NEXT: .LBB10_1: # %yes
448 ; CHECK-LINUX64-NEXT: pushq %rax
449 ; CHECK-LINUX64-NEXT: callq bar
450 ; CHECK-LINUX64-NEXT: popq %rax
451 ; CHECK-LINUX64-NEXT: retq
453 ; CHECK-WIN32-64-LABEL: g64x32:
454 ; CHECK-WIN32-64: # %bb.0:
455 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
456 ; CHECK-WIN32-64-NEXT: testl $268468352, %ecx # imm = 0x10008080
457 ; CHECK-WIN32-64-NEXT: je .LBB10_1
458 ; CHECK-WIN32-64-NEXT: # %bb.2: # %no
459 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
460 ; CHECK-WIN32-64-NEXT: retq
461 ; CHECK-WIN32-64-NEXT: .LBB10_1: # %yes
462 ; CHECK-WIN32-64-NEXT: callq bar
463 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
464 ; CHECK-WIN32-64-NEXT: retq
466 ; CHECK-X86-LABEL: g64x32:
467 ; CHECK-X86: # %bb.0:
468 ; CHECK-X86-NEXT: testl $268468352, %eax # imm = 0x10008080
469 ; CHECK-X86-NEXT: je .LBB10_1
470 ; CHECK-X86-NEXT: # %bb.2: # %no
471 ; CHECK-X86-NEXT: retl
472 ; CHECK-X86-NEXT: .LBB10_1: # %yes
473 ; CHECK-X86-NEXT: calll bar
474 ; CHECK-X86-NEXT: retl
475 %t = and i64 %x, 268468352
476 %s = icmp eq i64 %t, 0
477 br i1 %s, label %yes, label %no
486 define void @truncand32(i16 inreg %x) nounwind {
487 ; CHECK-LINUX64-LABEL: truncand32:
488 ; CHECK-LINUX64: # %bb.0:
489 ; CHECK-LINUX64-NEXT: testl $2049, %edi # imm = 0x801
490 ; CHECK-LINUX64-NEXT: je .LBB11_1
491 ; CHECK-LINUX64-NEXT: # %bb.2: # %no
492 ; CHECK-LINUX64-NEXT: retq
493 ; CHECK-LINUX64-NEXT: .LBB11_1: # %yes
494 ; CHECK-LINUX64-NEXT: pushq %rax
495 ; CHECK-LINUX64-NEXT: callq bar
496 ; CHECK-LINUX64-NEXT: popq %rax
497 ; CHECK-LINUX64-NEXT: retq
499 ; CHECK-WIN32-64-LABEL: truncand32:
500 ; CHECK-WIN32-64: # %bb.0:
501 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
502 ; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
503 ; CHECK-WIN32-64-NEXT: testl $2049, %ecx # imm = 0x801
504 ; CHECK-WIN32-64-NEXT: je .LBB11_1
505 ; CHECK-WIN32-64-NEXT: # %bb.2: # %no
506 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
507 ; CHECK-WIN32-64-NEXT: retq
508 ; CHECK-WIN32-64-NEXT: .LBB11_1: # %yes
509 ; CHECK-WIN32-64-NEXT: callq bar
510 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
511 ; CHECK-WIN32-64-NEXT: retq
513 ; CHECK-X86-LABEL: truncand32:
514 ; CHECK-X86: # %bb.0:
515 ; CHECK-X86-NEXT: testl $2049, %eax # imm = 0x801
516 ; CHECK-X86-NEXT: je .LBB11_1
517 ; CHECK-X86-NEXT: # %bb.2: # %no
518 ; CHECK-X86-NEXT: retl
519 ; CHECK-X86-NEXT: .LBB11_1: # %yes
520 ; CHECK-X86-NEXT: calll bar
521 ; CHECK-X86-NEXT: retl
522 %t = and i16 %x, 2049
523 %s = icmp eq i16 %t, 0
524 br i1 %s, label %yes, label %no
533 define void @testw(i16 inreg %x) nounwind minsize {
534 ; CHECK-LINUX64-LABEL: testw:
535 ; CHECK-LINUX64: # %bb.0:
536 ; CHECK-LINUX64-NEXT: testw $2049, %di # imm = 0x801
537 ; CHECK-LINUX64-NEXT: je .LBB12_1
538 ; CHECK-LINUX64-NEXT: # %bb.2: # %no
539 ; CHECK-LINUX64-NEXT: retq
540 ; CHECK-LINUX64-NEXT: .LBB12_1: # %yes
541 ; CHECK-LINUX64-NEXT: pushq %rax
542 ; CHECK-LINUX64-NEXT: callq bar
543 ; CHECK-LINUX64-NEXT: popq %rax
544 ; CHECK-LINUX64-NEXT: retq
546 ; CHECK-WIN32-64-LABEL: testw:
547 ; CHECK-WIN32-64: # %bb.0:
548 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
549 ; CHECK-WIN32-64-NEXT: # kill: def $cx killed $cx def $ecx
550 ; CHECK-WIN32-64-NEXT: testw $2049, %cx # imm = 0x801
551 ; CHECK-WIN32-64-NEXT: jne .LBB12_2
552 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
553 ; CHECK-WIN32-64-NEXT: callq bar
554 ; CHECK-WIN32-64-NEXT: .LBB12_2: # %no
555 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
556 ; CHECK-WIN32-64-NEXT: retq
558 ; CHECK-X86-LABEL: testw:
559 ; CHECK-X86: # %bb.0:
560 ; CHECK-X86-NEXT: testw $2049, %ax # imm = 0x801
561 ; CHECK-X86-NEXT: je .LBB12_1
562 ; CHECK-X86-NEXT: # %bb.2: # %no
563 ; CHECK-X86-NEXT: retl
564 ; CHECK-X86-NEXT: .LBB12_1: # %yes
565 ; CHECK-X86-NEXT: calll bar
566 ; CHECK-X86-NEXT: retl
567 %t = and i16 %x, 2049
568 %s = icmp eq i16 %t, 0
569 br i1 %s, label %yes, label %no
578 define void @and16_trunc_8_sign(i16 %x) nounwind {
579 ; CHECK-LINUX64-LABEL: and16_trunc_8_sign:
580 ; CHECK-LINUX64: # %bb.0:
581 ; CHECK-LINUX64-NEXT: testb $-128, %dil
582 ; CHECK-LINUX64-NEXT: jg .LBB13_2
583 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
584 ; CHECK-LINUX64-NEXT: pushq %rax
585 ; CHECK-LINUX64-NEXT: callq bar
586 ; CHECK-LINUX64-NEXT: popq %rax
587 ; CHECK-LINUX64-NEXT: .LBB13_2: # %no
588 ; CHECK-LINUX64-NEXT: retq
590 ; CHECK-WIN32-64-LABEL: and16_trunc_8_sign:
591 ; CHECK-WIN32-64: # %bb.0:
592 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
593 ; CHECK-WIN32-64-NEXT: testb $-128, %cl
594 ; CHECK-WIN32-64-NEXT: jg .LBB13_2
595 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
596 ; CHECK-WIN32-64-NEXT: callq bar
597 ; CHECK-WIN32-64-NEXT: .LBB13_2: # %no
598 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
599 ; CHECK-WIN32-64-NEXT: retq
601 ; CHECK-X86-LABEL: and16_trunc_8_sign:
602 ; CHECK-X86: # %bb.0:
603 ; CHECK-X86-NEXT: testb $-128, {{[0-9]+}}(%esp)
604 ; CHECK-X86-NEXT: jg .LBB13_2
605 ; CHECK-X86-NEXT: # %bb.1: # %yes
606 ; CHECK-X86-NEXT: calll bar
607 ; CHECK-X86-NEXT: .LBB13_2: # %no
608 ; CHECK-X86-NEXT: retl
610 %r = trunc i16 %t to i8
611 %s = icmp sle i8 %r, 0
612 br i1 %s, label %yes, label %no
621 define void @and32_trunc_8_sign(i32 %x) nounwind {
622 ; CHECK-LINUX64-LABEL: and32_trunc_8_sign:
623 ; CHECK-LINUX64: # %bb.0:
624 ; CHECK-LINUX64-NEXT: testb $-128, %dil
625 ; CHECK-LINUX64-NEXT: jg .LBB14_2
626 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
627 ; CHECK-LINUX64-NEXT: pushq %rax
628 ; CHECK-LINUX64-NEXT: callq bar
629 ; CHECK-LINUX64-NEXT: popq %rax
630 ; CHECK-LINUX64-NEXT: .LBB14_2: # %no
631 ; CHECK-LINUX64-NEXT: retq
633 ; CHECK-WIN32-64-LABEL: and32_trunc_8_sign:
634 ; CHECK-WIN32-64: # %bb.0:
635 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
636 ; CHECK-WIN32-64-NEXT: testb $-128, %cl
637 ; CHECK-WIN32-64-NEXT: jg .LBB14_2
638 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
639 ; CHECK-WIN32-64-NEXT: callq bar
640 ; CHECK-WIN32-64-NEXT: .LBB14_2: # %no
641 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
642 ; CHECK-WIN32-64-NEXT: retq
644 ; CHECK-X86-LABEL: and32_trunc_8_sign:
645 ; CHECK-X86: # %bb.0:
646 ; CHECK-X86-NEXT: testb $-128, {{[0-9]+}}(%esp)
647 ; CHECK-X86-NEXT: jg .LBB14_2
648 ; CHECK-X86-NEXT: # %bb.1: # %yes
649 ; CHECK-X86-NEXT: calll bar
650 ; CHECK-X86-NEXT: .LBB14_2: # %no
651 ; CHECK-X86-NEXT: retl
653 %r = trunc i32 %t to i8
654 %s = icmp sle i8 %r, 0
655 br i1 %s, label %yes, label %no
664 define void @and64_trunc_8_sign(i64 %x) nounwind {
665 ; CHECK-LINUX64-LABEL: and64_trunc_8_sign:
666 ; CHECK-LINUX64: # %bb.0:
667 ; CHECK-LINUX64-NEXT: testb $-128, %dil
668 ; CHECK-LINUX64-NEXT: jg .LBB15_2
669 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
670 ; CHECK-LINUX64-NEXT: pushq %rax
671 ; CHECK-LINUX64-NEXT: callq bar
672 ; CHECK-LINUX64-NEXT: popq %rax
673 ; CHECK-LINUX64-NEXT: .LBB15_2: # %no
674 ; CHECK-LINUX64-NEXT: retq
676 ; CHECK-WIN32-64-LABEL: and64_trunc_8_sign:
677 ; CHECK-WIN32-64: # %bb.0:
678 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
679 ; CHECK-WIN32-64-NEXT: testb $-128, %cl
680 ; CHECK-WIN32-64-NEXT: jg .LBB15_2
681 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
682 ; CHECK-WIN32-64-NEXT: callq bar
683 ; CHECK-WIN32-64-NEXT: .LBB15_2: # %no
684 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
685 ; CHECK-WIN32-64-NEXT: retq
687 ; CHECK-X86-LABEL: and64_trunc_8_sign:
688 ; CHECK-X86: # %bb.0:
689 ; CHECK-X86-NEXT: testb $-128, {{[0-9]+}}(%esp)
690 ; CHECK-X86-NEXT: jg .LBB15_2
691 ; CHECK-X86-NEXT: # %bb.1: # %yes
692 ; CHECK-X86-NEXT: calll bar
693 ; CHECK-X86-NEXT: .LBB15_2: # %no
694 ; CHECK-X86-NEXT: retl
696 %r = trunc i64 %t to i8
697 %s = icmp sle i8 %r, 0
698 br i1 %s, label %yes, label %no
707 define void @and32_trunc_16_sign(i32 %x) nounwind {
708 ; CHECK-LINUX64-LABEL: and32_trunc_16_sign:
709 ; CHECK-LINUX64: # %bb.0:
710 ; CHECK-LINUX64-NEXT: andl $32768, %edi # imm = 0x8000
711 ; CHECK-LINUX64-NEXT: testw %di, %di
712 ; CHECK-LINUX64-NEXT: jg .LBB16_2
713 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
714 ; CHECK-LINUX64-NEXT: pushq %rax
715 ; CHECK-LINUX64-NEXT: callq bar
716 ; CHECK-LINUX64-NEXT: popq %rax
717 ; CHECK-LINUX64-NEXT: .LBB16_2: # %no
718 ; CHECK-LINUX64-NEXT: retq
720 ; CHECK-WIN32-64-LABEL: and32_trunc_16_sign:
721 ; CHECK-WIN32-64: # %bb.0:
722 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
723 ; CHECK-WIN32-64-NEXT: andl $32768, %ecx # imm = 0x8000
724 ; CHECK-WIN32-64-NEXT: testw %cx, %cx
725 ; CHECK-WIN32-64-NEXT: jg .LBB16_2
726 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
727 ; CHECK-WIN32-64-NEXT: callq bar
728 ; CHECK-WIN32-64-NEXT: .LBB16_2: # %no
729 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
730 ; CHECK-WIN32-64-NEXT: retq
732 ; CHECK-X86-LABEL: and32_trunc_16_sign:
733 ; CHECK-X86: # %bb.0:
734 ; CHECK-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
735 ; CHECK-X86-NEXT: andl $32768, %eax # imm = 0x8000
736 ; CHECK-X86-NEXT: testw %ax, %ax
737 ; CHECK-X86-NEXT: jg .LBB16_2
738 ; CHECK-X86-NEXT: # %bb.1: # %yes
739 ; CHECK-X86-NEXT: calll bar
740 ; CHECK-X86-NEXT: .LBB16_2: # %no
741 ; CHECK-X86-NEXT: retl
742 %t = and i32 %x, 32768
743 %r = trunc i32 %t to i16
744 %s = icmp sle i16 %r, 0
745 br i1 %s, label %yes, label %no
754 define void @and32_trunc_16_sign_minsize(i32 %x) minsize nounwind {
755 ; CHECK-LINUX64-LABEL: and32_trunc_16_sign_minsize:
756 ; CHECK-LINUX64: # %bb.0:
757 ; CHECK-LINUX64-NEXT: testw $-32768, %di # imm = 0x8000
758 ; CHECK-LINUX64-NEXT: jg .LBB17_2
759 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
760 ; CHECK-LINUX64-NEXT: pushq %rax
761 ; CHECK-LINUX64-NEXT: callq bar
762 ; CHECK-LINUX64-NEXT: popq %rax
763 ; CHECK-LINUX64-NEXT: .LBB17_2: # %no
764 ; CHECK-LINUX64-NEXT: retq
766 ; CHECK-WIN32-64-LABEL: and32_trunc_16_sign_minsize:
767 ; CHECK-WIN32-64: # %bb.0:
768 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
769 ; CHECK-WIN32-64-NEXT: testw $-32768, %cx # imm = 0x8000
770 ; CHECK-WIN32-64-NEXT: jg .LBB17_2
771 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
772 ; CHECK-WIN32-64-NEXT: callq bar
773 ; CHECK-WIN32-64-NEXT: .LBB17_2: # %no
774 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
775 ; CHECK-WIN32-64-NEXT: retq
777 ; CHECK-X86-LABEL: and32_trunc_16_sign_minsize:
778 ; CHECK-X86: # %bb.0:
779 ; CHECK-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
780 ; CHECK-X86-NEXT: testw $-32768, %ax # imm = 0x8000
781 ; CHECK-X86-NEXT: jg .LBB17_2
782 ; CHECK-X86-NEXT: # %bb.1: # %yes
783 ; CHECK-X86-NEXT: calll bar
784 ; CHECK-X86-NEXT: .LBB17_2: # %no
785 ; CHECK-X86-NEXT: retl
786 %t = and i32 %x, 32768
787 %r = trunc i32 %t to i16
788 %s = icmp sle i16 %r, 0
789 br i1 %s, label %yes, label %no
798 define void @and64_trunc_16_sign(i64 %x) nounwind {
799 ; CHECK-LINUX64-LABEL: and64_trunc_16_sign:
800 ; CHECK-LINUX64: # %bb.0:
801 ; CHECK-LINUX64-NEXT: andl $32768, %edi # imm = 0x8000
802 ; CHECK-LINUX64-NEXT: testw %di, %di
803 ; CHECK-LINUX64-NEXT: jg .LBB18_2
804 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
805 ; CHECK-LINUX64-NEXT: pushq %rax
806 ; CHECK-LINUX64-NEXT: callq bar
807 ; CHECK-LINUX64-NEXT: popq %rax
808 ; CHECK-LINUX64-NEXT: .LBB18_2: # %no
809 ; CHECK-LINUX64-NEXT: retq
811 ; CHECK-WIN32-64-LABEL: and64_trunc_16_sign:
812 ; CHECK-WIN32-64: # %bb.0:
813 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
814 ; CHECK-WIN32-64-NEXT: andl $32768, %ecx # imm = 0x8000
815 ; CHECK-WIN32-64-NEXT: testw %cx, %cx
816 ; CHECK-WIN32-64-NEXT: jg .LBB18_2
817 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
818 ; CHECK-WIN32-64-NEXT: callq bar
819 ; CHECK-WIN32-64-NEXT: .LBB18_2: # %no
820 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
821 ; CHECK-WIN32-64-NEXT: retq
823 ; CHECK-X86-LABEL: and64_trunc_16_sign:
824 ; CHECK-X86: # %bb.0:
825 ; CHECK-X86-NEXT: movl $32768, %eax # imm = 0x8000
826 ; CHECK-X86-NEXT: andl {{[0-9]+}}(%esp), %eax
827 ; CHECK-X86-NEXT: testw %ax, %ax
828 ; CHECK-X86-NEXT: jg .LBB18_2
829 ; CHECK-X86-NEXT: # %bb.1: # %yes
830 ; CHECK-X86-NEXT: calll bar
831 ; CHECK-X86-NEXT: .LBB18_2: # %no
832 ; CHECK-X86-NEXT: retl
833 %t = and i64 %x, 32768
834 %r = trunc i64 %t to i16
835 %s = icmp sle i16 %r, 0
836 br i1 %s, label %yes, label %no
845 define void @and64_trunc_16_sign_minsize(i64 %x) minsize nounwind {
846 ; CHECK-LINUX64-LABEL: and64_trunc_16_sign_minsize:
847 ; CHECK-LINUX64: # %bb.0:
848 ; CHECK-LINUX64-NEXT: testw $-32768, %di # imm = 0x8000
849 ; CHECK-LINUX64-NEXT: jg .LBB19_2
850 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
851 ; CHECK-LINUX64-NEXT: pushq %rax
852 ; CHECK-LINUX64-NEXT: callq bar
853 ; CHECK-LINUX64-NEXT: popq %rax
854 ; CHECK-LINUX64-NEXT: .LBB19_2: # %no
855 ; CHECK-LINUX64-NEXT: retq
857 ; CHECK-WIN32-64-LABEL: and64_trunc_16_sign_minsize:
858 ; CHECK-WIN32-64: # %bb.0:
859 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
860 ; CHECK-WIN32-64-NEXT: testw $-32768, %cx # imm = 0x8000
861 ; CHECK-WIN32-64-NEXT: jg .LBB19_2
862 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
863 ; CHECK-WIN32-64-NEXT: callq bar
864 ; CHECK-WIN32-64-NEXT: .LBB19_2: # %no
865 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
866 ; CHECK-WIN32-64-NEXT: retq
868 ; CHECK-X86-LABEL: and64_trunc_16_sign_minsize:
869 ; CHECK-X86: # %bb.0:
870 ; CHECK-X86-NEXT: testw $-32768, {{[0-9]+}}(%esp) # imm = 0x8000
871 ; CHECK-X86-NEXT: jg .LBB19_2
872 ; CHECK-X86-NEXT: # %bb.1: # %yes
873 ; CHECK-X86-NEXT: calll bar
874 ; CHECK-X86-NEXT: .LBB19_2: # %no
875 ; CHECK-X86-NEXT: retl
876 %t = and i64 %x, 32768
877 %r = trunc i64 %t to i16
878 %s = icmp sle i16 %r, 0
879 br i1 %s, label %yes, label %no
888 define void @and64_trunc_32_sign(i64 %x) nounwind {
889 ; CHECK-LINUX64-LABEL: and64_trunc_32_sign:
890 ; CHECK-LINUX64: # %bb.0:
891 ; CHECK-LINUX64-NEXT: testl $-2147483648, %edi # imm = 0x80000000
892 ; CHECK-LINUX64-NEXT: jg .LBB20_2
893 ; CHECK-LINUX64-NEXT: # %bb.1: # %yes
894 ; CHECK-LINUX64-NEXT: pushq %rax
895 ; CHECK-LINUX64-NEXT: callq bar
896 ; CHECK-LINUX64-NEXT: popq %rax
897 ; CHECK-LINUX64-NEXT: .LBB20_2: # %no
898 ; CHECK-LINUX64-NEXT: retq
900 ; CHECK-WIN32-64-LABEL: and64_trunc_32_sign:
901 ; CHECK-WIN32-64: # %bb.0:
902 ; CHECK-WIN32-64-NEXT: subq $40, %rsp
903 ; CHECK-WIN32-64-NEXT: testl $-2147483648, %ecx # imm = 0x80000000
904 ; CHECK-WIN32-64-NEXT: jg .LBB20_2
905 ; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
906 ; CHECK-WIN32-64-NEXT: callq bar
907 ; CHECK-WIN32-64-NEXT: .LBB20_2: # %no
908 ; CHECK-WIN32-64-NEXT: addq $40, %rsp
909 ; CHECK-WIN32-64-NEXT: retq
911 ; CHECK-X86-LABEL: and64_trunc_32_sign:
912 ; CHECK-X86: # %bb.0:
913 ; CHECK-X86-NEXT: testl $-2147483648, {{[0-9]+}}(%esp) # imm = 0x80000000
914 ; CHECK-X86-NEXT: jg .LBB20_2
915 ; CHECK-X86-NEXT: # %bb.1: # %yes
916 ; CHECK-X86-NEXT: calll bar
917 ; CHECK-X86-NEXT: .LBB20_2: # %no
918 ; CHECK-X86-NEXT: retl
919 %t = and i64 %x, 2147483648
920 %r = trunc i64 %t to i32
921 %s = icmp sle i32 %r, 0
922 br i1 %s, label %yes, label %no