https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106602
--- Comment #19 from Vineet Gupta <vineetg at rivosinc dot com> ---
(In reply to Jeffrey A. Law from comment #13)
> Trying 7, 8, 9 -> 10:
> 7: r140:DI=0x1
> 8: r141:DI=r140:DI<<0x26
> REG_DEAD r140:DI
> REG_EQUAL 0x4000000000
> 9: r139:DI=r141:DI-0x40
> REG_DEAD r141:DI
> REG_EQUAL 0x3fffffffc0
> 10: r137:DI=r138:DI&r139:DI
> REG_DEAD r139:DI
> REG_DEAD r138:DI
> Failed to match this instruction:
> (set (reg:DI 137)
> (and:DI (reg:DI 138)
> (const_int 274877906880 [0x3fffffffc0])))
>
>
> That's what we're looking for. I think I had a wrong switch somewhere.
> Match that with a define_split and you should be good to go.
I experimented with a define_split and initially saw it generate
slli a5,a0,32
srli a0,a5,6
but realized for both leading and trailing zeroes (either of arbitrary length)
we'll need 3 shifts ?