[llvm] AMDGPU: Disable pattern matching "x<<32-y>>32-y" to "bfe x, 0, y" (PR #114279)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 10:57:50 PDT 2024


arsenm wrote:

> > > We may be able to keep the pattern for immediate y while y is within [0, 31].
> > 
> > 
> > Playing with alive I don't see how this is ever correct
> 
> "bfe x, 0, y" is to extract the lower y bits from x, and thus it is equivalent to x left shift (32 - y), then right shift (32 - y) --- to clear the upper 32 - y bits of x.

I made a mistake with the pre-shift in the original testcase.

https://alive2.llvm.org/ce/z/nyk6tV

We could do a computeKnownBits based range check 

https://github.com/llvm/llvm-project/pull/114279


More information about the llvm-commits mailing list