[InstSimplify] add/move tests for or with not op (PR46083); NFC
diff --git a/llvm/test/Transforms/InstCombine/or-xor.ll b/llvm/test/Transforms/InstCombine/or-xor.ll
index 4663d19..6ee5999 100644
--- a/llvm/test/Transforms/InstCombine/or-xor.ll
+++ b/llvm/test/Transforms/InstCombine/or-xor.ll
@@ -59,26 +59,6 @@
   ret i32 %z
 }
 
-define i32 @test5(i32 %x, i32 %y) {
-; CHECK-LABEL: @test5(
-; CHECK-NEXT:    ret i32 -1
-;
-  %and = and i32 %x, %y
-  %not = xor i32 %and, -1
-  %z = or i32 %x, %not
-  ret i32 %z
-}
-
-define i32 @test6(i32 %x, i32 %y) {
-; CHECK-LABEL: @test6(
-; CHECK-NEXT:    ret i32 -1
-;
-  %and = and i32 %x, %y
-  %not = xor i32 %and, -1
-  %z = or i32 %y, %not
-  ret i32 %z
-}
-
 define i32 @test7(i32 %x, i32 %y) {
 ; CHECK-LABEL: @test7(
 ; CHECK-NEXT:    [[Z:%.*]] = or i32 [[X:%.*]], [[Y:%.*]]
diff --git a/llvm/test/Transforms/InstSimplify/or.ll b/llvm/test/Transforms/InstSimplify/or.ll
index 465b30c..619c8eb 100644
--- a/llvm/test/Transforms/InstSimplify/or.ll
+++ b/llvm/test/Transforms/InstSimplify/or.ll
@@ -243,3 +243,57 @@
   %R = or <2 x i399> %D, %B
   ret <2 x i399> %R
 }
+
+; A | ~(A & B) = -1
+
+define i1 @or_with_not_op_commute1(i1 %a, i1 %b) {
+; CHECK-LABEL: @or_with_not_op_commute1(
+; CHECK-NEXT:    [[AB:%.*]] = and i1 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT:    [[NOT:%.*]] = xor i1 [[AB]], true
+; CHECK-NEXT:    [[R:%.*]] = or i1 [[A]], [[NOT]]
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %ab = and i1 %a, %b
+  %not = xor i1 %ab, -1
+  %r = or i1 %a, %not
+  ret i1 %r
+}
+
+; A | ~(B & A) = -1
+
+define i8 @or_with_not_op_commute2(i8 %a, i8 %b) {
+; CHECK-LABEL: @or_with_not_op_commute2(
+; CHECK-NEXT:    [[AB:%.*]] = and i8 [[B:%.*]], [[A:%.*]]
+; CHECK-NEXT:    [[NOT:%.*]] = xor i8 [[AB]], -1
+; CHECK-NEXT:    [[R:%.*]] = or i8 [[A]], [[NOT]]
+; CHECK-NEXT:    ret i8 [[R]]
+;
+  %ab = and i8 %b, %a
+  %not = xor i8 %ab, -1
+  %r = or i8 %a, %not
+  ret i8 %r
+}
+
+; ~(A & B) | A = -1
+
+define <3 x i17> @or_with_not_op_commute3(<3 x i17> %a, <3 x i17> %b) {
+; CHECK-LABEL: @or_with_not_op_commute3(
+; CHECK-NEXT:    ret <3 x i17> <i17 -1, i17 -1, i17 -1>
+;
+  %ab = and <3 x i17> %a, %b
+  %not = xor <3 x i17> %ab, <i17 -1, i17 -1, i17 -1>
+  %r = or <3 x i17> %not, %a
+  ret <3 x i17> %r
+}
+
+; ~(B & A) | A = -1
+
+define <2 x i1> @or_with_not_op_commute4(<2 x i1> %a, <2 x i1> %b) {
+; CHECK-LABEL: @or_with_not_op_commute4(
+; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
+;
+  %ab = and <2 x i1> %b, %a
+  %not = xor <2 x i1> %ab, <i1 -1, i1 undef>
+  %r = or <2 x i1> %not, %a
+  ret <2 x i1> %r
+}