1 ; This test makes sure that these instructions are properly eliminated.
4 ; RUN: opt < %s -instcombine -S | not grep xor
6 define i32 @test1(i32 %A) {
7 %B = xor i32 %A, -1 ; <i32> [#uses=1]
8 %C = xor i32 %B, -1 ; <i32> [#uses=1]
12 define i1 @test2(i32 %A, i32 %B) {
13 ; Can change into setge
14 %cond = icmp sle i32 %A, %B ; <i1> [#uses=1]
15 %Ret = xor i1 %cond, true ; <i1> [#uses=1]
19 ; Test that demorgans law can be instcombined
20 define i32 @test3(i32 %A, i32 %B) {
21 %a = xor i32 %A, -1 ; <i32> [#uses=1]
22 %b = xor i32 %B, -1 ; <i32> [#uses=1]
23 %c = and i32 %a, %b ; <i32> [#uses=1]
24 %d = xor i32 %c, -1 ; <i32> [#uses=1]
28 ; Test that demorgens law can work with constants
29 define i32 @test4(i32 %A, i32 %B) {
30 %a = xor i32 %A, -1 ; <i32> [#uses=1]
31 %c = and i32 %a, 5 ; <i32> [#uses=1]
32 %d = xor i32 %c, -1 ; <i32> [#uses=1]
36 ; test the mirror of demorgans law...
37 define i32 @test5(i32 %A, i32 %B) {
38 %a = xor i32 %A, -1 ; <i32> [#uses=1]
39 %b = xor i32 %B, -1 ; <i32> [#uses=1]
40 %c = or i32 %a, %b ; <i32> [#uses=1]
41 %d = xor i32 %c, -1 ; <i32> [#uses=1]
46 define i8 @test6(i32 %a, i32 %b) zeroext nounwind {
48 %tmp1not = xor i32 %a, -1 ; <i32> [#uses=1]
49 %tmp2not = xor i32 %b, -1 ; <i32> [#uses=1]
50 %tmp3 = icmp slt i32 %tmp1not, %tmp2not ; <i1> [#uses=1]
51 %retval67 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]