xref: /llvm-project/llvm/test/CodeGen/X86/2012-08-07-CmpISelBug.ll (revision a70d5e25f32ebd5f1d1c394312036a37591e998b)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-apple-macosx | FileCheck %s
3
4; Cmp lowering should not look past the truncate unless the high bits are known
5; zero.
6; rdar://12027825
7
8define void @foo(i8 %arg4, i32 %arg5, ptr %arg14) nounwind {
9; CHECK-LABEL: foo:
10; CHECK:       ## %bb.0: ## %bb
11; CHECK-NEXT:    andl $32, %edi
12; CHECK-NEXT:    movb $81, %al
13; CHECK-NEXT:    subb %dil, %al
14; CHECK-NEXT:    testl %esi, %edi
15; CHECK-NEXT:    movzbl %al, %eax
16; CHECK-NEXT:    movl $1, %ecx
17; CHECK-NEXT:    cmovnel %eax, %ecx
18; CHECK-NEXT:    xorb $81, %cl
19; CHECK-NEXT:    movzbl %cl, %eax
20; CHECK-NEXT:    addl $2062143348, %eax ## imm = 0x7AE9CF74
21; CHECK-NEXT:    movl %eax, (%rdx)
22; CHECK-NEXT:    retq
23bb:
24  %tmp48 = zext i8 %arg4 to i32
25  %tmp49 = and i32 %tmp48, 32
26  %tmp50 = add i32 %tmp49, 1593371643
27  %tmp55 = sub i32 %tmp50, 0
28  %tmp56 = add i32 %tmp55, 7787538
29  %tmp57 = xor i32 %tmp56, 1601159181
30  %tmp58 = xor i32 %arg5, 1601159181
31  %tmp59 = and i32 %tmp57, %tmp58
32  %tmp60 = add i32 %tmp59, -1263900958
33  %tmp67 = sub i32 %tmp60, 0
34  %tmp103 = xor i32 %tmp56, 13
35  %tmp104 = trunc i32 %tmp103 to i8
36  %tmp105 = sub i8 0, %tmp104
37  %tmp106 = add i8 %tmp105, -103
38  %tmp113 = sub i8 %tmp106, 0
39  %tmp114 = add i8 %tmp113, -72
40  %tmp141 = icmp ne i32 %tmp67, -1263900958
41  %tmp142 = select i1 %tmp141, i8 %tmp114, i8 1
42  %tmp143 = xor i8 %tmp142, 81
43  %tmp144 = zext i8 %tmp143 to i32
44  %tmp145 = add i32 %tmp144, 2062143348
45  %tmp152 = sub i32 %tmp145, 0
46  store i32 %tmp152, ptr %arg14
47  ret void
48}
49