All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@debian.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: libc-ports@sourceware.org, linux-mips@linux-mips.org
Subject: Re: mips RDHWR instruction in glibc
Date: Thu, 15 Jun 2006 11:32:52 -0400	[thread overview]
Message-ID: <20060615153252.GA21598@nevyn.them.org> (raw)
In-Reply-To: <20060616.002837.59465125.anemo@mba.ocn.ne.jp>

On Fri, Jun 16, 2006 at 12:28:37AM +0900, Atsushi Nemoto wrote:
> On Wed, 14 Jun 2006 12:50:40 -0400, Daniel Jacobowitz <dan@debian.org> wrote:
> > > For example, in the code below, RDHWR is placed _before_ checking the
> > > error.  I suppose these instructions were reordered by gcc's
> > > optimization, but the optimization would have large negative effect in
> > > this case.
> > 
> > You'd have to figure out how to get GCC not to eagerly schedule the
> > rdhwr.  This might be quite hard.  I don't know much about this part of
> > the scheduler.
> 
> I really did not understand yet how errno is bound TLS.  I found some
> "rdhwr" in glibc-ports source code (tls-macros.h, nptl/tls.h).  The
> RDHWR instruction in the example code comes from one of them, no?

No.

> I also found a "rdhwr" in gcc's mips.md file ("tls_get_tp_<mode>").
> Is this the origin?  MD is a very foreign language for me...

Yes.  Compile something like this with -O2 but without -fpic:

__thread int x;
int foo() { return x; }

It should use the IE model, which will generate a rdhwr.

-- 
Daniel Jacobowitz
CodeSourcery

  reply	other threads:[~2006-06-15 15:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-14 15:12 mips RDHWR instruction in glibc Atsushi Nemoto
2006-06-14 16:50 ` Daniel Jacobowitz
2006-06-15 15:28   ` Atsushi Nemoto
2006-06-15 15:32     ` Daniel Jacobowitz [this message]
2006-06-16 15:58       ` Atsushi Nemoto
2006-06-16 16:59         ` Atsushi Nemoto
2006-06-22  1:21         ` Atsushi Nemoto

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=20060615153252.GA21598@nevyn.them.org \
    --to=dan@debian.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=libc-ports@sourceware.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.