]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mips.h (TARGET_SYNC_AFTER_SC): New macro.
authorDavid Daney <ddaney@caviumnetworks.com>
Thu, 6 Aug 2009 05:27:40 +0000 (05:27 +0000)
committerDavid Daney <daney@gcc.gnu.org>
Thu, 6 Aug 2009 05:27:40 +0000 (05:27 +0000)
2009-08-04  David Daney  <ddaney@caviumnetworks.com>

* config/mips/mips.h (TARGET_SYNC_AFTER_SC): New macro.
* mips_output_sync_loop (mips_output_sync_loop): Only emit
trailing sync if TARGET_SYNC_AFTER_SC.

From-SVN: r150513

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/config/mips/mips.h

index 077929d1399d740c5650552c0d1c0db6af0dd3e3..db42dadd97f4e1209f9e7c753a2f49afaa289210 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-04  David Daney  <ddaney@caviumnetworks.com>
+
+       * config/mips/mips.h (TARGET_SYNC_AFTER_SC): New macro.
+       * mips_output_sync_loop (mips_output_sync_loop): Only emit
+       trailing sync if TARGET_SYNC_AFTER_SC.
+
 2009-08-05  David Daney  <ddaney@caviumnetworks.com>
 
        * gcc/config/mips/sync.md (sync_compare_and_swap<mode>,
index ade652c8056b76998124c8b8cfacac01f4f3b507..1b9c6e72575efff7afaaa0df089c0515e108a3ec 100644 (file)
@@ -10764,9 +10764,17 @@ mips_output_sync_loop (bool barrier_before,
     output_asm_insn ("sync", NULL);
   /* Use branch-likely instructions to work around the LL/SC R10000 errata.  */
   mips_branch_likely = TARGET_FIX_R10000;
-  output_asm_insn (loop, operands);
 
-  return "sync";
+  /* If the target needs a sync after the loop, emit the loop now and
+     return the sync.  */
+
+  if (TARGET_SYNC_AFTER_SC)
+    {
+      output_asm_insn (loop, operands);
+      loop = "sync";
+    }
+  return loop;
 }
 \f
 /* Return the assembly code for DIV or DDIV instruction DIVISION, which has
index 4ce9be365e4f3a8a5d5785f77072442d3ba357c4..89f905621258d7a6b60e9093059080b3c89c6d05 100644 (file)
@@ -337,7 +337,15 @@ enum mips_code_readable_setting {
    in use.  */
 #define TARGET_HARD_FLOAT (TARGET_HARD_FLOAT_ABI && !TARGET_MIPS16)
 #define TARGET_SOFT_FLOAT (TARGET_SOFT_FLOAT_ABI || TARGET_MIPS16)
-  
+
+/* False if SC acts as a memory barrier with respect to itself,
+   otherwise a SYNC will be emitted after SC for atomic operations
+   that require ordering between the SC and following loads and
+   stores.  It does not tell anything about ordering of loads and
+   stores prior to and following the SC, only about the SC itself and
+   those loads and stores follow it.  */
+#define TARGET_SYNC_AFTER_SC (!TARGET_OCTEON)
+
 /* IRIX specific stuff.  */
 #define TARGET_IRIX       0
 #define TARGET_IRIX6      0