[InstSimplify] add tests for 'or' with logic ops; NFC

The code for these transforms can be refactored,
but the existing tests are incomplete.
diff --git a/llvm/test/Transforms/InstSimplify/or.ll b/llvm/test/Transforms/InstSimplify/or.ll
index a5e047e..1d9d741 100644
--- a/llvm/test/Transforms/InstSimplify/or.ll
+++ b/llvm/test/Transforms/InstSimplify/or.ll
@@ -58,8 +58,9 @@
 }
 
 ; A | ~A == -1
-define i32 @test7(i32 %A) {
-; CHECK-LABEL: @test7(
+
+define i32 @or_not(i32 %A) {
+; CHECK-LABEL: @or_not(
 ; CHECK-NEXT:    ret i32 -1
 ;
   %NotA = xor i32 %A, -1
@@ -67,6 +68,15 @@
   ret i32 %B
 }
 
+define <2 x i4> @or_not_commute_vec_undef(<2 x i4> %A) {
+; CHECK-LABEL: @or_not_commute_vec_undef(
+; CHECK-NEXT:    ret <2 x i4> <i4 -1, i4 -1>
+;
+  %NotA = xor <2 x i4> %A, <i4 -1, i4 undef>
+  %B = or <2 x i4> %NotA, %A
+  ret <2 x i4> %B
+}
+
 define i8 @test8(i8 %A) {
 ; CHECK-LABEL: @test8(
 ; CHECK-NEXT:    ret i8 -1
@@ -244,6 +254,44 @@
   ret <2 x i399> %R
 }
 
+; (A & B) | A = A
+
+define i8 @or_and_common_op_commute0(i8 %a, i8 %b) {
+; CHECK-LABEL: @or_and_common_op_commute0(
+; CHECK-NEXT:    ret i8 [[A:%.*]]
+;
+  %and = and i8 %a, %b
+  %or = or i8 %and, %a
+  ret i8 %or
+}
+
+define <2 x i8> @or_and_common_op_commute1(<2 x i8> %a, <2 x i8> %b) {
+; CHECK-LABEL: @or_and_common_op_commute1(
+; CHECK-NEXT:    ret <2 x i8> [[A:%.*]]
+;
+  %and = and <2 x i8> %b, %a
+  %or = or <2 x i8> %and, %a
+  ret <2 x i8> %or
+}
+
+define i8 @or_and_common_op_commute2(i8 %a, i8 %b) {
+; CHECK-LABEL: @or_and_common_op_commute2(
+; CHECK-NEXT:    ret i8 [[A:%.*]]
+;
+  %and = and i8 %a, %b
+  %or = or i8 %a, %and
+  ret i8 %or
+}
+
+define <2 x i8> @or_and_common_op_commute3(<2 x i8> %a, <2 x i8> %b) {
+; CHECK-LABEL: @or_and_common_op_commute3(
+; CHECK-NEXT:    ret <2 x i8> [[A:%.*]]
+;
+  %and = and <2 x i8> %b, %a
+  %or = or <2 x i8> %a, %and
+  ret <2 x i8> %or
+}
+
 ; A | ~(A & B) = -1
 
 define i1 @or_with_not_op_commute1(i1 %a, i1 %b) {