This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: Java: add flag_use_atomic_builtins
At the risk of asking a stupid question, shouldn't all the code inside gcc gradually migrate towards using the C++0x (and probably C1x) atomics, which seem to be generally supported by gcc 4.4?
There are known issues with __sync (no atomic loads and stores, underspecified ordering), which is why there wasn't much of an effort topush the __sync interface into C++0x.
Hans
> -----Original Message-----
> From: java-patches-owner@gcc.gnu.org
> [mailto:java-patches-owner@gcc.gnu.org] On Behalf Of Andrew Haley
> Sent: Wednesday, August 12, 2009 10:15 AM
> To: Paolo Bonzini
> Cc: Joseph S. Myers; java-patches@gcc.gnu.org; Gcc Patch List
> Subject: Re: Java: add flag_use_atomic_builtins
>
> Andrew Haley wrote:
> > Paolo Bonzini wrote:
> >> On 08/12/2009 06:52 PM, Andrew Haley wrote:
> >>> Joseph S. Myers wrote:
> >>>> On Wed, 12 Aug 2009, Andrew Haley wrote:
> >>>>
> >>>>> Some targets, particularly ARM, don't have instructions
> for things
> >>>>> such as sync_compare_and_swap. Instead, a routine in libgcc is
> >>>>> used. This patch adds a new gcj option, -fuse-atomic-builtins,
> >>>>> which causes gcj to use the routines in libgcc whenever atomic
> >>>>> operations are needed.
> >>>> Wouldn't a target hook to allow a target to declare which
> >>>> operations it provides in libgcc be better than a
> command-line option?
> >>> Maybe it would. I'm happy to work with anyone to create such a
> >>> thing. What would such a hook look like, and how would a
> front- end
> >>> use it?
> >> Couldn't optabs be (re)used?
> >
> > That would be nice.
>
> I guess that's just a matter of
>
> set_optab_libfunc (sync_compare_and_swap_optab, SImode,,
> SImode, SImode "__sync_bool_compare_and_swap_4");
>
> or somesuch?
>
> Andrew.
>