[Bug target/55673] New: [SPARC] Transposed before-after in sparc_emit_membar_for_model()

tomash.brechko at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 13 12:46:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55673

             Bug #: 55673
           Summary: [SPARC] Transposed before-after in
                    sparc_emit_membar_for_model()
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tomash.brechko@gmail.com


As for other architectures (compare with need_atomic_barrier_p() for instance),
in gcc/config/sparc/sparc.c:sparc_emit_membar_for_model() memory barrier for
ACQUIRE should be emitted _after_ the operation and memory barrier for RELEASE
should be emitted _before_ the operation, i.e.:

diff --git i/gcc/config/sparc/sparc.c w/gcc/config/sparc/sparc.c
index 4e9de98..fdc6374 100644
--- i/gcc/config/sparc/sparc.c
+++ w/gcc/config/sparc/sparc.c
@@ -11188,7 +11188,7 @@ sparc_emit_membar_for_model (enum memmodel model,
       gcc_unreachable ();
     }

-  if (before_after & 1)
+  if (before_after & 2)
     {
       if (model == MEMMODEL_ACQUIRE
           || model == MEMMODEL_ACQ_REL
@@ -11200,7 +11200,7 @@ sparc_emit_membar_for_model (enum memmodel model,
            mm |= StoreLoad | StoreStore;
        }
     }
-  if (before_after & 2)
+  if (before_after & 1)
     {
       if (model == MEMMODEL_RELEASE
          || model == MEMMODEL_ACQ_REL



More information about the Gcc-bugs mailing list