* asm constraints
@ 2004-08-27 6:58 Zvilius, Mark
2004-08-27 11:16 ` Segher Boessenkool
0 siblings, 1 reply; 2+ messages in thread
From: Zvilius, Mark @ 2004-08-27 6:58 UTC (permalink / raw)
To: 'gcc-help@gcc.gnu.org'
For a PowerPC architecture I'm using the following asm statement in C source
to read a time base register:
unsigned int tbl;
__asm__("mftbl %0" : "=r" (tbl));
The code this generates is:
mftb r0
mr r9,r0
stw r9,0x18(r31)
I'm wondering why it's wasting a register. Am I specifying the constraint
incorrectly?
Mark Z.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: asm constraints
2004-08-27 6:58 asm constraints Zvilius, Mark
@ 2004-08-27 11:16 ` Segher Boessenkool
0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2004-08-27 11:16 UTC (permalink / raw)
To: Zvilius, Mark; +Cc: 'gcc-help@gcc.gnu.org'
> unsigned int tbl;
> __asm__("mftbl %0" : "=r" (tbl));
[side note: mftbl is not a PowerPC insn, nor an assembler
extended mnemonic. I have no idea why libopcodes accepts
it].
> I'm wondering why it's wasting a register.
Did you compile with optimization on? If so, what compiler
version did you use? I tried with 3.4.1 and it works just
fine. If you still have problems, please show the exact code
(full routine, compilable as-is).
> Am I specifying the constraint incorrectly?
No, it's fine.
Segher
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-08-27 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-27 6:58 asm constraints Zvilius, Mark
2004-08-27 11:16 ` Segher Boessenkool
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 read-only IMAP folder(s) and NNTP newsgroup(s).