https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90044
Bug ID: 90044 Summary: extraneous setne after asm statement with flag output operands Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Created attachment 46140 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46140&action=edit reduced testcase For the attached code, gcc -O3 generates (simplified): $ x86_64-pc-linux-gnu-gcc -O3 tste.c -masm=intel -S -o- ... foo: xor eax, eax # SETNE setne al je .L2 xor eax, eax # TRUE ret .L2: # FALSE ret which is way too complex; "setne" is useless there, and it even only modifies the value 0 already in eax; this one would be better: foo: xor eax, eax # SETNE je .L2 # TRUE ret .L2: # FALSE ret