This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
ARM: __sync_synchronize does not generate code
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Aug 2009 14:36:38 +0100
- Subject: ARM: __sync_synchronize does not generate code
__sync_synchronize has been added to ARM libgcc as a libfunc.
Unfortunately it does not do anything:
int i;
void *foo (void)
{
__sync_synchronize()
i = 3;;
}
foo:
ldr r3, .L3
mov r2, #3
str r2, [r3, #0]
bx lr
.L4:
.align 2
.L3:
.word i
Fixed thusly. I presume the correct test is arm_abi == ARM_ABI_AAPCS_LINUX.
OK to commit?
Andrew.
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();
+}
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 (arm_abi == ARM_ABI_AAPCS_LINUX)
+ synchronize_libfunc = init_one_libfunc ("__sync_synchronize");
}
/* On AAPCS systems, this is the "struct __va_list". */