From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12325 invoked by alias); 3 Mar 2011 16:09:04 -0000 Received: (qmail 12315 invoked by uid 22791); 3 Mar 2011 16:09:02 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_LW X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Mar 2011 16:08:55 +0000 From: "m.lazzarotto at robox dot it" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/47977] New: powerpc (-mcpu=8548) Wrong code for double operations in little endian mode X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: m.lazzarotto at robox dot it X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 03 Mar 2011 16:09:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00312.txt.bz2 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"