[llvm] b3a2882 - Add nonuniform vector trunc(or(shl(zext(x),c1),srl(zext(x),c2))) tests
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 3 03:48:22 PDT 2020
Author: Simon Pilgrim
Date: 2020-07-03T11:42:15+01:00
New Revision: b3a2882dbc4a6aeff233b9fb4c0fc05008866865
URL: https://github.com/llvm/llvm-project/commit/b3a2882dbc4a6aeff233b9fb4c0fc05008866865
DIFF: https://github.com/llvm/llvm-project/commit/b3a2882dbc4a6aeff233b9fb4c0fc05008866865.diff
LOG: Add nonuniform vector trunc(or(shl(zext(x),c1),srl(zext(x),c2))) 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 a68d81acdde9..10d59bfff57f 100644
--- a/llvm/test/Transforms/InstCombine/cast.ll
+++ b/llvm/test/Transforms/InstCombine/cast.ll
@@ -500,6 +500,40 @@ define <2 x i16> @test40vec(<2 x i16> %a) {
ret <2 x i16> %r
}
+define <2 x i16> @test40vec_nonuniform(<2 x i16> %a) {
+; ALL-LABEL: @test40vec_nonuniform(
+; ALL-NEXT: [[T:%.*]] = zext <2 x i16> [[A:%.*]] to <2 x i32>
+; ALL-NEXT: [[T21:%.*]] = lshr <2 x i32> [[T]], <i32 9, i32 10>
+; ALL-NEXT: [[T5:%.*]] = shl <2 x i32> [[T]], <i32 8, i32 9>
+; ALL-NEXT: [[T32:%.*]] = or <2 x i32> [[T21]], [[T5]]
+; ALL-NEXT: [[R:%.*]] = trunc <2 x i32> [[T32]] to <2 x i16>
+; ALL-NEXT: ret <2 x i16> [[R]]
+;
+ %t = zext <2 x i16> %a to <2 x i32>
+ %t21 = lshr <2 x i32> %t, <i32 9, i32 10>
+ %t5 = shl <2 x i32> %t, <i32 8, i32 9>
+ %t32 = or <2 x i32> %t21, %t5
+ %r = trunc <2 x i32> %t32 to <2 x i16>
+ ret <2 x i16> %r
+}
+
+define <2 x i16> @test40vec_undef(<2 x i16> %a) {
+; ALL-LABEL: @test40vec_undef(
+; ALL-NEXT: [[T:%.*]] = zext <2 x i16> [[A:%.*]] to <2 x i32>
+; ALL-NEXT: [[T21:%.*]] = lshr <2 x i32> [[T]], <i32 9, i32 undef>
+; ALL-NEXT: [[T5:%.*]] = shl <2 x i32> [[T]], <i32 8, i32 undef>
+; ALL-NEXT: [[T32:%.*]] = or <2 x i32> [[T21]], [[T5]]
+; ALL-NEXT: [[R:%.*]] = trunc <2 x i32> [[T32]] to <2 x i16>
+; ALL-NEXT: ret <2 x i16> [[R]]
+;
+ %t = zext <2 x i16> %a to <2 x i32>
+ %t21 = lshr <2 x i32> %t, <i32 9, i32 undef>
+ %t5 = shl <2 x i32> %t, <i32 8, i32 undef>
+ %t32 = or <2 x i32> %t21, %t5
+ %r = trunc <2 x i32> %t32 to <2 x i16>
+ ret <2 x i16> %r
+}
+
; PR1263
define i32* @test41(i32* %t1) {
; ALL-LABEL: @test41(
More information about the llvm-commits
mailing list