https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106602
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Vineet Gupta from comment #3)
> Interestingly, if one builds for -march=rv64gc_zbs # single bit extension
>
> then the optimal code seq for bitmanip is generated, while no zbs
> instructions are used.
>
> foo2:
> slli a5,a0,32
> srli a0,a5,26
> ret
Most likely because
li a5,1
slli a5,a5,38
Could be done using one instruction.
And then combine could do its thing. But with multiple instructions, it becomes
harder to do.
I have not looked into rtl dumps but this is just knowing what combine can do
and such.