From: Richard Sandiford <rdsandiford@googlemail.com>
To: David Daney <ddaney@caviumnetworks.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] MIPS: Emit optimized sync instructions for Octeon CPUs.
Date: Sat, 15 Aug 2009 07:28:00 -0000 [thread overview]
Message-ID: <87ws55a64w.fsf@firetop.home> (raw)
In-Reply-To: <4A8454BF.2050701@caviumnetworks.com> (David Daney's message of "Thu\, 13 Aug 2009 11\:00\:31 -0700")
David Daney <ddaney@caviumnetworks.com> writes:
> The Octeon CPU has a variant of the SYNC instruction called SYNCW that
> is much faster when only ordering of writes is needed. The built-in
> atomic memory operations are one case where syncw may be used.
Sorry to have to ask, but why is that true for __sync_synchronize?
It's documented as being a full memory barrier.
A couple of minor formatting tweaks:
David Daney <ddaney@caviumnetworks.com> writes:
> Index: gcc/config/mips/sync.md
> ===================================================================
> --- gcc/config/mips/sync.md (revision 150651)
> +++ gcc/config/mips/sync.md (working copy)
> @@ -40,7 +40,10 @@ (define_insn "*memory_barrier"
> [(set (match_operand:BLK 0 "" "")
> (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))]
> "GENERATE_SYNC"
> - "%|sync%-")
> +{
> + return mips_output_sync_insn ();
> +}
> + [(set (attr "length") (symbol_ref "mips_sync_insn_length ()"))])
{ return mips_output_sync_insn (); }
> +/* Return the length of code that would be emitted by
> + mips_output_sync_loop(), given that the loop consists of LOOP_INSNS
> + instructions and BARRIER_BEFORE has the same value as it would for
> + mips_output_sync_loop. */
> +
> +int
> +mips_sync_loop_length (bool barrier_before, int loop_insns)
> +{
> + int sync_length = 0;
> +
> + if (barrier_before)
> + sync_length += mips_sync_insn_length ();
> + if (TARGET_SYNC_AFTER_SC)
> + sync_length += mips_sync_insn_length ();
> + return (4 * loop_insns) + sync_length;
> +}
> +
> +/* Return or emit the assembly code for a SYNC instruction. */
> +
> +const char *
> +mips_output_sync_insn (void)
> +{
> + if (TARGET_OCTEON)
> + {
> + /* For OCTEON, it is faster to issue two syncw instead of a
> + sync.*/
> + return "syncw\n\tsyncw";
> + }
if (TARGET_OCTEON)
/* For OCTEON, it is faster to issue two SYNCWs instead of a SYNC. */
return "syncw\n\tsyncw";
Richard
next prev parent reply other threads:[~2009-08-15 7:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 18:01 David Daney
2009-08-15 7:28 ` Richard Sandiford [this message]
2009-08-17 17:14 ` David Daney
2009-08-17 18:57 ` Paolo Bonzini
2009-08-17 19:34 ` Richard Henderson
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=87ws55a64w.fsf@firetop.home \
--to=rdsandiford@googlemail.com \
--cc=ddaney@caviumnetworks.com \
--cc=gcc-patches@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).