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

--- Comment #16 from David <gccbugzilla at limegreensocks dot com> ---
I've tried it now and it seems to do good things.  This code:

int main(int argc, char *argv[])
{
   char x;

   asm("setc" : "=@ccc"(x));

   if (!x)
      return 6;
   else
      return argc;
}

produces this output (-O3):

        movl    $6, %eax
/APP
 # 6 "./r.cpp" 1
        setc
 # 0 "" 2
/NO_APP
        cmovc   %ebx, %eax
        addq    $32, %rsp
        popq    %rbx
        ret

Although a minor variation (change "return argc" to "return 7") ends up doing
setc+cmpb, so it's not a perfect solution.

Still, if I were Richard, I'd be closing this bug.  If someone has optimization
issues with his solution, that's a new bug.

Reply via email to