[llvm] f77dcdf - [NFC][CVP] Add more tests for urem expansion
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 30 18:01:41 PST 2022
Author: Roman Lebedev
Date: 2022-12-31T04:43:29+03:00
New Revision: f77dcdf2db2b4a901538bb0ee1c1845a0ba1f18e
URL: https://github.com/llvm/llvm-project/commit/f77dcdf2db2b4a901538bb0ee1c1845a0ba1f18e
DIFF: https://github.com/llvm/llvm-project/commit/f77dcdf2db2b4a901538bb0ee1c1845a0ba1f18e.diff
LOG: [NFC][CVP] Add more tests for urem expansion
As mentioned in post-commit feedback.
Added:
Modified:
llvm/test/Transforms/CorrelatedValuePropagation/urem-expansion.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/urem-expansion.ll b/llvm/test/Transforms/CorrelatedValuePropagation/urem-expansion.ll
index 26e8bc3534e45..36d9771392c0c 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/urem-expansion.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/urem-expansion.ll
@@ -42,6 +42,18 @@ define i8 @constant.divisor.x.range.v4(ptr %x.ptr) {
%rem = urem i8 %x, 3
ret i8 %rem
}
+define i8 @constant.divisor.x.mask.v4(i8 %x) {
+; CHECK-LABEL: @constant.divisor.x.mask.v4(
+; CHECK-NEXT: [[X_MASKED:%.*]] = and i8 [[X:%.*]], 3
+; CHECK-NEXT: [[REM_UREM:%.*]] = sub nuw i8 [[X_MASKED]], 3
+; CHECK-NEXT: [[REM_CMP:%.*]] = icmp ult i8 [[X_MASKED]], 3
+; CHECK-NEXT: [[REM:%.*]] = select i1 [[REM_CMP]], i8 [[X_MASKED]], i8 [[REM_UREM]]
+; CHECK-NEXT: ret i8 [[REM]]
+;
+ %x.masked = and i8 %x, 3
+ %rem = urem i8 %x.masked, 3
+ ret i8 %rem
+}
define i8 @constant.divisor.v5(i8 %x) {
; CHECK-LABEL: @constant.divisor.v5(
; CHECK-NEXT: [[CMP_X_UPPER:%.*]] = icmp ult i8 [[X:%.*]], 5
More information about the llvm-commits
mailing list