[Bug target/110591] [i386] (Maybe) Missed optimisation: _cmpccxadd sets flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110591 liuhongt at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED CC||liuhongt at gcc dot gnu.org --- Comment #6 from liuhongt at gcc dot gnu.org --- .
[Bug target/110591] [i386] (Maybe) Missed optimisation: _cmpccxadd sets flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110591 --- Comment #5 from Hongtao.liu --- Fixed in GCC14.
[Bug target/110591] [i386] (Maybe) Missed optimisation: _cmpccxadd sets flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110591 --- Comment #4 from CVS Commits --- The master branch has been updated by hongtao Liu : https://gcc.gnu.org/g:06cc38c1c350b34cbd6dde23aefca32442c07a73 commit r14-2595-g06cc38c1c350b34cbd6dde23aefca32442c07a73 Author: liuhongt Date: Mon Jul 10 14:12:07 2023 +0800 Add peephole to eliminate redundant comparison after cmpccxadd. Similar like we did for cmpxchg, but extended to all ix86_comparison_int_operator since cmpccxadd set EFLAGS exactly same as CMP. When operand order in compare insn is same as that in cmpccxadd, compare insn can be eliminated directly. When operand order is swapped in compare insn, only optimize cmpccxadd + cmpl + jcc/setcc to cmpccxadd + jcc/setcc when FLAGS_REG is dead after jcc/setcc. gcc/ChangeLog: PR target/110591 * config/i386/sync.md (cmpccxadd_): Adjust the pattern to explicitly set FLAGS_REG like *cmp_1, also add extra 3 define_peephole2 after the pattern. gcc/testsuite/ChangeLog: * gcc.target/i386/pr110591.c: New test. * gcc.target/i386/pr110591-2.c: New test.
[Bug target/110591] [i386] (Maybe) Missed optimisation: _cmpccxadd sets flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110591 --- Comment #3 from Hongtao.liu --- Created attachment 55510 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55510=edit untested patch. Under testing.
[Bug target/110591] [i386] (Maybe) Missed optimisation: _cmpccxadd sets flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110591 --- Comment #2 from Hongtao.liu --- (In reply to Hongtao.liu from comment #1) > I guess we can add a peephole for this, middle-end optimizer doesn't know > cmpccxadd set EFLAGS same as cmp. We already have a peephole for cmpxchg, for cmpxchg it's only valid for CCZmode, but for cmpccxadd, it should be ok for all CCmode since it sets EFLAGS exactly the same as CMP. The _CMPCCX_Z in the intrinsic is used as condition of updating memory.
[Bug target/110591] [i386] (Maybe) Missed optimisation: _cmpccxadd sets flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110591 --- Comment #1 from Hongtao.liu --- I guess we can add a peephole for this, middle-end optimizer doesn't know cmpccxadd set EFLAGS same as cmp.