xref: /llvm-project/llvm/test/Transforms/SCCP/apint-basictest4.ll (revision 8ebb3eac02a926ffa4298c12834c57aefb2e8579)
17f7dac71SZarko Todorovski; This is a basic correctness check for constant propagation.  It tests the
27f7dac71SZarko Todorovski; basic logic operations.
3cee313d2SEric Christopher
4cee313d2SEric Christopher
5*8ebb3eacSBjorn Pettersson; RUN: opt < %s -passes=sccp -S | not grep and
6*8ebb3eacSBjorn Pettersson; RUN: opt < %s -passes=sccp -S | not grep trunc
7*8ebb3eacSBjorn Pettersson; RUN: opt < %s -passes=sccp -S | grep "ret i100 -1"
8cee313d2SEric Christopher
9cee313d2SEric Christopherdefine i100 @test(i133 %A) {
10cee313d2SEric Christopher        %B = and i133 0, %A
11cee313d2SEric Christopher        %C = icmp sgt i133 %B, 0
12cee313d2SEric Christopher	br i1 %C, label %BB1, label %BB2
13cee313d2SEric ChristopherBB1:
14cee313d2SEric Christopher        %t3 = xor i133 %B, -1
15cee313d2SEric Christopher        %t4 = trunc i133 %t3 to i100
16cee313d2SEric Christopher	br label %BB3
17cee313d2SEric ChristopherBB2:
18cee313d2SEric Christopher        %f1 = or i133 -1, %A
19cee313d2SEric Christopher        %f2 = lshr i133 %f1, 33
20cee313d2SEric Christopher        %f3 = trunc i133 %f2 to i100
21cee313d2SEric Christopher	br label %BB3
22cee313d2SEric ChristopherBB3:
23cee313d2SEric Christopher	%Ret = phi i100 [%t4, %BB1], [%f3, %BB2]
24cee313d2SEric Christopher	ret i100 %Ret
25cee313d2SEric Christopher}
26