From: Walter Lee Date: Sat, 25 Jan 2014 22:46:37 +0000 (+0000) Subject: backport: sync.md (atomic_fetch_sub): Fix negation and avoid clobbering a live register. X-Git-Tag: releases/gcc-4.7.4~291 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50b8450bc20856fe4281c67da489f66d1819ad94;p=thirdparty%2Fgcc.git backport: sync.md (atomic_fetch_sub): Fix negation and avoid clobbering a live register. 2014-01-25 Walter Lee Backport from mainline 2014-01-25 Walter Lee * config/tilegx/sync.md (atomic_fetch_sub): Fix negation and avoid clobbering a live register. From-SVN: r207104 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e3b1c3cdf516..c8e08cf9a40b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-01-25 Walter Lee + + Backport from mainline + 2014-01-25 Walter Lee + + * config/tilegx/sync.md (atomic_fetch_sub): Fix negation and + avoid clobbering a live register. + 2014-01-25 Walter Lee Backport from mainline diff --git a/gcc/config/tilegx/sync.md b/gcc/config/tilegx/sync.md index 9bf61d17dbe8..bf62ee638358 100644 --- a/gcc/config/tilegx/sync.md +++ b/gcc/config/tilegx/sync.md @@ -151,15 +151,22 @@ (match_operand:SI 3 "const_int_operand" "")] ;; model "" { + rtx addend; enum memmodel model = (enum memmodel) INTVAL (operands[3]); if (operands[2] != const0_rtx) - emit_move_insn (operands[2], gen_rtx_NEG (mode, operands[2])); + { + addend = gen_reg_rtx (mode); + emit_move_insn (addend, + gen_rtx_MINUS (mode, const0_rtx, operands[2])); + } + else + addend = operands[2]; tilegx_pre_atomic_barrier (model); emit_insn (gen_atomic_fetch_add_bare (operands[0], operands[1], - operands[2])); + addend)); tilegx_post_atomic_barrier (model); DONE; })