[llvm] r303003 - foo
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun May 14 00:54:40 PDT 2017
Author: ctopper
Date: Sun May 14 02:54:40 2017
New Revision: 303003
URL: http://llvm.org/viewvc/llvm-project?rev=303003&view=rev
Log:
foo
Modified:
llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll?rev=303003&r1=303002&r2=303003&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll Sun May 14 02:54:40 2017
@@ -628,3 +628,125 @@ define i32 @test46_commuted_and(i32 %a,
%or = or i32 %xor, %and
ret i32 %or
}
+
+; (~A ^ B) | (A & B) -> ~A ^ B
+
+define i32 @test47(i32 %a, i32 %b) {
+; CHECK-LABEL: @test47(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], [[B:%.*]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[NEGA]], [[B]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[XOR]], [[AND]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %a, %b
+ %xor = xor i32 %nega, %b
+ %or = or i32 %xor, %and
+ ret i32 %or
+}
+
+define i32 @test48(i32 %a, i32 %b) {
+; CHECK-LABEL: @test48(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], [[B:%.*]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[B]], [[NEGA]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[XOR]], [[AND]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %a, %b
+ %xor = xor i32 %b, %nega
+ %or = or i32 %xor, %and
+ ret i32 %or
+}
+
+define i32 @test49(i32 %a, i32 %b) {
+; CHECK-LABEL: @test49(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[B:%.*]], [[A]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[B]], [[NEGA]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[XOR]], [[AND]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %b, %a
+ %xor = xor i32 %b, %nega
+ %or = or i32 %xor, %and
+ ret i32 %or
+}
+
+define i32 @test50(i32 %a, i32 %b) {
+; CHECK-LABEL: @test50(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[B:%.*]], [[A]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[NEGA]], [[B]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[XOR]], [[AND]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %b, %a
+ %xor = xor i32 %nega, %b
+ %or = or i32 %xor, %and
+ ret i32 %or
+}
+
+define i32 @test51(i32 %a, i32 %b) {
+; CHECK-LABEL: @test51(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], [[B:%.*]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[NEGA]], [[B]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND]], [[XOR]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %a, %b
+ %xor = xor i32 %nega, %b
+ %or = or i32 %and, %xor
+ ret i32 %or
+}
+
+define i32 @test52(i32 %a, i32 %b) {
+; CHECK-LABEL: @test52(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], [[B:%.*]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[B]], [[NEGA]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND]], [[XOR]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %a, %b
+ %xor = xor i32 %b, %nega
+ %or = or i32 %and, %xor
+ ret i32 %or
+}
+
+define i32 @test53(i32 %a, i32 %b) {
+; CHECK-LABEL: @test53(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[B:%.*]], [[A]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[B]], [[NEGA]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND]], [[XOR]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %b, %a
+ %xor = xor i32 %b, %nega
+ %or = or i32 %and, %xor
+ ret i32 %or
+}
+
+define i32 @test54(i32 %a, i32 %b) {
+; CHECK-LABEL: @test54(
+; CHECK-NEXT: [[NEGA:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[B:%.*]], [[A]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[NEGA]], [[B]]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND]], [[XOR]]
+; CHECK-NEXT: ret i32 [[OR]]
+;
+ %nega = xor i32 %a, -1
+ %and = and i32 %b, %a
+ %xor = xor i32 %nega, %b
+ %or = or i32 %and, %xor
+ ret i32 %or
+}
More information about the llvm-commits
mailing list