* Inline asm - only clobber list case sensitive?
@ 2013-11-15 9:27 Michael Weise
2013-11-15 9:33 ` Andrew Haley
2013-12-14 3:59 ` Chung-Ju Wu
0 siblings, 2 replies; 3+ messages in thread
From: Michael Weise @ 2013-11-15 9:27 UTC (permalink / raw)
To: gcc-help
Hi,
yesterday I've been facing a strange problem with some inline asm
code (see below), emitting errors like these:
(gcc 4.7.3, targetting m68k-elf, Windows 7/64, msys):
rs232_2.c:2433:2: error: unknown register name '%CC' in 'asm'
rs232_2.c:2433:2: error: unknown register name '%D1' in 'asm'
rs232_2.c:2433:2: error: unknown register name '%D0' in 'asm'
rs232_2.c:2433:2: error: unknown register name '%A1' in 'asm'
rs232_2.c:2433:2: error: unknown register name '%A0' in 'asm'
Further investigation revealed that the problem is related to case
sensitivity of the register names. I played around with upper/lower case
to check this:
asm volatile (
" move.l %[in1],%%a0 \n" // asm code
" move.l %[in2],%%A1 \n"
" trap #8 \n"
" move.b %%D0,%[out1]\n"
" move.b %%d1,%[out2]\n"
:[out1] "=m" (*pc1), // output
[out2] "=m" (*pc2)
:[in1] "r" (cmdadr), // input
[in2] "r" (DUMRadr)
:"%a0","%A1","%d0","%D1", // clobber list
"memory","%CC"
);
Results in:
rs232_2.c:2433:2: error: unknown register name '%CC' in 'asm'
rs232_2.c:2433:2: error: unknown register name '%D1' in 'asm'
rs232_2.c:2433:2: error: unknown register name '%A1' in 'asm'
The assembler does not complain about %a0 and %d0, which leads me to
the conclusion that:
* Register names being upper case are not recognized - but only in the
clobber list.
Is this intentional, a feature or a bug?
Best Regards
Michael Weise
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inline asm - only clobber list case sensitive?
2013-11-15 9:27 Inline asm - only clobber list case sensitive? Michael Weise
@ 2013-11-15 9:33 ` Andrew Haley
2013-12-14 3:59 ` Chung-Ju Wu
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Haley @ 2013-11-15 9:33 UTC (permalink / raw)
To: Michael Weise; +Cc: gcc-help
On 11/15/2013 09:26 AM, Michael Weise wrote:
> * Register names being upper case are not recognized - but only in the
> clobber list.
The clobber list is parsed by GCC, the instructions by the assembler.
I don't think GCC even looks at the register names in the assembly
code -- it just passes them through as strings.
Andrew.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inline asm - only clobber list case sensitive?
2013-11-15 9:27 Inline asm - only clobber list case sensitive? Michael Weise
2013-11-15 9:33 ` Andrew Haley
@ 2013-12-14 3:59 ` Chung-Ju Wu
1 sibling, 0 replies; 3+ messages in thread
From: Chung-Ju Wu @ 2013-12-14 3:59 UTC (permalink / raw)
To: Michael Weise; +Cc: gcc-help
On 11/15/13, 5:26 PM, Michael Weise wrote:
> Hi,
>
> yesterday I've been facing a strange problem with some inline asm
> code (see below), emitting errors like these:
> (gcc 4.7.3, targetting m68k-elf, Windows 7/64, msys):
>
[snip]
>
> asm volatile (
> " move.l %[in1],%%a0 \n" // asm code
> " move.l %[in2],%%A1 \n"
> " trap #8 \n"
> " move.b %%D0,%[out1]\n"
> " move.b %%d1,%[out2]\n"
> :[out1] "=m" (*pc1), // output
> [out2] "=m" (*pc2)
> :[in1] "r" (cmdadr), // input
> [in2] "r" (DUMRadr)
> :"%a0","%A1","%d0","%D1", // clobber list
> "memory","%CC"
> );
>
> Results in:
> rs232_2.c:2433:2: error: unknown register name '%CC' in 'asm'
> rs232_2.c:2433:2: error: unknown register name '%D1' in 'asm'
> rs232_2.c:2433:2: error: unknown register name '%A1' in 'asm'
>
Hi, Michael,
If you build m68k-elf on your own, you can implement
ADDITIONAL_REGISTER_NAMES in gcc/config/m68k/m68k.h to
define alias register names with upper case.
This can help gcc recognize them. :)
Best regards,
jasonwucj
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-14 3:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 9:27 Inline asm - only clobber list case sensitive? Michael Weise
2013-11-15 9:33 ` Andrew Haley
2013-12-14 3:59 ` Chung-Ju Wu
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).