xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/2012-02-28-ICmp.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; <rdar://problem/10803154>
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; There should be no transformation.
5*9880d681SAndroid Build Coastguard Worker; CHECK: %a = trunc i32 %x to i8
6*9880d681SAndroid Build Coastguard Worker; CHECK: %b = icmp ne i8 %a, 0
7*9880d681SAndroid Build Coastguard Worker; CHECK: %c = and i32 %x, 16711680
8*9880d681SAndroid Build Coastguard Worker; CHECK: %d = icmp ne i32 %c, 0
9*9880d681SAndroid Build Coastguard Worker; CHECK: %e = and i1 %b, %d
10*9880d681SAndroid Build Coastguard Worker; CHECK: ret i1 %e
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdefine i1 @f1(i32 %x) {
13*9880d681SAndroid Build Coastguard Worker  %a = trunc i32 %x to i8
14*9880d681SAndroid Build Coastguard Worker  %b = icmp ne i8 %a, 0
15*9880d681SAndroid Build Coastguard Worker  %c = and i32 %x, 16711680
16*9880d681SAndroid Build Coastguard Worker  %d = icmp ne i32 %c, 0
17*9880d681SAndroid Build Coastguard Worker  %e = and i1 %b, %d
18*9880d681SAndroid Build Coastguard Worker  ret i1 %e
19*9880d681SAndroid Build Coastguard Worker}
20