summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify/shufflevector.ll
diff options
context:
space:
mode:
authorZvi Rackover <zvi.rackover@intel.com>2017-05-07 18:16:37 +0000
committerZvi Rackover <zvi.rackover@intel.com>2017-05-07 18:16:37 +0000
commit973ff7c74c6eb1073376834ce27588caeebfb034 (patch)
tree0e2372f7ab375fb5a9fe5e6254be02b624147cf5 /llvm/test/Transforms/InstSimplify/shufflevector.ll
parentff41150ddb5a722c6e614e31f89e8fa52e2f7595 (diff)
downloadbcm5719-llvm-973ff7c74c6eb1073376834ce27588caeebfb034.tar.gz
bcm5719-llvm-973ff7c74c6eb1073376834ce27588caeebfb034.zip
InstructionSimplify: Relanding r301766
Summary: Re-applying r301766 with a fix to a typo and a regression test. The log message for r301766 was: ================================================================================== InstructionSimplify: Canonicalize shuffle operands. NFC-ish. Summary: Apply canonicalization rules: 1. Input vectors with no elements selected from can be replaced with undef. 2. If only one input vector is constant it shall be the second one. This allows constant-folding to cover more ad-hoc simplifications that were in place and avoid duplication for RHS and LHS checks. There are more rules we may want to add in the future when we see a justification. e.g. mask elements that select undef elements can be replaced with undef. ================================================================================== Reviewers: spatel, RKSimon Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32863 llvm-svn: 302373
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/shufflevector.ll')
-rw-r--r--llvm/test/Transforms/InstSimplify/shufflevector.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/shufflevector.ll b/llvm/test/Transforms/InstSimplify/shufflevector.ll
index 6af0db8e5a4..cc49ae3554c 100644
--- a/llvm/test/Transforms/InstSimplify/shufflevector.ll
+++ b/llvm/test/Transforms/InstSimplify/shufflevector.ll
@@ -233,3 +233,17 @@ define <8 x i64> @PR30630(<8 x i64> %x) {
ret <8 x i64> %s7
}
+; This case covers internal canonicalization of shuffles with one constant input vector.
+
+;FIXME: Another issue exposed here, this whole function could be simplified to:
+; ret <2 x float> zeroinitializer
+define <2 x float> @PR32872(<2 x float> %x) {
+; CHECK-LABEL: @PR32872(
+; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x float> [[X:%.*]], <2 x float> zeroinitializer, <4 x i32> <i32 2, i32 2, i32 0, i32 1>
+; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x float> zeroinitializer, <4 x float> [[TMP1]], <2 x i32> <i32 4, i32 5>
+; CHECK-NEXT: ret <2 x float> [[TMP4]]
+;
+ %tmp1 = shufflevector <2 x float> %x, <2 x float> zeroinitializer, <4 x i32> <i32 2, i32 2, i32 0, i32 1>
+ %tmp4 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp1, <2 x i32> <i32 4, i32 5>
+ ret <2 x float> %tmp4
+}
OpenPOWER on IntegriCloud