This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/47977] New: powerpc (-mcpu=8548) Wrong code for double operations in little endian mode
- From: "m.lazzarotto at robox dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 3 Mar 2011 16:08:53 +0000
- Subject: [Bug c/47977] New: powerpc (-mcpu=8548) Wrong code for double operations in little endian mode
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47977
Summary: powerpc (-mcpu=8548) Wrong code for double operations
in little endian mode
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: m.lazzarotto@robox.it
* Output of gcc -v :
COLLECT_GCC=~/gcc-powerpc-4.5.2/bin/powerpc-eabi-gcc
COLLECT_LTO_WRAPPER=~/gcc-powerpc-4.5.2/libexec/gcc/powerpc-eabi/4.5.2/lto-wrapper
Target: powerpc-eabi
Configured with: ~/build-gcc-4.5/src/gcc-4.5.2/configure --prefix
~/gcc-powerpc-4.5.2 --with-local-prefix=~/gcc-powerpc-4.5.2
--enable-languages=c,c++ --target=powerpc-eabi --disable-threads --disable-tls
--disable-libmudflap --disable-libssp --disable-libgomp --with-gnu-ld
--enable-e500-double
Thread model: single
gcc version 4.5.2 (GCC)
* The program that triggers the bug :
[test_fp.c]
double test_fp(double val)
{
return val + val;
}
* Command line for big-endian :
~/gcc-powerpc-4.5.2/bin/powerpc-eabi-gcc-4.5.2 -c -mhard-float
-fomit-frame-pointer -fno-exceptions -Wall -Werror -fpack-struct=8 -G8
-mcpu=8548 -misel=yes -meabi -O2 -mno-strict-align -mno-multiple
-Wno-strict-aliasing -msdata=none -S -mbig test_fp.c -o test_fp-be.s
* Command line for little-endian :
~/gcc-powerpc-4.5.2/bin/powerpc-eabi-gcc-4.5.2 -c -mhard-float
-fomit-frame-pointer -fno-exceptions -Wall -Werror -fpack-struct=8 -G8
-mcpu=8548 -misel=yes -meabi -O2 -mno-strict-align -mno-multiple
-Wno-strict-aliasing -msdata=none -S -mlittle test_fp.c -o test_fp-le.s
* * * The output files, with comments:
$ cat test_fp-be-COMMMENTED.s
.file "test_fp.c"
.gnu_attribute 4, 2
.gnu_attribute 8, 1
.gnu_attribute 12, 1
.section ".text"
.align 2
.globl test_fp
.type test_fp, @function
test_fp:
stwu 1,-16(1)
efdadd 3,3,3 # val = val + val
lwz 9,8(1) # What's the purpose ?
lwz 10,12(1) # What's the purpose ?
evmergehi 9,3,3 # R9 = HIGH DWORD (correct in big
endian mode)
mr 10,3 # R10 = LOW DWORD (correct in big
endian mode)
stw 9,8(1) # What's the purpose ?
mr 3,9 # R3 = R9, HIGH dword correct (big
endian)
stw 10,12(1) # What's the purpose ?
mr 4,10 # R4 = R10, LOW dword correct (big
endian)
addi 1,1,16
blr # remarque: is there a way to exit with
a 64 bit register (f.i. R3) ?
.size test_fp, .-test_fp
.ident "GCC: (GNU) 4.5.2"
$ cat test_fp-le-COMMENTED.s
.file "test_fp.c"
.gnu_attribute 4, 2
.gnu_attribute 8, 1
.gnu_attribute 12, 1
.section ".text"
.align 2
.globl test_fp
.type test_fp, @function
test_fp:
stwu 1,-16(1)
efdadd 3,3,3 # val = val + val
lwz 9,8(1) # What's the purpose ?
lwz 10,12(1) # What's the purpose ?
evmergehi 9,3,3 # R9 = HIGH DWORD (error in little
endian mode???)
mr 10,3 # R10 = LOW DWORD (error in little
endian mode???)
stw 9,8(1) # What's the purpose ?
mr 3,9 # R3 = R9, LOW dword expected (little
endian) but R9 is HIGH dword!!!!
stw 10,12(1) # What's the purpose ?
mr 4,10 # R4 = R10, HIGH dword expected (little
endian) but R10 is LOW dword!!!
addi 1,1,16
blr # remarque: is there a way to exit with
a 64 bit register (f.i. R3) ?
.size test_fp, .-test_fp
.ident "GCC: (GNU) 4.5.2"