[llvm] 042f22b - [InstCombine] Add exact shift tests missed in D88475
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 07:25:38 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-29T15:24:59+01:00
New Revision: 042f22bda5d3e2851205781f0b921cc810bb6dcb
URL: https://github.com/llvm/llvm-project/commit/042f22bda5d3e2851205781f0b921cc810bb6dcb
DIFF: https://github.com/llvm/llvm-project/commit/042f22bda5d3e2851205781f0b921cc810bb6dcb.diff
LOG: [InstCombine] Add exact shift tests missed in D88475
I missed the post-LGTM comment from @lebedev.ri
Added:
Modified:
llvm/test/Transforms/InstCombine/cast.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/cast.ll b/llvm/test/Transforms/InstCombine/cast.ll
index 1d3d006ad238..db6b550f5faa 100644
--- a/llvm/test/Transforms/InstCombine/cast.ll
+++ b/llvm/test/Transforms/InstCombine/cast.ll
@@ -1546,6 +1546,17 @@ define i8 @trunc_lshr_sext(i8 %A) {
ret i8 %D
}
+define i8 @trunc_lshr_sext_exact(i8 %A) {
+; ALL-LABEL: @trunc_lshr_sext_exact(
+; ALL-NEXT: [[D:%.*]] = ashr i8 [[A:%.*]], 6
+; ALL-NEXT: ret i8 [[D]]
+;
+ %B = sext i8 %A to i32
+ %C = lshr exact i32 %B, 6
+ %D = trunc i32 %C to i8
+ ret i8 %D
+}
+
define <2 x i8> @trunc_lshr_sext_uniform(<2 x i8> %A) {
; ALL-LABEL: @trunc_lshr_sext_uniform(
; ALL-NEXT: [[D:%.*]] = ashr <2 x i8> [[A:%.*]], <i8 6, i8 6>
@@ -1705,6 +1716,18 @@ define i8 @trunc_lshr_sext_wide_input(i16 %A) {
ret i8 %D
}
+define i8 @trunc_lshr_sext_wide_input_exact(i16 %A) {
+; ALL-LABEL: @trunc_lshr_sext_wide_input_exact(
+; ALL-NEXT: [[TMP1:%.*]] = ashr i16 [[A:%.*]], 9
+; ALL-NEXT: [[D:%.*]] = trunc i16 [[TMP1]] to i8
+; ALL-NEXT: ret i8 [[D]]
+;
+ %B = sext i16 %A to i32
+ %C = lshr exact i32 %B, 9
+ %D = trunc i32 %C to i8
+ ret i8 %D
+}
+
define <2 x i8> @trunc_lshr_sext_wide_input_uses1(<2 x i16> %A) {
; ALL-LABEL: @trunc_lshr_sext_wide_input_uses1(
; ALL-NEXT: [[B:%.*]] = sext <2 x i16> [[A:%.*]] to <2 x i32>
More information about the llvm-commits
mailing list