[PATCH] X86: sink splat-shuffle into block doing a shift.

Tim Northover t.p.northover at gmail.com
Mon Feb 17 07:26:13 PST 2014


Hi,

We've noticed some bad codegen for vector shifts on x86. One of the problems is that before AVX2 there were only "psll[wdq]" instructions, which treated the shift amount as a scalar (i.e. the same shift amount for all lanes). This means that if we can put a shufflevector implementing a splat into the same basic block as a shift that uses it, much simpler CodeGen is possible.

Since this looked like the old problem with block-by-block selection, I *think* the best place to do this is probably CodeGenPrep (hence the patch). But obviously not all targets are going to want that behaviour (ARM, for example, has always had a generic shift and the transformation would introduce an extra "vdup" into the basic block).

Does it look reasonable?

Cheers.

Tim.


http://llvm-reviews.chandlerc.com/D2816

Files:
  include/llvm/Target/TargetLowering.h
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  lib/Transforms/Scalar/CodeGenPrepare.cpp
  test/Transforms/CodeGenPrepare/x86-shuffle-sink.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2816.1.patch
Type: text/x-patch
Size: 8995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140217/e53b7fe2/attachment.bin>


More information about the llvm-commits mailing list