[PowerPC] Recommit r314244 with refactoring and off by default
[llvm-core.git] / test / CodeGen / X86 / pr12360.ll
blob3e762da545d2c036f84a2d99f86e421a6bdbe5d4
1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
3 define zeroext i1 @f1(i8* %x) {
4 ; CHECK-LABEL: f1:
5 ; CHECK: movb   (%rdi), %al
6 ; CHECK-NEXT: ret
8 entry:
9   %0 = load i8, i8* %x, align 1, !range !0
10   %tobool = trunc i8 %0 to i1
11   ret i1 %tobool
14 define zeroext i1 @f2(i8* %x) {
15 ; CHECK-LABEL: f2:
16 ; CHECK: movb   (%rdi), %al
17 ; CHECK-NEXT: ret
19 entry:
20   %0 = load i8, i8* %x, align 1, !range !0
21   %tobool = icmp ne i8 %0, 0
22   ret i1 %tobool
25 !0 = !{i8 0, i8 2}
28 ; check that we don't build a "trunc" from i1 to i1, which would assert.
29 define zeroext i1 @f3(i1 %x) {
30 ; CHECK-LABEL: f3:
32 entry:
33   %tobool = icmp ne i1 %x, 0
34   ret i1 %tobool
37 ; check that we don't build a trunc when other bits are needed
38 define zeroext i1 @f4(i32 %x) {
39 ; CHECK-LABEL: f4:
40 ; CHECK: and
42 entry:
43   %y = and i32 %x, 32768
44   %z = icmp ne i32 %y, 0
45   ret i1 %z