aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/X86
diff options
context:
space:
mode:
authorMichael Liao <michael.liao@intel.com>2012-10-17 20:48:33 +0000
committerMichael Liao <michael.liao@intel.com>2012-10-17 20:48:33 +0000
commit13429e224cb165dae658ae4ea3ef67d69c1860fa (patch)
tree164e93d1a25c9e48fef4c1aac0360e18bb0fe9f7 /test/CodeGen/X86
parent4b1aa961fdbb75035a963f8c6a01c8c5f1dc3f16 (diff)
Teach DAG combine to fold (extract_subvec (concat v1, ..) i) to v_i
- If the extracted vector has the same type of all vectored being concatenated together, it should be simplified directly into v_i, where i is the index of the element being extracted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86')
-rw-r--r--test/CodeGen/X86/extract-concat.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/CodeGen/X86/extract-concat.ll b/test/CodeGen/X86/extract-concat.ll
new file mode 100644
index 0000000000..5c8d20a651
--- /dev/null
+++ b/test/CodeGen/X86/extract-concat.ll
@@ -0,0 +1,17 @@
+; RUN: llc < %s -mcpu=corei7 -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
+
+define void @foo(<4 x float> %in, <4 x i8>* %out) {
+ %t0 = fptoui <4 x float> %in to <4 x i32>
+ %t1 = trunc <4 x i32> %t0 to <4 x i16>
+ %t2 = shufflevector <4 x i16> %t1, <4 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %t3 = trunc <8 x i16> %t2 to <8 x i8>
+ %t4 = shufflevector <8 x i8> %t3, <8 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ %t5 = insertelement <4 x i8> %t4, i8 -1, i32 3
+ store <4 x i8> %t5, <4 x i8>* %out
+ ret void
+; CHECK: foo
+; CHECK: cvttps2dq
+; CHECK-NOT: pextrd
+; CHECK: pshufb
+; CHECK: ret
+}