[llvm] 5e89662 - [InstCombine] add tests for ashr exact; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 7 10:21:17 PDT 2022
Author: Sanjay Patel
Date: 2022-10-07T13:16:55-04:00
New Revision: 5e896628b74dcbe285da55278df7399085abdfd8
URL: https://github.com/llvm/llvm-project/commit/5e896628b74dcbe285da55278df7399085abdfd8
DIFF: https://github.com/llvm/llvm-project/commit/5e896628b74dcbe285da55278df7399085abdfd8.diff
LOG: [InstCombine] add tests for ashr exact; NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/ashr-lshr.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/ashr-lshr.ll b/llvm/test/Transforms/InstCombine/ashr-lshr.ll
index 870847921f02..1ee5c9a3945e 100644
--- a/llvm/test/Transforms/InstCombine/ashr-lshr.ll
+++ b/llvm/test/Transforms/InstCombine/ashr-lshr.ll
@@ -582,3 +582,25 @@ define <3 x i43> @ashr_sub_nsw_splat_undef(<3 x i43> %x, <3 x i43> %y) {
%shr = ashr <3 x i43> %sub, <i43 42, i43 undef, i43 42>
ret <3 x i43> %shr
}
+
+define i8 @ashr_known_pos_exact(i8 %x, i8 %y) {
+; CHECK-LABEL: @ashr_known_pos_exact(
+; CHECK-NEXT: [[P:%.*]] = and i8 [[X:%.*]], 127
+; CHECK-NEXT: [[R:%.*]] = lshr i8 [[P]], [[Y:%.*]]
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %p = and i8 %x, 127
+ %r = ashr exact i8 %p, %y
+ ret i8 %r
+}
+
+define <2 x i8> @ashr_known_pos_exact_vec(<2 x i8> %x, <2 x i8> %y) {
+; CHECK-LABEL: @ashr_known_pos_exact_vec(
+; CHECK-NEXT: [[P:%.*]] = mul nsw <2 x i8> [[X:%.*]], [[X]]
+; CHECK-NEXT: [[R:%.*]] = lshr <2 x i8> [[P]], [[Y:%.*]]
+; CHECK-NEXT: ret <2 x i8> [[R]]
+;
+ %p = mul nsw <2 x i8> %x, %x
+ %r = ashr exact <2 x i8> %p, %y
+ ret <2 x i8> %r
+}
More information about the llvm-commits
mailing list