diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-28 17:10:14 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-28 17:10:14 +0000 |
commit | 287c39821ffd052f1f9eb19f2baebe6c2aee728b (patch) | |
tree | 879304333dc392a536812778fa544a55b9084e3e /gcc/config/i386/sync.md | |
parent | 30cebcca995b5210b8e3add8f0baf2bfdd4bd5ea (diff) |
PR target/70821
* config/i386/sync.md (define_peephole2 *atomic_fetch_add_cmp<mode>):
Add new peephole2 where the first insn is *mov<mode>_or instead of
*mov<mode>_internal.
* gcc.target/i386/pr70821.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235586 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386/sync.md')
-rw-r--r-- | gcc/config/i386/sync.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md index 85a2b9ad630..bc4fd34e6d5 100644 --- a/gcc/config/i386/sync.md +++ b/gcc/config/i386/sync.md @@ -467,6 +467,36 @@ (plus:SWI (match_dup 1) (match_dup 2)))])]) +;; Likewise, but for the -Os special case of *mov<mode>_or. +(define_peephole2 + [(parallel [(set (match_operand:SWI 0 "register_operand") + (match_operand:SWI 2 "constm1_operand")) + (clobber (reg:CC FLAGS_REG))]) + (parallel [(set (match_dup 0) + (unspec_volatile:SWI + [(match_operand:SWI 1 "memory_operand") + (match_operand:SI 4 "const_int_operand")] + UNSPECV_XCHG)) + (set (match_dup 1) + (plus:SWI (match_dup 1) + (match_dup 0))) + (clobber (reg:CC FLAGS_REG))]) + (set (reg:CCZ FLAGS_REG) + (compare:CCZ (match_dup 0) + (match_operand:SWI 3 "const_int_operand")))] + "peep2_reg_dead_p (3, operands[0]) + && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) + == -(unsigned HOST_WIDE_INT) INTVAL (operands[3]) + && !reg_overlap_mentioned_p (operands[0], operands[1])" + [(parallel [(set (reg:CCZ FLAGS_REG) + (compare:CCZ + (unspec_volatile:SWI [(match_dup 1) (match_dup 4)] + UNSPECV_XCHG) + (match_dup 3))) + (set (match_dup 1) + (plus:SWI (match_dup 1) + (match_dup 2)))])]) + (define_insn "*atomic_fetch_add_cmp<mode>" [(set (reg:CCZ FLAGS_REG) (compare:CCZ |