[llvm] 324df26 - [InstCombine] Add trunc(lshr(sext(x), c)) non-uniform vector tests
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 03:04:39 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-29T10:56:15+01:00
New Revision: 324df2661b3ee38996fab589a2605da458fa249e
URL: https://github.com/llvm/llvm-project/commit/324df2661b3ee38996fab589a2605da458fa249e
DIFF: https://github.com/llvm/llvm-project/commit/324df2661b3ee38996fab589a2605da458fa249e.diff
LOG: [InstCombine] Add trunc(lshr(sext(x),c)) non-uniform vector tests
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 dcd3013621fd..ad6d22aa06e4 100644
--- a/llvm/test/Transforms/InstCombine/cast.ll
+++ b/llvm/test/Transforms/InstCombine/cast.ll
@@ -1546,6 +1546,56 @@ define i8 @trunc_lshr_sext(i8 %A) {
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>
+; ALL-NEXT: ret <2 x i8> [[D]]
+;
+ %B = sext <2 x i8> %A to <2 x i32>
+ %C = lshr <2 x i32> %B, <i32 6, i32 6>
+ %D = trunc <2 x i32> %C to <2 x i8>
+ ret <2 x i8> %D
+}
+
+define <2 x i8> @trunc_lshr_sext_uniform_undef(<2 x i8> %A) {
+; ALL-LABEL: @trunc_lshr_sext_uniform_undef(
+; ALL-NEXT: [[B:%.*]] = sext <2 x i8> [[A:%.*]] to <2 x i32>
+; ALL-NEXT: [[C:%.*]] = lshr <2 x i32> [[B]], <i32 6, i32 undef>
+; ALL-NEXT: [[D:%.*]] = trunc <2 x i32> [[C]] to <2 x i8>
+; ALL-NEXT: ret <2 x i8> [[D]]
+;
+ %B = sext <2 x i8> %A to <2 x i32>
+ %C = lshr <2 x i32> %B, <i32 6, i32 undef>
+ %D = trunc <2 x i32> %C to <2 x i8>
+ ret <2 x i8> %D
+}
+
+define <2 x i8> @trunc_lshr_sext_nonuniform(<2 x i8> %A) {
+; ALL-LABEL: @trunc_lshr_sext_nonuniform(
+; ALL-NEXT: [[B:%.*]] = sext <2 x i8> [[A:%.*]] to <2 x i32>
+; ALL-NEXT: [[C:%.*]] = lshr <2 x i32> [[B]], <i32 6, i32 2>
+; ALL-NEXT: [[D:%.*]] = trunc <2 x i32> [[C]] to <2 x i8>
+; ALL-NEXT: ret <2 x i8> [[D]]
+;
+ %B = sext <2 x i8> %A to <2 x i32>
+ %C = lshr <2 x i32> %B, <i32 6, i32 2>
+ %D = trunc <2 x i32> %C to <2 x i8>
+ ret <2 x i8> %D
+}
+
+define <3 x i8> @trunc_lshr_sext_nonuniform_undef(<3 x i8> %A) {
+; ALL-LABEL: @trunc_lshr_sext_nonuniform_undef(
+; ALL-NEXT: [[B:%.*]] = sext <3 x i8> [[A:%.*]] to <3 x i32>
+; ALL-NEXT: [[C:%.*]] = lshr <3 x i32> [[B]], <i32 6, i32 2, i32 undef>
+; ALL-NEXT: [[D:%.*]] = trunc <3 x i32> [[C]] to <3 x i8>
+; ALL-NEXT: ret <3 x i8> [[D]]
+;
+ %B = sext <3 x i8> %A to <3 x i32>
+ %C = lshr <3 x i32> %B, <i32 6, i32 2, i32 undef>
+ %D = trunc <3 x i32> %C to <3 x i8>
+ ret <3 x i8> %D
+}
+
define <2 x i8> @trunc_lshr_sext_uses1(<2 x i8> %A) {
; ALL-LABEL: @trunc_lshr_sext_uses1(
; ALL-NEXT: [[B:%.*]] = sext <2 x i8> [[A:%.*]] to <2 x i32>
More information about the llvm-commits
mailing list