Skip to content
Snippets Groups Projects
Commit 06cc38c1 authored by liuhongt's avatar liuhongt
Browse files

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_<mode>): Adjust the pattern
	to explicitly set FLAGS_REG like *cmp<mode>_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.
parent e6a1b238
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment