https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60554
Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Luchezar Belev from comment #2) > sorry, the above code to be correct "setg %al" should be "seta %al" instead. > > also in the compiler-generated code, the testl instruction is still > redundant, but when it is removed the following "setg %al" should be > replaced with "seta %al". > Maybe this is too complicated for a compiler to figure out though. None of the above will work. Please see available conditions for the SETcc instruction [1]. You can try with a debugger to see which flags are set in various operations for some characteristic input values and how SETcc insn reacts to those flags. [1] http://www.felixcloutier.com/x86/SETcc.html