[PATCH] D13740: Catch combine opportunities for redundant imuls
Zia Ansari via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 19 17:57:19 PDT 2015
zansari updated this revision to Diff 37820.
zansari added a comment.
New patch includes changes to use "isConstOrConstSplat" to consolidate the 2 constant checks, as suggested.
Also, as suggested, I added a test to make sure we catch the vector multiply by constant case. I verified that before this patch we generate 4 pmulduqs, compared to just 2 now (i.e. we eliminate an extra vector multiply after the patch).
Thanks,
Zia.
Before:
movdqa .LCPI1_0, %xmm1 # xmm1 = [11,11,11,11]
paddd %xmm0, %xmm1
movdqa .LCPI1_1, %xmm2 # xmm2 = [22,22,22,22]
pshufd $245, %xmm1, %xmm3 # xmm3 = xmm1[1,1,3,3]
movdqa %xmm1, x
pmuludq %xmm2, %xmm1
pshufd $232, %xmm1, %xmm1 # xmm1 = xmm1[0,2,2,3]
pmuludq %xmm2, %xmm3
pshufd $232, %xmm3, %xmm3 # xmm3 = xmm3[0,2,2,3]
punpckldq %xmm3, %xmm1 # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movdqa %xmm1, v2
pshufd $245, %xmm0, %xmm1 # xmm1 = xmm0[1,1,3,3]
pmuludq %xmm2, %xmm0
pshufd $232, %xmm0, %xmm0 # xmm0 = xmm0[0,2,2,3]
pmuludq %xmm2, %xmm1
pshufd $232, %xmm1, %xmm1 # xmm1 = xmm1[0,2,2,3]
punpckldq %xmm1, %xmm0 # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
paddd .LCPI1_2, %xmm0
movdqa %xmm0, v3
retl
After:
movdqa .LCPI1_0, %xmm1 # xmm1 = [11,11,11,11]
paddd %xmm0, %xmm1
movdqa .LCPI1_1, %xmm2 # xmm2 = [22,22,22,22]
pshufd $245, %xmm0, %xmm3 # xmm3 = xmm0[1,1,3,3]
pmuludq %xmm2, %xmm0
pshufd $232, %xmm0, %xmm0 # xmm0 = xmm0[0,2,2,3]
pmuludq %xmm2, %xmm3
pshufd $232, %xmm3, %xmm2 # xmm2 = xmm3[0,2,2,3]
punpckldq %xmm2, %xmm0 # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movdqa .LCPI1_2, %xmm2 # xmm2 = [242,242,242,242]
paddd %xmm0, %xmm2
movdqa %xmm2, v2
paddd .LCPI1_3, %xmm0
movdqa %xmm0, v3
movdqa %xmm1, x
retl
http://reviews.llvm.org/D13740
Files:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/combine-multiplies.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13740.37820.patch
Type: text/x-patch
Size: 10025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151020/50c00b8e/attachment.bin>
More information about the llvm-commits
mailing list