This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ARM: __sync_synchronize does not generate code
Richard Earnshaw wrote:
> I'm almost inclined to suggest that it should be added for all AAPCS
> derived targets.
Almost?
> I'm not sure what the implementation needs to be
> outside of linux (maybe on some machines it is a NOP), but if the hook
> is there via a library call then users can add whatever semantics are
> needed by their system.
If I conditionalize this on AAPCS, all that will happen for non-Linux
targets is that a call to some external __sync_synchronize will be
emitted. That seems reasonable to me: if someone has deliberately
called __sync_synchronize() they presumably expect something to
happen at runtime as a result.
OK to commit?
Andrew.
2009-08-11 Andrew Haley <aph@redhat.com>
* config/arm/arm.c (arm_init_libfuncs): Add __sync_synchronize.
Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c (revision 150373)
+++ config/arm/arm.c (working copy)
@@ -54,6 +54,7 @@
#include "langhooks.h"
#include "df.h"
#include "intl.h"
+#include "libfuncs.h"
/* Forward definitions of types. */
typedef struct minipool_node Mnode;
@@ -1042,6 +1043,9 @@
default:
break;
}
+
+ if (TARGET_AAPCS_BASED)
+ synchronize_libfunc = init_one_libfunc ("__sync_synchronize");
}
/* On AAPCS systems, this is the "struct __va_list". */
2009-08-11 Andrew Haley <aph@redhat.com>
* gcc.target/arm/synchronize.c: New file.
Index: testsuite/gcc.target/arm/synchronize.c
===================================================================
--- testsuite/gcc.target/arm/synchronize.c (revision 0)
+++ testsuite/gcc.target/arm/synchronize.c (revision 0)
@@ -0,0 +1,6 @@
+/* { dg-final { scan-assembler "__sync_synchronize" { target arm*-*-linux-*eabi } } } */
+
+void *foo (void)
+{
+ __sync_synchronize();
+}