Subject: Re: assembler syntax
To: None <port-m68k@netbsd.org>
From: Aaron J. Grier <agrier@poofygoof.com>
List: port-m68k
Date: 06/29/2002 23:30:09
On Sun, Jun 30, 2002 at 06:25:56AM +0200, Klaus Heinz wrote:

> and 'as' complains about:
> 
>   /tmp/cc1Pws5c.s:41: Error: syntax error -- statement `movel a0@(d1),%d2' ignored
> 
> 
> From what I have found, I think every register name should be preceded by
> a '%' (%% in the C source file).

you could do that, or pass the --register-prefix-optional argument to
the assembler.

> Without the % in front of the register names, 'as' translates the above
> (according to objdump) to:
> 
>   10:   23c2 0000 0000  movel %d2,0 <vgar>
>   16:   23c3 0000 0000  movel %d3,0 <vgar>
>   1c:   2430 0170 0000  movel %a0@(00000000),%d2
> 
> which seems not to be the intended output:
> 
>   10:   2042            moveal %d2,%a0
>   12:   2203            movel %d3,%d1
>   14:   2430 1800       movel %a0@(00000000,%d1:l),%d2
> 
> 
> Can someone confirm this?

your assumptions appear correct.

> As the cvs log tells me this functions's file was last modified in
> 1997, I suppose there has been some change in assembler syntax since
> then?

it's possible the assembler default changed to require register prefixes
since then.  I have not been hacking m68k for that long, so do not know
for sure.  :)

> Can anyone tell me where to find more information about the changes?
> I fear there will be some more places which need to be changed.

for -current gcc, all inline assembly statements will need to be
re-worked:

volatile asm("movel %%a0, %%d0
	rorl %%a0;");

would need to be changed to

volatile asm("movel %%a0, %%d0;"
	"rorl %%a0;");

the new required syntax is still accepted by older versions of gcc.
(I just went through this with a project at work...)  I do not know the
reason for the change.

-- 
  Aaron J. Grier | "Not your ordinary poofy goof." | agrier@poofygoof.com