From: Kevin Hendricks <khendricks@ivey.uwo.ca>
To: linuxppc-dev@lists.linuxppc.org
Subject: Fwd: Re: still no accelerated X ($#!$*)
Date: Thu, 20 Jan 2000 13:12:49 -0500 [thread overview]
Message-ID: <00012013133502.00819@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 2408 bytes --]
Hi,
Can anyone explain this to me?
> Finally I got it!
> asm("stwbrx %0,%1,%2": : "r"(regdata), "r"(regindex), "r"(base_addr));
> asm("lwbrx %0,%1,%2": "=r"(val):"r"(regindex), "r"(base_addr));
> asm("stwbrx %0,%1,%2": : "r"(regdata), "b"(regindex), "r"(base_addr));
> asm("lwbrx %0,%1,%2": "=r"(val):"b"(regindex), "r"(base_addr));
> Don't know if this is correct (no clue about ppc assembly), but it works...
Well I did the following with the attached sample program:
gcc -O0 -S testit.c
then I looked at testit.s (the assembler).
old_regw:
stwu 1,-32(1)
stw 31,28(1)
mr 31,1
stw 3,8(31)
mr 0,4
lis 11,mach64MemReg@ha
lwz 9,mach64MemReg@l(11)
lwz 11,8(31)
stwbrx 0,11,9
.L2:
lwz 11,0(1)
lwz 31,-4(11)
mr 1,11
blr
.Lfe2:
.size old_regw,.Lfe2-old_regw
.align 2
.type old_regr,@function
old_regr:
stwu 1,-32(1)
stw 31,28(1)
mr 31,1
stw 3,8(31)
lis 9,mach64MemReg@ha
lwz 0,mach64MemReg@l(9)
lwz 11,8(31)
lwbrx 9,11,0
mr 3,9
b .L3
.L3:
lwz 11,0(1)
lwz 31,-4(11)
mr 1,11
blr
.Lfe3:
.size old_regr,.Lfe3-old_regr
.align 2
:regw:
stwu 1,-32(1)
stw 31,28(1)
mr 31,1
stw 3,8(31)
mr 0,4
lis 11,mach64MemReg@ha
lwz 9,mach64MemReg@l(11)
lwz 11,8(31)
stwbrx 0,11,9
.L4:
lwz 11,0(1)
lwz 31,-4(11)
mr 1,11
blr
.Lfe4:
.size regw,.Lfe4-regw
.align 2
.type regr,@function
regr:
stwu 1,-32(1)
stw 31,28(1)
mr 31,1
stw 3,8(31)
lis 9,mach64MemReg@ha
lwz 0,mach64MemReg@l(9)
lwz 11,8(31)
lwbrx 9,11,0
mr 3,9
b .L5
.L5:
lwz 11,0(1)
lwz 31,-4(11)
mr 1,11
blr
And I simply can not see any difference in the actual code produced by each
bunch of asm statements which leads me to believe that there is something else
going on here.
I would love to know exactly what.
Will you please try compiling the code I attached to get the assembler out and
compare old_regr and regr and old_rew and regw and see if you find any
differences.
Are you sure you haven't changed *anything* else?
Thanks,
Kevin
[-- Attachment #2: testit.c --]
[-- Type: text/plain, Size: 1144 bytes --]
#if defined (__powerpc__)
unsigned int mach64MemReg = 0xDEADBEAF;
static inline void old_regw(volatile unsigned long regindex, unsigned long regdata)
{
register unsigned long base_addr = (unsigned long)mach64MemReg;
asm("stwbrx %0,%1,%2": : "r"(regdata), "r"(regindex), "r"(base_addr));
}
static inline unsigned long old_regr(volatile unsigned long regindex)
{
register unsigned long base_addr = (unsigned long)mach64MemReg, val;
asm("lwbrx %0,%1,%2": "=r"(val):"r"(regindex), "r"(base_addr));
return(val);
}
static inline void regw(volatile unsigned long regindex, unsigned long regdata)
{
register unsigned long base_addr = (unsigned long)mach64MemReg;
asm("stwbrx %0,%1,%2": : "r"(regdata), "b"(regindex), "r"(base_addr));
}
static inline unsigned long regr(volatile unsigned long regindex)
{
register unsigned long base_addr = (unsigned long)mach64MemReg, val;
asm("lwbrx %0,%1,%2": "=r"(val):"b"(regindex), "r"(base_addr));
return(val);
}
#endif
int main() {
int offset=10;
int data=12;
int input, input2;
input = regr(offset);
input = old_regr(offset);
regw(offset,data);
old_regw(offset,data);
}
next reply other threads:[~2000-01-20 18:12 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Message from Kevin Hendricks <khendricks@ivey.uwo.ca>
2000-01-20 18:12 ` Kevin Hendricks [this message]
2000-01-20 18:26 ` Fwd: Re: still no accelerated X ($#!$*) David Edelsohn
2000-01-20 18:45 ` Benjamin Herrenschmidt
2000-01-20 18:51 ` David Edelsohn
2000-01-20 18:52 ` Franz Sirl
2000-01-20 19:31 ` Gabriel Paubert
2000-01-20 19:36 ` Kevin Hendricks
2000-01-20 19:51 ` Geert Uytterhoeven
2000-01-20 19:59 ` Gabriel Paubert
2000-01-20 20:08 ` David Edelsohn
2000-01-20 22:34 ` Franz Sirl
2000-01-21 0:05 ` Gabriel Paubert
2000-01-21 0:35 ` Kevin Hendricks
2000-01-21 1:53 ` Gabriel Paubert
2000-01-21 2:19 ` Kevin Hendricks
2000-01-21 7:58 ` Geert Uytterhoeven
2000-01-21 14:15 ` Benjamin Herrenschmidt
2000-01-22 20:54 ` [linux-fbdev] " anthony tong
2000-01-23 2:44 ` Kevin Hendricks
2000-01-21 11:54 ` Benjamin Herrenschmidt
2000-01-21 13:34 ` Gabriel Paubert
2000-01-21 14:06 ` Benjamin Herrenschmidt
2000-01-21 15:47 ` Franz Sirl
2000-01-21 19:08 ` Gabriel Paubert
2000-01-20 18:46 ` Franz Sirl
2000-01-21 13:53 Kevin_Hendricks
[not found] <200001211355.NAA05477@granada.iram.es>
2000-01-21 15:13 ` Gabriel Paubert
2000-01-21 15:29 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2000-01-21 17:32 David Edelsohn
2000-01-21 20:25 jlquinn
2000-01-23 13:06 ` Gabriel Paubert
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=00012013133502.00819@localhost.localdomain \
--to=khendricks@ivey.uwo.ca \
--cc=linuxppc-dev@lists.linuxppc.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.