aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/README-SSE.txt
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-23 04:29:53 +0000
committerChris Lattner <sabre@nondot.org>2008-05-23 04:29:53 +0000
commit6805e194579c4f6a6d729d9101efa4f242fbf28b (patch)
treed2b0e2acbd80b074339c3b076b8ed2ec20f09e6b /lib/Target/X86/README-SSE.txt
parent89e87ff1a26f0151ab5989f2c12af7e10d24d776 (diff)
downloadexternal_llvm-6805e194579c4f6a6d729d9101efa4f242fbf28b.zip
external_llvm-6805e194579c4f6a6d729d9101efa4f242fbf28b.tar.gz
external_llvm-6805e194579c4f6a6d729d9101efa4f242fbf28b.tar.bz2
we compile multiply-by-constant into horrible code. Doesn't sse4 have some
instruction for doing this? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README-SSE.txt')
-rw-r--r--lib/Target/X86/README-SSE.txt38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/Target/X86/README-SSE.txt b/lib/Target/X86/README-SSE.txt
index 6164972..f200cbf 100644
--- a/lib/Target/X86/README-SSE.txt
+++ b/lib/Target/X86/README-SSE.txt
@@ -807,3 +807,41 @@ foo1:
//===---------------------------------------------------------------------===//
+We compile vector multiply-by-constant into poor code:
+
+define <4 x i32> @f(<4 x i32> %i) nounwind {
+ %A = mul <4 x i32> %i, < i32 10, i32 10, i32 10, i32 10 >
+ ret <4 x i32> %A
+}
+
+Compiles into:
+
+LCPI1_0: ## <4 x i32>
+ .long 10
+ .long 10
+ .long 10
+ .long 10
+ .text
+ .align 4,0x90
+ .globl _f
+_f:
+ pshufd $3, %xmm0, %xmm1
+ movd %xmm1, %eax
+ imull LCPI1_0+12, %eax
+ movd %eax, %xmm1
+ pshufd $1, %xmm0, %xmm2
+ movd %xmm2, %eax
+ imull LCPI1_0+4, %eax
+ movd %eax, %xmm2
+ punpckldq %xmm1, %xmm2
+ movd %xmm0, %eax
+ imull LCPI1_0, %eax
+ movd %eax, %xmm1
+ movhlps %xmm0, %xmm0
+ movd %xmm0, %eax
+ imull LCPI1_0+8, %eax
+ movd %eax, %xmm0
+ punpckldq %xmm0, %xmm1
+ movaps %xmm1, %xmm0
+ punpckldq %xmm2, %xmm0
+ ret