[Bug target/35018] [m68k-elf] Gcc ouputs invalid asm when compiling with -O2 or higher
--- Comment #3 from nizze86 at hotmail dot com 2008-10-26 11:25 --- Created an attachment (id=16551) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16551&action=view) Reduced testcase A reduced testcase derived from the preprocessed sources. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35018
[Bug target/35018] [m68k-elf] Gcc ouputs invalid asm when compiling with -O2 or higher
--- Comment #4 from nizze86 at hotmail dot com 2008-10-26 11:28 --- (In reply to comment #3) > Created an attachment (id=16551) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16551&action=view) [edit] > Reduced testcase > > A reduced testcase derived from the preprocessed sources. > compiled with: m68k-elf-gcc -mcpu=5249 testcase.c -O2 -o testcase.o using gcc 4.3.1 with configuration: --target=m68k-elf --prefix=/usr/local/m68k-elf --enable-languages=c --disable-ibssp --with-arch=cf -- nizze86 at hotmail dot com changed: What|Removed |Added CC| |nizze86 at hotmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35018
[Bug c/35018] New: [m68k-elf] Gcc ouputs invalid asm when compiling with -O2 or higher
Using gcc version 4.3.0 20080125 (experimental) (GCC) to crosscompile the attached file for m68k-elf, I get the following line of asm: move.l (%a2,%a0.l*4),76(%sp) which is invalid for the target cpu I have specified. (-mcpu=5249) This is my compiler command line: /rockbox/apps/codecs/Tremor$ /usr/bin/ccache m68k-elf-gcc -I/home/nils/rockbox/apps -I.. -I. -I/home/nils/rockbox/firmware/include -I/home/nils/rockbox/firmware/export -I/home/nils/rockbox/firmware/common -I/home/nils/rockbox/firmware/drivers -I/home/nils/rockbox/gcctest -I/home/nils/rockbox/apps/recorder -I/home/nils/rockbox/apps/gui -W -Wall -Wundef -Os -nostdlib -ffreestanding -Wstrict-prototypes -mcpu=5249 -malign-int -mstrict-align -fomit-frame-pointer -I/home/nils/rockbox/firmware/target/coldfire/iriver/h300 -I/home/nils/rockbox/firmware/target/coldfire/iriver -I/home/nils/rockbox/firmware/target/coldfire -O2 -DIRIVER_H300 -DMEM=32 -save-temps block.c -o /home/nils/rockbox/gcctest/apps/codecs/Tremor/block.o I used the following switches to configure gcc: --target=m68k-elf --prefix=/usr/local/m68k-elf --enable-languages=c --disable-libssp --with-arch=cf on my amd64 linux system -- Summary: [m68k-elf] Gcc ouputs invalid asm when compiling with - O2 or higher Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nizze86 at hotmail dot com GCC host triplet: Linux amd 64 GCC target triplet: m68k-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35018
[Bug c/35018] [m68k-elf] Gcc ouputs invalid asm when compiling with -O2 or higher
--- Comment #1 from nizze86 at hotmail dot com 2008-01-29 15:36 --- Created an attachment (id=15048) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15048&action=view) Preprocessed sources -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35018
[Bug target/43675] New: [m68k] Wrong code due to missing sign extension
When compiling the following function for a coldfire target, such as mcf5249: (using the following command line: m68k-elf-gcc saturate.c -mcpu=5249 -O1 -S) int saturate(int x) { return (x == (short)x ? x : (x >> 31) ^ 0x7FFF); } gcc produces: saturate: link.w %fp,#0 move.l 8(%fp),%d0 move.w %d0,%a0 cmp.l %a0,%d0 jeq .L2 add.l %d0,%d0 subx.l %d0,%d0 eor.l #32767,%d0 .L2: unlk %fp rts Where a0 is compared to d0 without a sign extension so the upper half of a0 remtains whatever was already there. This is with gcc: 4.5.0 20100401 (experimental) (GCC) configured with: --target=m68k-elf --prefix=/usr/local --enable-languages=c --disable-libssp --with-arch=cf --with-cpu=5249 Also observed with gcc 3.4.6 so likely not a regression. -- Summary: [m68k] Wrong code due to missing sign extension Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nizze86 at hotmail dot com GCC target triplet: m68k-elf-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43675
[Bug target/43676] New: [m68k] Wrong code due to missing sign extension
When compiling the following function for a coldfire target, such as mcf5249: (using the following command line: m68k-elf-gcc saturate.c -mcpu=5249 -O1 -S) int saturate(int x) { return (x == (short)x ? x : (x >> 31) ^ 0x7FFF); } gcc produces: saturate: link.w %fp,#0 move.l 8(%fp),%d0 move.w %d0,%a0 cmp.l %a0,%d0 jeq .L2 add.l %d0,%d0 subx.l %d0,%d0 eor.l #32767,%d0 .L2: unlk %fp rts Where a0 is compared to d0 without a sign extension so the upper half of a0 remtains whatever was already there. This is with gcc: 4.5.0 20100401 (experimental) (GCC) configured with: --target=m68k-elf --prefix=/usr/local --enable-languages=c --disable-libssp --with-arch=cf --with-cpu=5249 Also observed with gcc 3.4.6 so likely not a regression. -- Summary: [m68k] Wrong code due to missing sign extension Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nizze86 at hotmail dot com GCC target triplet: m68k-elf-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43676
[Bug target/43675] [m68k] Wrong code due to missing sign extension
--- Comment #3 from nizze86 at hotmail dot com 2010-04-07 15:42 --- I am sorry, it appears i am mistaken, since the dest is an address reg, movea is used which apparently *does* sign extend word size source to 32 bits while a move to a d reg does not. Again sorry for the noise. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43675
[Bug target/42516] New: [m68k] Suboptimal halfword swap on coldfire
When compiling the following function for a coldfire target, such as mcf5249: (using the following command line m68k-elf-gcc hswap.c -mcpu=5249 -S -O2) unsigned hswap(unsigned x) { return (x << 16) | (x >> 16); } gcc produces: hswap: link.w %fp,#0 move.l 8(%fp),%d1 move.l %d1,%d0 clr.w %d0 swap %d0 swap %d1 clr.w %d1 or.l %d1,%d0 unlk %fp rts Optimization level affects only instr ordering. the same function compiled for 68020 (using the following command line m68k-elf-gcc hswap.c -mcpu=68020 -S -O2) hswap: link.w %fp,#0 move.l 8(%fp),%d0 swap %d0 unlk %fp rts which is valid code for the coldfire target too and much smaller and faster this is using gcc 4.4.2 configured with --enable-languages=c --disable-libssp --with-arch=cf --with-cpu=5249 the same behaviour is present in gcc 3.4.6 too. -- Summary: [m68k] Suboptimal halfword swap on coldfire Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nizze86 at hotmail dot com GCC host triplet: amd64-unknown-linux GCC target triplet: m68k-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42516