This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] Improve expandFunnelShift shift amount masking
ClosedPublic

Authored by RKSimon on May 24 2020, 2:40 AM.

Details

Summary

For the 'inverse shift', we currently always perform a subtraction of the original (masked) shift amount.

But for the case where we are handling power-of-2 type widths, we can replace:

(sub bw-1, (and amt, bw-1) ) -> (and (xor amt, bw-1), bw-1) -> (and ~amt, bw-1)

This allows x86 shifts to fold away the and-mask.

Followup to D77301 + D80466.

http://volta.cs.utah.edu:8080/z/Nod0Gr

Diff Detail