[PATCH] D19675: [InstCombine][AVX2] Add support for simplifying AVX2 per-element shifts to native shifts

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 11:22:56 PDT 2016


RKSimon created this revision.
RKSimon added reviewers: qcolombet, ab, spatel.
RKSimon added a subscriber: llvm-commits.
RKSimon set the repository for this revision to rL LLVM.

Unlike native shifts, the AVX2 per-element shift instructions VPSRAV/VPSRLV/VPSLLV handle out of range shift values (logical shifts set the result to zero, arithmetic shifts splat the sign bit). 

If the shift amount is constant we can sometimes convert these instructions to native shifts:

1 - if all shift amounts are in range then the conversion is trivial.
2 - out of range arithmetic shifts can be clamped to the bitwidth (a legal shift amount) before conversion.
3 - logical shifts just return zero if all elements have out of range shift amounts.

In addition, UNDEF shift amounts are handled - either as an UNDEF shift amount in a native shift or as an UNDEF in the logical 'all out of range' zero constant special case for logical shifts.

Repository:
  rL LLVM

http://reviews.llvm.org/D19675

Files:
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  test/Transforms/InstCombine/x86-vector-shifts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19675.55448.patch
Type: text/x-patch
Size: 24839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160428/7aa04123/attachment.bin>


More information about the llvm-commits mailing list