Linux MIPS Architecture development
 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: Wed, 14 Jun 2006 12:50:40 -0400	[thread overview]
Message-ID: <20060614165040.GA19480@nevyn.them.org> (raw)
In-Reply-To: <20060615.001238.65193088.anemo@mba.ocn.ne.jp>

On Thu, Jun 15, 2006 at 12:12:38AM +0900, Atsushi Nemoto wrote:
> If a system call returned an error, glibc must save the result to
> errno, which is thread-local, so RDHWR used.  I can understand this
> scenario.  But it seems the RDHWR is often called on non-error cases.

Libc uses TLS for many things other than just errno.  The GCC port
knows how to generate the agreed-upon rdhwr instruction directly.

> 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.

-- 
Daniel Jacobowitz
CodeSourcery

  reply	other threads:[~2006-06-14 16:50 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 [this message]
2006-06-15 15:28   ` Atsushi Nemoto
2006-06-15 15:32     ` Daniel Jacobowitz
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=20060614165040.GA19480@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox