[llvm] 9a96f42 - [InstCombine] add tests for mul with shl; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 31 06:07:01 PDT 2022
Author: Sanjay Patel
Date: 2022-10-31T09:06:55-04:00
New Revision: 9a96f42a75e8f091ca6ed89cdf2571d3e74ef491
URL: https://github.com/llvm/llvm-project/commit/9a96f42a75e8f091ca6ed89cdf2571d3e74ef491
DIFF: https://github.com/llvm/llvm-project/commit/9a96f42a75e8f091ca6ed89cdf2571d3e74ef491.diff
LOG: [InstCombine] add tests for mul with shl; NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/mul.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/mul.ll b/llvm/test/Transforms/InstCombine/mul.ll
index 8a3e793a7270b..29508e5e5d2ce 100644
--- a/llvm/test/Transforms/InstCombine/mul.ll
+++ b/llvm/test/Transforms/InstCombine/mul.ll
@@ -240,7 +240,7 @@ define i8 @shl1_decrement(i8 %x, i8 %y) {
ret i8 %m
}
-define i8 @shl1_decrement_commute(i8 %x, i8 %p) {
+define i8 @shl1_decrement_commute(i8 %x, i8 noundef %p) {
; CHECK-LABEL: @shl1_decrement_commute(
; CHECK-NEXT: [[Y:%.*]] = ashr i8 [[P:%.*]], 1
; CHECK-NEXT: [[NOTMASK:%.*]] = shl nsw i8 -1, [[X:%.*]]
@@ -255,6 +255,32 @@ define i8 @shl1_decrement_commute(i8 %x, i8 %p) {
ret i8 %m
}
+define i8 @shl1_nuw_decrement(i8 %x, i8 %y) {
+; CHECK-LABEL: @shl1_nuw_decrement(
+; CHECK-NEXT: [[POW2X:%.*]] = shl i8 -1, [[X:%.*]]
+; CHECK-NEXT: [[X1:%.*]] = xor i8 [[POW2X]], -1
+; CHECK-NEXT: [[M:%.*]] = mul nuw i8 [[X1]], [[Y:%.*]]
+; CHECK-NEXT: ret i8 [[M]]
+;
+ %pow2x = shl i8 -1, %x
+ %x1 = xor i8 %pow2x, -1
+ %m = mul nuw i8 %x1, %y
+ ret i8 %m
+}
+
+define i8 @shl1_nsw_decrement(i8 %x, i8 %y) {
+; CHECK-LABEL: @shl1_nsw_decrement(
+; CHECK-NEXT: [[POW2X:%.*]] = shl nsw i8 -1, [[X:%.*]]
+; CHECK-NEXT: [[X1:%.*]] = xor i8 [[POW2X]], -1
+; CHECK-NEXT: [[M:%.*]] = mul nsw i8 [[X1]], [[Y:%.*]]
+; CHECK-NEXT: ret i8 [[M]]
+;
+ %pow2x = shl nsw i8 -1, %x
+ %x1 = xor i8 %pow2x, -1
+ %m = mul nsw i8 %x1, %y
+ ret i8 %m
+}
+
define i32 @shl1_decrement_use(i32 %x, i32 %y) {
; CHECK-LABEL: @shl1_decrement_use(
; CHECK-NEXT: [[NOTMASK:%.*]] = shl nsw i32 -1, [[X:%.*]]
More information about the llvm-commits
mailing list