| To: | dan@debian.org |
|---|---|
| Subject: | Re: mips RDHWR instruction in glibc |
| From: | Atsushi Nemoto <anemo@mba.ocn.ne.jp> |
| Date: | Sat, 17 Jun 2006 00:58:45 +0900 (JST) |
| Cc: | libc-ports@sourceware.org, linux-mips@linux-mips.org |
| In-reply-to: | <20060615153252.GA21598@nevyn.them.org> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <20060614165040.GA19480@nevyn.them.org> <20060616.002837.59465125.anemo@mba.ocn.ne.jp> <20060615153252.GA21598@nevyn.them.org> |
| Sender: | linux-mips-bounce@linux-mips.org |
On Thu, 15 Jun 2006 11:32:52 -0400, Daniel Jacobowitz <dan@debian.org> wrote:
> > 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.
Thanks. So this must be a gcc issue, not glibc issue.
extern __thread int x;
int foo(int arg)
{
if (arg)
return x;
return 0;
}
If I compiled this program with -O2 I got:
foo:
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0
.mask 0x00000000,0
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set nomacro
lw $2,%gottprel(x)($28)
.set push
.set mips32r2
rdhwr $3,$29
.set pop
addu $2,$2,$3
beq $4,$0,$L4
move $3,$0
lw $3,0($2)
$L4:
j $31
move $2,$3
It looks too bad for arg == 0 case. I should ask on gcc list.
---
Atsushi Nemoto
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: gcc-4.1.0 cross-compile for MIPS, Jonathan Day |
|---|---|
| Next by Date: | Re: mips RDHWR instruction in glibc, Atsushi Nemoto |
| Previous by Thread: | Re: mips RDHWR instruction in glibc, Daniel Jacobowitz |
| Next by Thread: | Re: mips RDHWR instruction in glibc, Atsushi Nemoto |
| Indexes: | [Date] [Thread] [Top] [All Lists] |