This is the mail archive of the 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: [PATCH ARM] Inline expansion of __sync_* builtins.

On Tue, 2010-08-10 at 18:03 +0100, Marcus Shawcroft wrote:
> > This patch inlines builtin synchronization primitives for ARM targets that
> provide load/store exclusive.
> >
> > All __sync_* builtins applied to a 32bit object will be inlined on ARM
> targets which provide the ldrex/strex instructions, primitives applied to 8
> or 16 bit objects will be inlined on
> > targets which provide ldrex{b,h}/strex{b,h} in all other cases we fall
> back to the existing library functions. The __sync_synchronize() builtin
> will emit an inline DMB or MCR
> > instruction on targets where this is appropriate.
> >
> > The ldrex/strex synchronization loops are represented as opaque
> instruction blobs. This provides a guarantee that no memory reference can be
> inserted between the
> >  ldrex / strex pair.
> >
> > Memory references in the ldrex*/strex* instructions are always indirect,
> we do not (yet) exploit offset addressing on targets where this is
> available.
> Revised patch:
> * Includes the missing, as pointed out by David Daney.
> * Addresses the issue raised by Richard. Inline synchronization is now only
> enabled for ARM targets that provided both a memory barrier and load/store
> exclusive. The effect of this is that armv6 will not inline these primitives
> but armv6k and  armv7* will.
> 2010-08-10  Marcus Shawcroft  <>
>         * config/arm/arm-protos.h (arm_expand_sync): New.
>         (arm_output_memory_barrier, arm_output_sync_insn): New.
>         (arm_sync_loop_insns): New.
>         * config/arm/arm.c (FL_ARCH7): New.
>         (FL_FOR_ARCH7): Include FL_ARCH7.
>         (arm_arch7): New.
>         (arm_print_operand): Support %C markup.
>         (arm_legitimize_sync_memory): New.
>         (arm_emit, arm_insn_count, arm_count, arm_output_asm_insn): New.
>         (arm_process_output_memory_barrier, arm_output_memory_barrier): New.
>         (arm_ldrex_suffix, arm_output_ldrex, arm_output_strex): New.
>         (arm_output_op2, arm_output_op3, arm_output_sync_loop): New.
>         (arm_get_sync_operand, FETCH_SYNC_OPERAND): New.
>         (arm_process_output_sync_insn, arm_output_sync_insn): New.
>         (arm_sync_loop_insns,arm_call_generator, arm_expand_sync): New.
>         * config/arm/arm.h (struct arm_sync_generator): New.
> New.
>         * config/arm/ Include
> New.
>         (sync_result, sync_memory, sync_required_value): New attributes.
>         (sync_new_value, sync_t1, sync_t2): Likewise.
>         (sync_release_barrier, sync_op): Likewise.
>         (length): Add logic to length attribute defintion to call
>         arm_sync_loop_insns when appropriate.
>         * config/arm/ New file.



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