1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 ; <rdar://problem/10803154>
6 ; There should be no transformation.
7 define i1 @f1(i32 %x) {
9 ; CHECK-NEXT: [[A:%.*]] = trunc i32 [[X:%.*]] to i8
10 ; CHECK-NEXT: [[B:%.*]] = icmp ne i8 [[A]], 0
11 ; CHECK-NEXT: [[C:%.*]] = and i32 [[X]], 16711680
12 ; CHECK-NEXT: [[D:%.*]] = icmp ne i32 [[C]], 0
13 ; CHECK-NEXT: [[E:%.*]] = and i1 [[B]], [[D]]
14 ; CHECK-NEXT: ret i1 [[E]]
16 %a = trunc i32 %x to i8
18 %c = and i32 %x, 16711680
19 %d = icmp ne i32 %c, 0
24 define i1 @f1_logical(i32 %x) {
25 ; CHECK-LABEL: @f1_logical(
26 ; CHECK-NEXT: [[A:%.*]] = trunc i32 [[X:%.*]] to i8
27 ; CHECK-NEXT: [[B:%.*]] = icmp ne i8 [[A]], 0
28 ; CHECK-NEXT: [[C:%.*]] = and i32 [[X]], 16711680
29 ; CHECK-NEXT: [[D:%.*]] = icmp ne i32 [[C]], 0
30 ; CHECK-NEXT: [[E:%.*]] = and i1 [[B]], [[D]]
31 ; CHECK-NEXT: ret i1 [[E]]
33 %a = trunc i32 %x to i8
35 %c = and i32 %x, 16711680
36 %d = icmp ne i32 %c, 0
37 %e = select i1 %b, i1 %d, i1 false