[Bug c/42522] [m68k] Wrong code generated with -O2/-O3
nospamname at web dot de
gcc-bugzilla@gcc.gnu.org
Thu Dec 31 13:35:00 GMT 2009
------- Comment #9 from nospamname at web dot de 2009-12-31 13:35 -------
I compile now with a m68k-elf Compiler and do the small testcode i post
above.The Problem is same on m68k-elf Compiler too.
other CPU as -m68000 fail with -O3 or -O2
So can this Report Reopen and maybe another can check please ?
Andreas have not write with what CPU Setting he get the WORKSFORME Result.
Here is the Output
m68k-elf-gcc.exe -c wb2.c -o "Default Profile/wb2.o"
-I"E:/amiga/AmiDevCpp/bernd/clib2/" -m68020-60 -v -S -O3
Using built-in specs.
COLLECT_GCC=/usr/local/amiga/bin/m68k-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/amiga/bin/../libexec/gcc/m68k-elf/4.5.0/lto-wrapper.exe
Target: m68k-elf
Configured with: /bernd/gcc4/configure --target=m68k-elf
Thread model: single
gcc version 4.5.0 20091224 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-c' '-o' 'Default Profile/wb2.o'
'-IE:/amiga/AmiDevCpp/bernd/clib2/' '-m68020-60' '-v' '-S' '-O3'
...
GNU C (GCC) version 4.5.0 20091224 (experimental) (m68k-elf)
compiled by GNU C version 4.3.4 20090804 (release) 1, GMP version
4.2.3, MPFR
and teh Result of -S is this
#NO_APP
.file "wb2.c"
.section .rodata
.LC0:
.string "%ld\n"
.text
.align 2
.globl main
.type main, @function
main:
move.l %fp,-(%sp)
move.l %sp,%fp
clr.l 12(%fp)
move.l #.LC0,8(%fp)
unlk %fp
jra printf
.size main, .-main
.ident "GCC: (GNU) 4.5.0 20091224 (experimental)"
---------------------------
COLLECT_GCC_OPTIONS='-c' '-o' 'Default Profile/wb2.o'
'-IE:/amiga/AmiDevCpp/bernd/clib2/' '-m68000' '-v' '-S' '-O3'
with CPU m68000 or -O1 or -O0 this work ok.
#NO_APP
.file "wb2.c"
.section .rodata
.LC0:
.string "%ld\n"
.text
.align 2
.globl main
.type main, @function
main:
link.w %fp,#0
move.l 8(%fp),%a0
move.l 4(%a0),%a0
cmp.b #70,(%a0)
jeq .L10
.L7:
moveq #0,%d0
move.l %d0,12(%fp)
move.l #.LC0,8(%fp)
unlk %fp
jra printf
.L10:
cmp.b #76,1(%a0)
jne .L7
cmp.b #86,2(%a0)
jne .L7
cmp.b #4,3(%a0)
jhi .L7
tst.b 5(%a0)
jne .L7
moveq #0,%d1
move.b 6(%a0),%d1
swap %d1
clr.w %d1
moveq #0,%d0
move.b 7(%a0),%d0
lsl.l #8,%d0
or.l %d1,%d0
or.b 8(%a0),%d0
moveq #8,%d1
cmp.l %d0,%d1
jcc .L7
moveq #100,%d0
move.l %d0,12(%fp)
move.l #.LC0,8(%fp)
unlk %fp
jra printf
.size main, .-main
.ident "GCC: (GNU) 4.5.0 20091224 (experimental)"
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42522
More information about the Gcc-bugs
mailing list