public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pluto at agmk dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/31170] cmpxchgq not emitted.
Date: Wed, 14 Mar 2007 19:05:00 -0000	[thread overview]
Message-ID: <20070314190524.2665.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31170-7667@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from pluto at agmk dot net  2007-03-14 19:05 -------
(In reply to comment #1)
> ifcvt could do this.  But is cmpxchgq really faster with its atomictiy
> guarantee?

only `lock; cmpxchg' has atomicity guarantee on smp.

> They are all vector-path instructions, a compare - cmov sequence looks
> faster (8 cycle latency vs. 10 and also with less constraints on register
> allocation).  Even the code we emit now:
> 
> emit_cmpxchg:
> .LFB2:
>         movq    (%rdi), %rax
>         cmpq    %rsi, %rax
>         je      .L6
>         rep ; ret
>         .p2align 4,,7
> .L6:
>         movq    %rdx, (%rdi)
>         ret
> 
> could be faster dependent on branch probability.

yes, it could be faster, but for -Os we could emit
a small branchless code:

movq %rsi, %rax
cmpxchgq %rdx, (%rdi)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31170


      parent reply	other threads:[~2007-03-14 19:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-14  9:59 [Bug other/31170] New: " pluto at agmk dot net
2007-03-14 11:00 ` [Bug rtl-optimization/31170] " rguenth at gcc dot gnu dot org
2007-03-14 19:05 ` pluto at agmk dot net [this message]

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=20070314190524.2665.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).