linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: linux-mips <linux-mips@linux-mips.org>
Cc: Adam Nemet <anemet@caviumnetworks.com>
Subject: .subsection madness
Date: Fri, 14 Aug 2009 11:24:19 -0700	[thread overview]
Message-ID: <4A85ABD3.5040801@caviumnetworks.com> (raw)


In atomic.h for atomic_add we have this gem:

	__asm__ __volatile__(
	"	.set	mips3					\n"
	"1:	ll	%0, %1		# atomic_add		\n"
	"	addu	%0, %2					\n"
	"	sc	%0, %1					\n"
	"	beqz	%0, 2f					\n"
	"	.subsection 2					\n"
	"2:	b	1b					\n"
	"	.previous					\n"
	"	.set	mips0					\n"


What is the purpose of the .subsection here?

It will not affect branch prediction in the beqz as nothing happens in 
.subsection 2.

For spin locks it is clear that this technique can help, but for 
atomic_add I don't think so.  To make matters worse for some code the 
subsection is going out of branch range.

David Daney

             reply	other threads:[~2009-08-14 18:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14 18:24 David Daney [this message]
2009-08-14 21:57 ` .subsection madness Ralf Baechle

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=4A85ABD3.5040801@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=anemet@caviumnetworks.com \
    --cc=linux-mips@linux-mips.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 NNTP newsgroup(s).