[PATCH] D58181: [x86] split more v8f32/v8i32 shuffles in lowering

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 07:30:20 PST 2019


spatel created this revision.
spatel added reviewers: craig.topper, RKSimon, andreadb.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

Similar to D57867 <https://reviews.llvm.org/D57867> - this is a 1-line patch with lots of test diffs.
In most cases with half-vector-width narrowing potential, using an extract + 128-bit vshufps is a win because it replaces a 256-bit shuffle with a 128-bit shufle.

There's 1 potentially controversial diff pattern for a target with "fast-variable-shuffle". 
We are changing:

  vmovaps {{.*#+}} ymm1 = [load 256-bit constant permute mask]
  vpermps %ymm0, %ymm1, %ymm0          

to:

  vextractf128 $1, %ymm0, %xmm1
  vshufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]

That could be a regression if the permute mask load could be moved out of a loop and the 256-bit op is executed at the same speed/power as a 128-bit op. But I think the extract+shufps combo is the right default choice at this level because it removes a ymm instruction. We should form 256-bit vpermps from the extract+shufps as a later optimization within a loop if that would be profitable.


https://reviews.llvm.org/D58181

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/avx2-conversions.ll
  llvm/test/CodeGen/X86/avx2-vector-shifts.ll
  llvm/test/CodeGen/X86/avx512-shuffles/partial_permute.ll
  llvm/test/CodeGen/X86/combine-shl.ll
  llvm/test/CodeGen/X86/combine-sra.ll
  llvm/test/CodeGen/X86/combine-srl.ll
  llvm/test/CodeGen/X86/oddshuffles.ll
  llvm/test/CodeGen/X86/reduce-trunc-shl.ll
  llvm/test/CodeGen/X86/shuffle-vs-trunc-256-widen.ll
  llvm/test/CodeGen/X86/shuffle-vs-trunc-256.ll
  llvm/test/CodeGen/X86/vector-trunc-math-widen.ll
  llvm/test/CodeGen/X86/vector-trunc-math.ll
  llvm/test/CodeGen/X86/vector-trunc-packus-widen.ll
  llvm/test/CodeGen/X86/vector-trunc-packus.ll
  llvm/test/CodeGen/X86/vector-trunc-ssat-widen.ll
  llvm/test/CodeGen/X86/vector-trunc-ssat.ll
  llvm/test/CodeGen/X86/vector-trunc-usat-widen.ll
  llvm/test/CodeGen/X86/vector-trunc-usat.ll
  llvm/test/CodeGen/X86/vector-trunc-widen.ll
  llvm/test/CodeGen/X86/vector-trunc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58181.186648.patch
Type: text/x-patch
Size: 277708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190213/f90d64bf/attachment-0001.bin>


More information about the llvm-commits mailing list