InstCombine: ((A | ~B) ^ (~A | B)) to A ^ B
[oota-llvm.git] / test / Transforms / InstCombine / or-xor.ll
index 6984c44d9a385541f3f7ac4ba9f2188e27742348..984178aeb34e0d9279105016bf58576d4f7c59e9 100644 (file)
@@ -147,3 +147,16 @@ define i32 @test15(i32 %x, i32 %y) {
 ; CHECK-NEXT: %1 = and i32 %y, %x
 ; CHECK-NEXT: ret i32 %1
 }
+
+; ((x | ~y) ^ (~x | y)) -> x ^ y
+define i32 @test16(i32 %x, i32 %y) {
+  %noty = xor i32 %y, -1
+  %notx = xor i32 %x, -1
+  %or1 = or i32 %x, %noty
+  %or2 = or i32 %notx, %y
+  %xor = xor i32 %or1, %or2
+  ret i32 %xor
+; CHECK-LABEL: @test16(
+; CHECK-NEXT: %xor = xor i32 %x, %y
+; CHECK-NEXT: ret i32 %xor
+}