[Bug target/92140] clang vs gcc optimizing with adc/sbb
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Oct 17 19:56:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-10-17
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
This optimization builds on the equivalence of:
cmpl $0, %edi
sete %al
where zero flag is used to set %al and
cmpl $1, %edi
setc %al
where carry flag is set to the "borrow" from the unsigned subtract of the $1
from %edi. The carry flag (aka "borrow") is set only for (0 - 1), when %edi ==
0.
The above conversion is beneficial when the following insn consumes carry flag
(e.g. adc/sbb, but also rcr and rcl).
IMO, the combine pass should be the most appropriate place for the above
transformation.
More information about the Gcc-bugs
mailing list