[Bug target/96189] Failure to use eflags from cmpxchg on x86
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 16 18:13:23 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96189
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:
https://gcc.gnu.org/g:cc1ef413a859433a8313fa9c15aaff41bdc837dc
commit r11-2181-gcc1ef413a859433a8313fa9c15aaff41bdc837dc
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Thu Jul 16 20:11:43 2020 +0200
i386: Additional peephole2 to use flags from CMPXCHG more [PR96189]
CMPXCHG instruction sets ZF flag if the values in the destination operand
and EAX register are equal; otherwise the ZF flag is cleared and value
from destination operand is loaded to EAX. Following assembly:
xorl %eax, %eax
lock cmpxchgl %edx, (%rdi)
testl %eax, %eax
sete %al
can be optimized by removing the unneeded comparison, since set ZF flag
signals that no update to EAX happened. This patch adds peephole2
pattern to also handle XOR zeroing and load of -1 by OR.
2020-07-16 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/96189
* config/i386/sync.md
(peephole2 to remove unneded compare after CMPXCHG):
New pattern, also handle XOR zeroing and load of -1 by OR.
gcc/testsuite/ChangeLog:
PR target/96189
* gcc.target/i386/pr96189-1.c: New test.
More information about the Gcc-bugs
mailing list