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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
By the way, no compiler gets the same code generation for all 3 functions.
Most have foo and foo1 being the same but some targets get close to foo2 though
.

RISCV32 GCC gets:
(insn 28 42 47 (set (reg/i:SI 10 a0)
        (lt:SI (reg:SI 10 a0 [orig:155 s ] [155])
            (const_int 0 [0]))) "/app/example.cpp":17:1 427 {slt_sisi3}
     (nil))

For foo and foo1 but foo2 is:
(insn 14 25 27 (set (reg/i:SI 10 a0)
        (lshiftrt:SI (reg:SI 10 a0 [orig:139 s ] [139])
            (const_int 31 [0x1f]))) "/app/example.cpp":24:1 296 {*lshrsi3}
     (nil))

Reply via email to