[PATCH] Generate better code for shuffles
Michael Kuperstein
michael.m.kuperstein at intel.com
Tue Dec 16 02:58:13 PST 2014
Hi nadav, andreadb, spatel, chandlerc, delena,
This fixes PR15872, the code improves from:
```
vpextrd $1, %xmm0, %eax
vmovd %xmm0, %ecx
vmovd %ecx, %xmm1
vpinsrd $1, %eax, %xmm1, %xmm1
vextractf128 $1, %ymm0, %xmm2
vmovd %xmm2, %eax
vpinsrd $2, %eax, %xmm1, %xmm1
vpextrd $1, %xmm2, %eax
vpinsrd $3, %eax, %xmm1, %xmm1
vpextrd $3, %xmm0, %eax
vpextrd $2, %xmm0, %ecx
vmovd %ecx, %xmm0
vpinsrd $1, %eax, %xmm0, %xmm0
vpextrd $2, %xmm2, %eax
vpinsrd $2, %eax, %xmm0, %xmm0
vpextrd $3, %xmm2, %eax
vpinsrd $3, %eax, %xmm0, %xmm0
vmovdqa %xmm1, (%rdi)
vzeroupper
retq
```
to
```
vextractf128 $1, %ymm0, %xmm1
vpunpcklqdq %xmm1, %xmm0, %xmm2 # xmm2 = xmm0[0],xmm1[0]
vpunpckhqdq %xmm1, %xmm0, %xmm0 # xmm0 = xmm0[1],xmm1[1]
vmovdqa %xmm2, (%rdi)
vzeroupper
retq
```
Sanjay has a fix for PR21711 which apparently has the same underlying issue here: http://reviews.llvm.org/D6622
This version is more general, but it may be too general, I'm fine with anything in this vein that fixes both PRs.
http://reviews.llvm.org/D6678
Files:
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
test/CodeGen/X86/vector-shuffle-combining.ll
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6678.17327.patch
Type: text/x-patch
Size: 6143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141216/87c59b4c/attachment.bin>
More information about the llvm-commits
mailing list