Hi!
On Thu, Apr 08, 2021 at 03:33:44PM +0000, Christophe Leroy wrote:
For clear bits, on 32 bits 'rlwinm' can be used instead or 'andc' for
when all bits to be cleared are consecutive.
Also on 64-bits, as long as both the top and bottom bits are in the low
32-bit half (for 32 bit mode, it can wrap as well).
For the time being only
handle the single bit case, which we detect by checking whether the
mask is a power of two.
You could look at rs6000_is_valid_mask in GCC:
<https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/rs6000/rs6000.c;h=48b8efd732b251c059628096314848305deb0c0b;hb=HEAD#l11148>
used by rs6000_is_valid_and_mask immediately after it. You probably
want to allow only rlwinm in your case, and please note this checks if
something is a valid mask, not the inverse of a valid mask (as you
want here).
So yes this is pretty involved :-)
Your patch looks good btw. But please use "n", not "i", as constraint?