[InstCombine] add tests for or with mul operand; NFC
diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll
index 4067dc4..962ad47 100644
--- a/llvm/test/Transforms/InstCombine/or.ll
+++ b/llvm/test/Transforms/InstCombine/or.ll
@@ -1441,3 +1441,72 @@
%r = or <2 x i1> %isneg, %isnotneg
ret <2 x i1> %r
}
+
+define i32 @mul_no_common_bits(i32 %p1, i32 %p2) {
+; CHECK-LABEL: @mul_no_common_bits(
+; CHECK-NEXT: [[X:%.*]] = and i32 [[P1:%.*]], 7
+; CHECK-NEXT: [[Y:%.*]] = shl i32 [[P2:%.*]], 3
+; CHECK-NEXT: [[M:%.*]] = mul i32 [[X]], [[Y]]
+; CHECK-NEXT: [[R:%.*]] = or i32 [[M]], [[X]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %x = and i32 %p1, 7
+ %y = shl i32 %p2, 3
+ %m = mul i32 %x, %y
+ %r = or i32 %m, %x
+ ret i32 %r
+}
+
+define i32 @mul_no_common_bits_const_op(i32 %p) {
+; CHECK-LABEL: @mul_no_common_bits_const_op(
+; CHECK-NEXT: [[X:%.*]] = and i32 [[P:%.*]], 7
+; CHECK-NEXT: [[M:%.*]] = mul nuw nsw i32 [[X]], 24
+; CHECK-NEXT: [[R:%.*]] = or i32 [[M]], [[X]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %x = and i32 %p, 7
+ %m = mul i32 %x, 24
+ %r = or i32 %m, %x
+ ret i32 %r
+}
+
+define <2 x i12> @mul_no_common_bits_commute(<2 x i12> %p) {
+; CHECK-LABEL: @mul_no_common_bits_commute(
+; CHECK-NEXT: [[X:%.*]] = and <2 x i12> [[P:%.*]], <i12 1, i12 1>
+; CHECK-NEXT: [[M:%.*]] = mul nuw nsw <2 x i12> [[X]], <i12 14, i12 16>
+; CHECK-NEXT: [[R:%.*]] = or <2 x i12> [[X]], [[M]]
+; CHECK-NEXT: ret <2 x i12> [[R]]
+;
+ %x = and <2 x i12> %p, <i12 1, i12 1>
+ %m = mul <2 x i12> %x, <i12 14, i12 16>
+ %r = or <2 x i12> %x, %m
+ ret <2 x i12> %r
+}
+
+define i32 @mul_no_common_bits_uses(i32 %p) {
+; CHECK-LABEL: @mul_no_common_bits_uses(
+; CHECK-NEXT: [[X:%.*]] = and i32 [[P:%.*]], 7
+; CHECK-NEXT: [[M:%.*]] = mul nuw nsw i32 [[X]], 24
+; CHECK-NEXT: call void @use(i32 [[M]])
+; CHECK-NEXT: [[R:%.*]] = or i32 [[M]], [[X]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %x = and i32 %p, 7
+ %m = mul i32 %x, 24
+ call void @use(i32 %m)
+ %r = or i32 %m, %x
+ ret i32 %r
+}
+
+define i32 @mul_common_bits(i32 %p) {
+; CHECK-LABEL: @mul_common_bits(
+; CHECK-NEXT: [[X:%.*]] = and i32 [[P:%.*]], 7
+; CHECK-NEXT: [[M:%.*]] = mul nuw nsw i32 [[X]], 12
+; CHECK-NEXT: [[R:%.*]] = or i32 [[M]], [[X]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %x = and i32 %p, 7
+ %m = mul i32 %x, 12
+ %r = or i32 %m, %x
+ ret i32 %r
+}