[llvm-commits] [llvm] r51472 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-05-22-FoldAddIVec.ll
Chris Lattner
clattner at apple.com
Thu May 22 21:26:54 PDT 2008
On May 22, 2008, at 9:25 PM, Chris Lattner wrote:
>
> On May 22, 2008, at 9:14 PM, Nick Lewycky wrote:
>
>> Author: nicholas
>> Date: Thu May 22 23:14:51 2008
>> New Revision: 51472
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=51472&view=rev
>> Log:
>> Implement X + X for vectors.
>
> Is the code generator turning this back into x+x? If not, this is a
> major pessimization. What does:
>
> define <4 x i32> @f(<4 x i32> %i) nounwind {
> %A = add <4 x i32> %i, %i
> ret <4 x i32> %A
> }
>
> compile into? Without your patch I get:
>
> _f:
> paddd %xmm0, %xmm0
> ret
Please revert. Your patch optimizes this into:
LCPI1_0: ## <4 x i32>
.long 2
.long 2
.long 2
.long 2
.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
More information about the llvm-commits
mailing list