]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sync.md (atomic_fetch_sub): Fix negation and avoid clobbering a live register.
authorWalter Lee <walt@tilera.com>
Sat, 25 Jan 2014 20:31:38 +0000 (20:31 +0000)
committerWalter Lee <walt@gcc.gnu.org>
Sat, 25 Jan 2014 20:31:38 +0000 (20:31 +0000)
2014-01-25  Walter Lee  <walt@tilera.com>

            * config/tilegx/sync.md (atomic_fetch_sub): Fix negation and
            avoid clobbering a live register.

From-SVN: r207084

gcc/ChangeLog
gcc/config/tilegx/sync.md

index db40e1826ef5ae25793b7d7da9537d9fa20f3985..ccbea0f715876b5a001b4e37d3a29ba0404fa9f2 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-25  Walter Lee  <walt@tilera.com>
+
+       * config/tilegx/sync.md (atomic_fetch_sub): Fix negation and
+       avoid clobbering a live register.
+
 2014-01-25  Walter Lee  <walt@tilera.com>
 
        * config/tilegx/tilegx-c.c (tilegx_cpu_cpp_builtins): 
index 586025760f48f5bb7a0f863441118b4bf16f161b..3d9349301caa6737d6ace6033a6bcc5c28678638 100644 (file)
    (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>mode, operands[2]));
+    {
+       addend = gen_reg_rtx (<MODE>mode);
+       emit_move_insn (addend,
+                       gen_rtx_MINUS (<MODE>mode, const0_rtx, operands[2]));
+    }
+  else
+    addend = operands[2];
 
   tilegx_pre_atomic_barrier (model);
   emit_insn (gen_atomic_fetch_add_bare<mode> (operands[0],
                                               operands[1],
-                                              operands[2]));
+                                              addend));
   tilegx_post_atomic_barrier (model);
   DONE;
 })