X86 cmp lowering is looking past truncate on the condition node. It should only
[oota-llvm.git] / test / CodeGen / X86 / 2012-08-07-CmpISelBug.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx | FileCheck %s
2
3 ; Cmp lowering should not look past the truncate unless the high bits are known
4 ; zero.
5 ; rdar://12027825
6
7 define void @foo(i8 %arg4, i32 %arg5, i32* %arg14) nounwind {
8 bb:
9 ; CHECK: foo:
10 ; CHECK-NOT: testl
11 ; CHECK: testb
12   %tmp48 = zext i8 %arg4 to i32
13   %tmp49 = and i32 %tmp48, 32
14   %tmp50 = add i32 %tmp49, 1593371643
15   %tmp55 = sub i32 %tmp50, 0
16   %tmp56 = add i32 %tmp55, 7787538
17   %tmp57 = xor i32 %tmp56, 1601159181
18   %tmp58 = xor i32 %arg5, 1601159181
19   %tmp59 = and i32 %tmp57, %tmp58
20   %tmp60 = add i32 %tmp59, -1263900958
21   %tmp67 = sub i32 %tmp60, 0
22   %tmp103 = xor i32 %tmp56, 13
23   %tmp104 = trunc i32 %tmp103 to i8
24   %tmp105 = sub i8 0, %tmp104
25   %tmp106 = add i8 %tmp105, -103
26   %tmp113 = sub i8 %tmp106, 0
27   %tmp114 = add i8 %tmp113, -72
28   %tmp141 = icmp ne i32 %tmp67, -1263900958
29   %tmp142 = select i1 %tmp141, i8 %tmp114, i8 undef
30   %tmp143 = xor i8 %tmp142, 81
31   %tmp144 = zext i8 %tmp143 to i32
32   %tmp145 = add i32 %tmp144, 2062143348
33   %tmp152 = sub i32 %tmp145, 0
34   store i32 %tmp152, i32* %arg14
35   ret void
36 }