1 ; This test makes sure that the xor instructions are properly eliminated 2 ; when arbitrary precision integers are used. 3 4 ; RUN: opt < %s -instcombine -S | not grep xor 5 6 define i33 @test1(i33 %A) { 7 %B = xor i33 %A, -1 8 %C = xor i33 %B, -1 9 ret i33 %C 10 } 11 12 define i1 @test2(i52 %A, i52 %B) { 13 %cond = icmp ule i52 %A, %B ; Can change into uge 14 %Ret = xor i1 %cond, true 15 ret i1 %Ret 16 } 17 18 ; Test that demorgans law can be instcombined 19 define i47 @test3(i47 %A, i47 %B) { 20 %a = xor i47 %A, -1 21 %b = xor i47 %B, -1 22 %c = and i47 %a, %b 23 %d = xor i47 %c, -1 24 ret i47 %d 25 } 26 27 ; Test that demorgens law can work with constants 28 define i61 @test4(i61 %A, i61 %B) { 29 %a = xor i61 %A, -1 30 %c = and i61 %a, 5 ; 5 = ~c2 31 %d = xor i61 %c, -1 32 ret i61 %d 33 } 34 35 ; test the mirror of demorgans law... 36 define i71 @test5(i71 %A, i71 %B) { 37 %a = xor i71 %A, -1 38 %b = xor i71 %B, -1 39 %c = or i71 %a, %b 40 %d = xor i71 %c, -1 41 ret i71 %d 42 } 43