[m-rev.] diff: more atomic ops with clang
Julien Fischer
juliensf at csse.unimelb.edu.au
Sat Aug 27 00:03:55 AEST 2011
Paul, is there a reason we only check MR_AVOID_HANDWRITTEN_ASSEMBLER
on x86-64 and not on i386 or is that just an oversight?
--------------------
Branches: main, 11.07
runtime/mercury_atomic_ops.h:
Support more of the handwritten atomic ops with clang.
Julien.
Index: runtime/mercury_atomic_ops.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_atomic_ops.h,v
retrieving revision 1.21
diff -u -r1.21 mercury_atomic_ops.h
--- runtime/mercury_atomic_ops.h 26 Aug 2011 11:09:33 -0000 1.21
+++ runtime/mercury_atomic_ops.h 26 Aug 2011 12:19:15 -0000
@@ -52,7 +52,8 @@
* References: Intel and AMD documentation for PAUSE, Intel optimisation
* guide.
*/
-#if defined(MR_GNUC) && ( defined(__i386__) || defined(__x86_64__) ) && \
+#if ( defined(MR_CLANG) || defined(MR_GNUC) ) && \
+ ( defined(__i386__) || defined(__x86_64__) ) && \
!defined(MR_DO_NOT_USE_CPU_RELAX)
#define MR_ATOMIC_PAUSE \
@@ -270,7 +271,7 @@
/*---------------------------------------------------------------------------*/
-#if defined(MR_GNUC) && defined(__x86_64__) && \
+#if (defined(MR_CLANG) || defined(MR_GNUC)) && defined(__x86_64__) && \
!defined(MR_AVOID_HANDWRITTEN_ASSEMBLER)
#define MR_ATOMIC_ADD_WORD_BODY \
@@ -285,7 +286,7 @@
#define MR_ATOMIC_ADD_INT_BODY MR_ATOMIC_ADD_WORD_BODY
#define MR_ATOMIC_ADD_UINT_BODY MR_ATOMIC_ADD_WORD_BODY
-#elif defined(MR_GNUC) && defined(__i386__)
+#elif (defined(MR_CLANG) || defined(MR_GNUC)) && defined(__i386__)
#define MR_ATOMIC_ADD_WORD_BODY \
do { \
@@ -331,7 +332,7 @@
/*---------------------------------------------------------------------------*/
-#if defined(MR_GNUC) && defined(__x86_64__) && \
+#if (defined(MR_CLANG) || defined(MR_GNUC)) && defined(__x86_64__) && \
!defined(MR_AVOID_HANDWRITTEN_ASSEMBLER)
#define MR_ATOMIC_SUB_INT_BODY \
@@ -343,7 +344,7 @@
); \
} while (0)
-#elif defined(MR_GNUC) && defined(__i386__)
+#elif (defined(MR_CLANG) || defined(MR_GNUC)) && defined(__i386__)
#define MR_ATOMIC_SUB_INT_BODY \
do { \
@@ -373,7 +374,7 @@
/*---------------------------------------------------------------------------*/
-#if defined(MR_GNUC) && defined(__x86_64__) && \
+#if (defined(MR_CLANG) || defined(MR_GNUC)) && defined(__x86_64__) && \
!defined(MR_AVOID_HANDWRITTEN_ASSEMBLER)
#define MR_ATOMIC_INC_WORD_BODY \
@@ -388,7 +389,7 @@
#define MR_ATOMIC_INC_INT_BODY MR_ATOMIC_INC_WORD_BODY
#define MR_ATOMIC_INC_UINT_BODY MR_ATOMIC_INC_WORD_BODY
-#elif defined(MR_GNUC) && defined(__i386__) && \
+#elif (defined(MR_CLANG) || defined(MR_GNUC)) && defined(__i386__) && \
!defined(MR_AVOID_HANDWRITTEN_ASSEMBLER)
/* Really 486 or better. */
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list