Hi I think gcc-4.1.1 generates wrong outputs on coldfire v4 at this code. ----------------------------- struct ab { int a; unsigned int b; };
int main () { struct ab _ab; short a = 0; unsigned short b = 0; _ab.a = -999; _ab.b = 1000; a = _ab.a; b = _ab.b; printf("%d\n", a ); printf("%d\n", b ); return 0; } --------------------- ./xgcc -m5407 -S ./test.c --------------------- ... link.w %fp,#-8 mvzw #-999,%d0 <- zero extends(_ab.a) move.l %d0,-8(%fp) mvsw #1000,%d0 <- sign extends(_ab.b) move.l %d0,-4(%fp) move.l -8(%fp),%d0 move.l %d0,-(%sp) .... -------------------------------- and This is a patch. gcc/config/m68k/m68k.c: output_move_const_into_data_reg. --- m68k.bak 2006-06-15 19:49:00.000000000 +0900 +++ m68k.c 2006-06-15 19:49:42.000000000 +0900 @@ -1658,9 +1658,9 @@ switch (const_method (operands[1])) { case MVZ: - return "mvsw %1,%0"; - case MVS: return "mvzw %1,%0"; + case MVS: + return "mvsw %1,%0"; case MOVQ : return "moveq %1,%0"; case NOTB : -- Summary: [m68k]wrong move const extends output at coldfire v4 Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tyokota at k2 dot dion dot ne dot jp GCC build triplet: x86-64-elf-linux GCC host triplet: x86-64-elf-linux GCC target triplet: m68k-elf-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28040