Mercurial > hg > CbC > CbC_llvm
comparison llvm/test/Transforms/Reassociate/inverses.ll @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | 2e18cbf3894f |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | |
2 ; RUN: opt < %s -reassociate -die -S | FileCheck %s | |
3 | |
4 ; (A&B)&~A == 0 | |
5 define i32 @test1(i32 %a, i32 %b) { | |
6 ; CHECK-LABEL: @test1( | |
7 ; CHECK-NEXT: ret i32 0 | |
8 ; | |
9 %t2 = and i32 %b, %a | |
10 %t4 = xor i32 %a, -1 | |
11 %t5 = and i32 %t2, %t4 | |
12 ret i32 %t5 | |
13 } | |
14 | |
15 define <2 x i32> @not_op_vec_undef(<2 x i32> %a, <2 x i32> %b) { | |
16 ; CHECK-LABEL: @not_op_vec_undef( | |
17 ; CHECK-NEXT: ret <2 x i32> zeroinitializer | |
18 ; | |
19 %t2 = and <2 x i32> %b, %a | |
20 %t4 = xor <2 x i32> %a, <i32 -1, i32 undef> | |
21 %t5 = and <2 x i32> %t2, %t4 | |
22 ret <2 x i32> %t5 | |
23 } | |
24 | |
25 ; A&~A == 0 | |
26 define i32 @test2(i32 %a, i32 %b) { | |
27 ; CHECK-LABEL: @test2( | |
28 ; CHECK-NEXT: ret i32 0 | |
29 ; | |
30 %t1 = and i32 %a, 1234 | |
31 %t2 = and i32 %b, %t1 | |
32 %t4 = xor i32 %a, -1 | |
33 %t5 = and i32 %t2, %t4 | |
34 ret i32 %t5 | |
35 } | |
36 | |
37 ; (b+(a+1234))+-a -> b+1234 | |
38 define i32 @test3(i32 %b, i32 %a) { | |
39 ; CHECK-LABEL: @test3( | |
40 ; CHECK-NEXT: [[T5:%.*]] = add i32 [[B:%.*]], 1234 | |
41 ; CHECK-NEXT: ret i32 [[T5]] | |
42 ; | |
43 %t1 = add i32 %a, 1234 | |
44 %t2 = add i32 %b, %t1 | |
45 %t4 = sub i32 0, %a | |
46 %t5 = add i32 %t2, %t4 | |
47 ret i32 %t5 | |
48 } | |
49 | |
50 ; (b+(a+1234))+~a -> b+1233 | |
51 define i32 @test4(i32 %b, i32 %a) { | |
52 ; CHECK-LABEL: @test4( | |
53 ; CHECK-NEXT: [[T5:%.*]] = add i32 [[B:%.*]], 1233 | |
54 ; CHECK-NEXT: ret i32 [[T5]] | |
55 ; | |
56 %t1 = add i32 %a, 1234 | |
57 %t2 = add i32 %b, %t1 | |
58 %t4 = xor i32 %a, -1 | |
59 %t5 = add i32 %t2, %t4 | |
60 ret i32 %t5 | |
61 } | |
62 |