summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorMichael Liao <michael.liao@intel.com>2012-10-19 17:15:18 +0000
committerMichael Liao <michael.liao@intel.com>2012-10-19 17:15:18 +0000
commitfacace808cc5f83067a05c4c319f98fd75336f47 (patch)
tree5a93a1a3afb28ec1bb2ac672b867740c96509abb /test/CodeGen
parent239fd44f7a68aae4b2e8b6f1738ef9e8fd4ddc01 (diff)
downloadllvm-facace808cc5f83067a05c4c319f98fd75336f47.tar.gz
llvm-facace808cc5f83067a05c4c319f98fd75336f47.tar.bz2
llvm-facace808cc5f83067a05c4c319f98fd75336f47.tar.xz
Lower BUILD_VECTOR to SHUFFLE + INSERT_VECTOR_ELT for X86
- If INSERT_VECTOR_ELT is supported (above SSE2, either by custom sequence of legal insn), transform BUILD_VECTOR into SHUFFLE + INSERT_VECTOR_ELT if most of elements could be built from SHUFFLE with few (so far 1) elements being inserted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166288 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/X86/buildvec-insertvec.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CodeGen/X86/buildvec-insertvec.ll b/test/CodeGen/X86/buildvec-insertvec.ll
new file mode 100644
index 0000000000..3fb69a48b3
--- /dev/null
+++ b/test/CodeGen/X86/buildvec-insertvec.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -mcpu=corei7 -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
+
+define void @foo(<3 x float> %in, <4 x i8>* nocapture %out) nounwind {
+ %t0 = fptoui <3 x float> %in to <3 x i8>
+ %t1 = shufflevector <3 x i8> %t0, <3 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 undef>
+ %t2 = insertelement <4 x i8> %t1, i8 -1, i32 3
+ store <4 x i8> %t2, <4 x i8>* %out, align 4
+ ret void
+; CHECK: foo
+; CHECK: cvttps2dq
+; CHECK-NOT: pextrd
+; CHECK: pinsrd
+; CHECK-NEXT: pshufb
+; CHECK: ret
+}