[llvm-branch-commits] [llvm] c1937c2 - [NFC] Added/adjusted tests for PR48604; second pattern

Dávid Bolvanský via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 31 06:08:59 PST 2020


Author: Dávid Bolvanský
Date: 2020-12-31T14:59:15+01:00
New Revision: c1937c2af2a03f0b5fda3bbf99e2971ffa04ff0c

URL: https://github.com/llvm/llvm-project/commit/c1937c2af2a03f0b5fda3bbf99e2971ffa04ff0c
DIFF: https://github.com/llvm/llvm-project/commit/c1937c2af2a03f0b5fda3bbf99e2971ffa04ff0c.diff

LOG: [NFC] Added/adjusted tests for PR48604; second pattern

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/and.ll
    llvm/test/Transforms/InstCombine/sub.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/and.ll b/llvm/test/Transforms/InstCombine/and.ll
index a3d5932ff140..020dbc483d9d 100644
--- a/llvm/test/Transforms/InstCombine/and.ll
+++ b/llvm/test/Transforms/InstCombine/and.ll
@@ -1217,49 +1217,3 @@ define <2 x i8> @flip_masked_bit_nonuniform(<2 x i8> %A) {
   %C = and <2 x i8> %B, <i8 16, i8 4>
   ret <2 x i8> %C
 }
-
-
-define i32 @and_test(i32 %x, i32 %y) {
-; CHECK-LABEL: @and_test(
-; CHECK-NEXT:    [[R:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
-; CHECK-NEXT:    ret i32 [[R]]
-;
-  %a = add i32 %x, %y
-  %o = or i32 %x, %y
-  %r = sub i32 %a, %o
-  ret i32 %r
-}
-
-define i32 @and_test2(i32 %x, i32 %y) {
-; CHECK-LABEL: @and_test2(
-; CHECK-NEXT:    [[R:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
-; CHECK-NEXT:    ret i32 [[R]]
-;
-  %a = add i32 %x, %y
-  %o = or i32 %y, %x
-  %r = sub i32 %a, %o
-  ret i32 %r
-}
-
-define i32 @and_test3(i32 %x, i32 %y) {
-; CHECK-LABEL: @and_test3(
-; CHECK-NEXT:    [[R:%.*]] = and i32 [[Y:%.*]], [[X:%.*]]
-; CHECK-NEXT:    ret i32 [[R]]
-;
-  %a = add i32 %y, %x
-  %o = or i32 %x, %y
-  %r = sub i32 %a, %o
-  ret i32 %r
-}
-
-
-define <2 x i8> @and_vec(<2 x i8> %X, <2 x i8> %Y) {
-; CHECK-LABEL: @and_vec(
-; CHECK-NEXT:    [[R:%.*]] = and <2 x i8> [[X:%.*]], [[Y:%.*]]
-; CHECK-NEXT:    ret <2 x i8> [[R]]
-;
-  %a = add <2 x i8> %X, %Y
-  %o = or <2 x i8> %X, %Y
-  %r = sub <2 x i8> %a, %o
-  ret <2 x i8> %r
-}

diff  --git a/llvm/test/Transforms/InstCombine/sub.ll b/llvm/test/Transforms/InstCombine/sub.ll
index 066085fc2535..aaac3f23f71f 100644
--- a/llvm/test/Transforms/InstCombine/sub.ll
+++ b/llvm/test/Transforms/InstCombine/sub.ll
@@ -1574,3 +1574,99 @@ define i16 @sub_mul_nuw(i16 %x, i16 %y) {
   %r = sub i16 %x8, %y8
   ret i16 %r
 }
+define i32 @and_test(i32 %x, i32 %y) {
+; CHECK-LABEL: @and_test(
+; CHECK-NEXT:    [[R:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %a = add i32 %x, %y
+  %o = or i32 %x, %y
+  %r = sub i32 %a, %o
+  ret i32 %r
+}
+
+define i32 @and_test2(i32 %x, i32 %y) {
+; CHECK-LABEL: @and_test2(
+; CHECK-NEXT:    [[R:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %a = add i32 %x, %y
+  %o = or i32 %y, %x
+  %r = sub i32 %a, %o
+  ret i32 %r
+}
+
+define i32 @and_test3(i32 %x, i32 %y) {
+; CHECK-LABEL: @and_test3(
+; CHECK-NEXT:    [[R:%.*]] = and i32 [[Y:%.*]], [[X:%.*]]
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %a = add i32 %y, %x
+  %o = or i32 %x, %y
+  %r = sub i32 %a, %o
+  ret i32 %r
+}
+
+
+define <2 x i8> @and_vec(<2 x i8> %X, <2 x i8> %Y) {
+; CHECK-LABEL: @and_vec(
+; CHECK-NEXT:    [[R:%.*]] = and <2 x i8> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    ret <2 x i8> [[R]]
+;
+  %a = add <2 x i8> %X, %Y
+  %o = or <2 x i8> %X, %Y
+  %r = sub <2 x i8> %a, %o
+  ret <2 x i8> %r
+}
+
+define i32 @or_test(i32 %x, i32 %y) {
+; CHECK-LABEL: @or_test(
+; CHECK-NEXT:    [[A:%.*]] = add i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[B:%.*]] = and i32 [[X]], [[Y]]
+; CHECK-NEXT:    [[R:%.*]] = sub i32 [[A]], [[B]]
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %a = add i32 %x, %y
+  %b = and i32 %x, %y
+  %r = sub i32 %a, %b
+  ret i32 %r
+}
+
+define i32 @or_test2(i32 %x, i32 %y) {
+; CHECK-LABEL: @or_test2(
+; CHECK-NEXT:    [[A:%.*]] = add i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[B:%.*]] = and i32 [[Y]], [[X]]
+; CHECK-NEXT:    [[R:%.*]] = sub i32 [[A]], [[B]]
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %a = add i32 %x, %y
+  %b = and i32 %y, %x
+  %r = sub i32 %a, %b
+  ret i32 %r
+}
+
+define i32 @or_test3(i32 %x, i32 %y) {
+; CHECK-LABEL: @or_test3(
+; CHECK-NEXT:    [[A:%.*]] = add i32 [[Y:%.*]], [[X:%.*]]
+; CHECK-NEXT:    [[B:%.*]] = and i32 [[X]], [[Y]]
+; CHECK-NEXT:    [[R:%.*]] = sub i32 [[A]], [[B]]
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %a = add i32 %y, %x
+  %b = and i32 %x, %y
+  %r = sub i32 %a, %b
+  ret i32 %r
+}
+
+define <2 x i8> @or_vec(<2 x i8> %X, <2 x i8> %Y) {
+; CHECK-LABEL: @or_vec(
+; CHECK-NEXT:    [[A:%.*]] = add <2 x i8> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[B:%.*]] = and <2 x i8> [[X]], [[Y]]
+; CHECK-NEXT:    [[R:%.*]] = sub <2 x i8> [[A]], [[B]]
+; CHECK-NEXT:    ret <2 x i8> [[R]]
+;
+  %a = add <2 x i8> %X, %Y
+  %b = and <2 x i8> %X, %Y
+  %r = sub <2 x i8> %a, %b
+  ret <2 x i8> %r
+}


        


More information about the llvm-branch-commits mailing list