[Bug inline-asm/49611] Inline asm should support input/output of flags

gcc.hall at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 20 09:20:00 GMT 2015


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

--- Comment #17 from Jeremy <gcc.hall at gmail dot com> ---
Did you mean "stc" rather than "setc" ???

But yes, it looks like its working well.

On 20 July 2015 at 10:05, gccbugzilla at limegreensocks dot com <
gcc-bugzilla@gcc.gnu.org> wrote:

> 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.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>



More information about the Gcc-bugs mailing list