brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 71436f1 Raw
51 lines · plain
1; This test makes sure that xor instructions are properly eliminated.2; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.3 4; RUN: opt < %s -passes=instcombine -S | not grep "xor "5 6 7define i47 @test1(i47 %A, i47 %B) {8        ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 09        %A1 = and i47 %A, 7036874417766410        %B1 = and i47 %B, 7036874417766111        %C1 = xor i47 %A1, %B112        ret i47 %C113}14 15define i15 @test2(i15 %x) {16        %tmp.2 = xor i15 %x, 017        ret i15 %tmp.218}19 20define i23 @test3(i23 %x) {21        %tmp.2 = xor i23 %x, %x22        ret i23 %tmp.223}24 25define i37 @test4(i37 %x) {26        ; x ^ ~x == -127        %NotX = xor i37 -1, %x28        %B = xor i37 %x, %NotX29        ret i37 %B30}31 32define i7 @test5(i7 %A) {33        ;; (A|B)^B == A & (~B)34        %t1 = or i7 %A, 2335        %r = xor i7 %t1, 2336        ret i7 %r37}38 39define i7 @test6(i7 %A) {40        %t1 = xor i7 %A, 2341        %r = xor i7 %t1, 2342        ret i7 %r43}44 45define i47 @test7(i47 %A) {46        ;; (A | C1) ^ C2 -> (A | C1) & ~C2 iff (C1&C2) == C247        %B1 = or i47 %A,   7036874417766348        %C1 = xor i47 %B1, 70368746349        ret i47 %C150}51