Page MenuHomePhabricator

[TargetLowering] Improve expandFunnelShift shift amount masking

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



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.

Diff Detail