[Bug rtl-optimization/84527] missed optimization for special ternary operation

ktietz at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 23 11:04:00 GMT 2018


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

--- Comment #1 from Kai Tietz <ktietz at gcc dot gnu.org> ---
For x86 we produce for sample:
        movl    8(%esp), %eax
        cmpl    %eax, 4(%esp)
        setge   %al
        movzbl  %al, %eax
        leal    -1(%eax,%eax), %eax
        ret

which could be expressed with one instruction less as
        movl    4(%esp), %eax
        cmpl    %eax, 8(%esp)
        sbbl    %eax, %eax
        orb     $1, %al
        ret


More information about the Gcc-bugs mailing list