xref: /aosp_15_r20/external/llvm/test/Transforms/SCCP/apint-basictest4.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; This is a basic sanity check for constant propagation.  It tests the basic
2*9880d681SAndroid Build Coastguard Worker; logic operations.
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -sccp -S | not grep and
6*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -sccp -S | not grep trunc
7*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -sccp -S | grep "ret i100 -1"
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine i100 @test(i133 %A) {
10*9880d681SAndroid Build Coastguard Worker        %B = and i133 0, %A
11*9880d681SAndroid Build Coastguard Worker        %C = icmp sgt i133 %B, 0
12*9880d681SAndroid Build Coastguard Worker	br i1 %C, label %BB1, label %BB2
13*9880d681SAndroid Build Coastguard WorkerBB1:
14*9880d681SAndroid Build Coastguard Worker        %t3 = xor i133 %B, -1
15*9880d681SAndroid Build Coastguard Worker        %t4 = trunc i133 %t3 to i100
16*9880d681SAndroid Build Coastguard Worker	br label %BB3
17*9880d681SAndroid Build Coastguard WorkerBB2:
18*9880d681SAndroid Build Coastguard Worker        %f1 = or i133 -1, %A
19*9880d681SAndroid Build Coastguard Worker        %f2 = lshr i133 %f1, 33
20*9880d681SAndroid Build Coastguard Worker        %f3 = trunc i133 %f2 to i100
21*9880d681SAndroid Build Coastguard Worker	br label %BB3
22*9880d681SAndroid Build Coastguard WorkerBB3:
23*9880d681SAndroid Build Coastguard Worker	%Ret = phi i100 [%t4, %BB1], [%f3, %BB2]
24*9880d681SAndroid Build Coastguard Worker	ret i100 %Ret
25*9880d681SAndroid Build Coastguard Worker}
26