https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121136

--- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> ---
With the case in c#4, I think good code generation would look like this:

        bseti   a5,zero,32      # 6     [c=4 l=4]  *movdi_64bit/1
        sltu    a0,a0,a5        # 15    [c=4 l=4]  sltu_didi3
        ret             # 23    [c=0 l=4]  simple_return

The bseti has no incoming data dependencies and can issue whenever is
convenient.  Then a trivial sltu.

I guess there's a change the right shift + equality test could encode better
making it a good target for -Os, but it's going to have an extra data
dependency and thus isn't generally going to perform as well.

Reply via email to