This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp] Use __sync_* builtins for reduction
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Diego Novillo <dnovillo at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Oct 2005 15:09:22 -0400
- Subject: Re: [gomp] Use __sync_* builtins for reduction
- References: <20051011171255.GC22818@devserv.devel.redhat.com> <20051011184740.GA11071@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Oct 11, 2005 at 11:47:40AM -0700, Richard Henderson wrote:
> On Tue, Oct 11, 2005 at 01:12:55PM -0400, Jakub Jelinek wrote:
> > * gimplify.c (omp_atomic_operation_p): New function.
> > (gimplify_omp_atomic): Use it.
>
> I'd prefer you passed the operator and mode, and did the whole
> lookup. This method will always use mutexes on i386, even if
> the reduction is PLUS on SImode, which is available as atomics.
Or omp-low.c could just special case a single reduction clause
and use GOMP_critical_* for 2+ reduction clauses. Then gimplify.c
would need no changes, omp-low.c would just gimplify OMP_ATOMIC.
What do you think?
Also, perhaps it would be better to use GOMP_atomic_* rather
than GOMP_critical_* and let GOMP_atomic_start spin a few dozen/hundred
times before sleeping, as generally GOMP_atomic_* should surround
very short critical sections.
Jakub