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

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems on x86_64-linux we also used to give the same code in 3.4.6 and earlier,
but starting already with 4.0 (already r90000) we emit
        cmpl    %edx, %edi
        movl    $0, %eax
        cmove   %esi, %eax
for f and
        xorl    %eax, %eax
        cmpl    %edx, %edi
        sete    %al
        negl    %eax
        andl    %esi, %eax
for g.  We do it even for -Os, where the f version is clearly a win, for -O2
I'm afraid it depends on how soon the cmove result is used.  LLVM seems to use
cmove in both cases, ICC does roughly what gcc does (honor what user wrote).

Not sure if we can do this transformation in match.pd though, because for a ? b
: 0; the gimplifier doesn't emit a COND_EXPR, but GIMPLE_COND and PHI, I'm
afraid we can't create new bbs from within match.pd.

Reply via email to