blob: 9b812c7f736921731448c15625d5a1d120ae2f5d [file] [log] [blame]
Chris Lattnera8de4cc2007-06-15 05:57:20 +00001; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | wc -l | grep 2
2; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and
3; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep { or}
4
5; PR1510
6
7; These are all equivelent to A^B
8
9define i32 @test1(i32 %a, i32 %b) {
10entry:
11 %tmp3 = or i32 %b, %a ; <i32> [#uses=1]
12 %tmp3not = xor i32 %tmp3, -1 ; <i32> [#uses=1]
13 %tmp6 = and i32 %b, %a ; <i32> [#uses=1]
14 %tmp7 = or i32 %tmp6, %tmp3not ; <i32> [#uses=1]
15 %tmp7not = xor i32 %tmp7, -1 ; <i32> [#uses=1]
16 ret i32 %tmp7not
17}
18
19define i32 @test2(i32 %a, i32 %b) {
20entry:
21 %tmp3 = or i32 %b, %a ; <i32> [#uses=1]
22 %tmp6 = and i32 %b, %a ; <i32> [#uses=1]
23 %tmp6not = xor i32 %tmp6, -1 ; <i32> [#uses=1]
24 %tmp7 = and i32 %tmp3, %tmp6not ; <i32> [#uses=1]
25 ret i32 %tmp7
26}
27