public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Henderson <rth@redhat.com>
Cc: gcc-patches@gcc.gnu.org, amacleod@redhat.com
Subject: Re: [cxx-mem-model][PATCH 0/9] Convert i386 to new atomic optabs.
Date: Fri, 28 Oct 2011 11:29:00 -0000	[thread overview]
Message-ID: <20111028110616.GS1052@tyan-ft48-01.lab.bos.redhat.com> (raw)
In-Reply-To: <1319774858-9181-1-git-send-email-rth@redhat.com>

On Thu, Oct 27, 2011 at 09:07:29PM -0700, Richard Henderson wrote:
> Jakub, in the seventh patch, is there any good reason why OMP is
> making the decision of whether or not to generate a compare-and-swap
> loop?  Why shouldn't we simply always generate the __sync_fetch_op
> builtin and let optabs.c generate the compare-and-swap loop?

It just wants a guarantee that the builtin will actually be implemented
in hw.  I guess if __sync_fetch_op (new/old) isn't supported but
__sync_compare_and_swap_* is, we could just use the former and let
optabs.c deal with that.  But we have to handle the CAS case anyway
for most of the operations that don't have a __sync_fetch_op defined
(and for the cases where we e.g. VCE floating point data to integer
of the same size for CAS).
For ABI reasons we should keep using GOMP_{start,end}_atomic for the
types that don't have CAS in hw, shouldn't replace it with some generic
C++11 atomic helper in some library (libgcc or elsewhere?).

BTW, I believe all #pragma omp atomic ops we want in the relaxed model
or weaker, I think OpenMP only guarantees that the memory is modified
or loaded atomically (that you don't see half of something and half of
something else), there is nothing that requires ordering the atomic
vs. any other memory location stores/loads.

	Jakub

  parent reply	other threads:[~2011-10-28 11:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28  4:08 Richard Henderson
2011-10-28  4:08 ` [PATCH 2/9] Handle expanding insns with 8 operands Richard Henderson
2011-10-28  4:08 ` [PATCH 1/9] Fix thinko in gen_mem_thread_fence operand Richard Henderson
2011-10-28  4:08 ` [PATCH 7/9] Update omp for new atomic optabs Richard Henderson
2011-10-28  4:08 ` [PATCH 3/9] Introduce and use can_compare_and_swap_p Richard Henderson
2011-10-28  5:11 ` [PATCH 9/9] Update ChangeLogs Richard Henderson
2011-10-28  5:11 ` [PATCH 6/9] Update cppbuiltins for atomic-compare-and-swap Richard Henderson
2011-10-28  5:20 ` [PATCH 8/9] Convert i386 backend to new atomic patterns Richard Henderson
2011-10-28  5:30 ` [PATCH 5/9] Add missing atomic optab initializations Richard Henderson
2011-10-28  5:40 ` [PATCH 4/9] Rewrite all compare-and-swap in terms of expand_atomic_compare_and_swap Richard Henderson
2011-10-28 11:29 ` Jakub Jelinek [this message]
2011-10-28 15:25   ` [cxx-mem-model][PATCH 0/9] Convert i386 to new atomic optabs Richard Henderson
2011-10-29 17:28 ` Andrew MacLeod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111028110616.GS1052@tyan-ft48-01.lab.bos.redhat.com \
    --to=jakub@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).