This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM: __sync_synchronize does not generate code


I'm almost inclined to suggest that it should be added for all AAPCS
derived targets.  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.

R.

On Tue, 2009-08-11 at 14:36 +0100, Andrew Haley wrote:
> __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".  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]