public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47977] New: powerpc (-mcpu=8548) Wrong code for double operations in little endian mode
@ 2011-03-03 16:09 m.lazzarotto at robox dot it
  2011-03-03 16:22 ` [Bug target/47977] " jsm28 at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: m.lazzarotto at robox dot it @ 2011-03-03 16:09 UTC (permalink / raw)
  To: gcc-bugs

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"


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-02 23:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 16:09 [Bug c/47977] New: powerpc (-mcpu=8548) Wrong code for double operations in little endian mode m.lazzarotto at robox dot it
2011-03-03 16:22 ` [Bug target/47977] " jsm28 at gcc dot gnu.org
2011-03-03 16:51 ` [Bug c/47977] " froydnj at codesourcery dot com
2011-03-04 13:11 ` m.lazzarotto at robox dot it
2011-03-04 15:35 ` [Bug target/47977] " joseph at codesourcery dot com
2020-06-02 23:50 ` segher at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).