This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: m68k-ColdFire(m5200) code gen bug


At 14:40 03.03.98 -0000, David Fiddes wrote:
>Hi,
>
>I've roughly isolated the following bit of code which generates invalid
>assembler when compiled for Motorola ColdFire and any optimisation level.
>
>short int MyFunc(char index1)
>  {
>    unsigned char AnArray[2];
>    short int param;
>
>    param = (AnArray[index1] << 4) | (AnArray[index1]);
>    return(param);
>  }
>
>is compiled with "m68k-coff-gcc -S -m5200 -O2 test.c" to:
>
>MyFunc:
> link.w %a6,#-4
> move.b 11(%a6),%d0
> extb.l %d0
> move.b -2(%a6,%d0.l),%d0
> and.w #0xFF,%d0  <--- invalid on ColdFire architecture
> move.l %d0,%d1
> lsl.l #4,%d1
> or.l %d1,%d0
> and.l #4095,%d0
> unlk %a6
> rts
>
>This was build using --target=m68k-coff compiler built from the EGCS source
>obtained via CVS on Monday morning(2/3/98) running under cygwin32 beta 19.
>
>When I try to assemble this file binutils-2.8.1.0.18 gives:
>
>G:\TEMP\cc001120.s: Assembler messages:
>G:\TEMP\cc001120.s:12: Error: invalid instruction for this architecture;
>needs 68000 or higher -- statement `and.w #0xFF,%d0' ignored
>
>Which I believe to be correct(although I don't have my ColdFire programmer's
>manual handy). John Adamson(adamson@enter.net) originally found the problem
>but on an older version of a compiler that I built.

binutils is correct, ColdFire only allows AND.L (long only).

Bye,
Franz.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]