public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/44364]  New: Wrong code with e500 double floating point
@ 2010-06-01 13:42 gcc at breakpoint dot cc
  2010-06-01 13:42 ` [Bug rtl-optimization/44364] " gcc at breakpoint dot cc
                   ` (48 more replies)
  0 siblings, 49 replies; 50+ messages in thread
From: gcc at breakpoint dot cc @ 2010-06-01 13:42 UTC (permalink / raw)
  To: gcc-bugs

The testcase (which is stripped down perl code) attached compiled with:
gcc -fPIC -fno-strict-aliasing -pipe \
         -O2 \
         -g -o tc-lossings-floats tc-lossings-floats.c -Wall -mno-isel

results in after executing:
|RESET: 252.000000 | 0.000000
|RESET: 504.000000 | 252.000000
|RESET: 756.000000 | 504.000000
|RESET: 1008.000000 | 756.000000
|RESET: 1260.000000 | 1008.000000
|RESET: 1512.000000 | 1260.000000
|RESET: 1764.000000 | 1512.000000
|RESET: 2016.000000 | 1764.000000
|RESET: 2268.000000 | 2016.000000
 => 2268.000000
|RESET: 2520.000000 | 0.000000
|RESET: 2772.000000 | 2520.000000

With -O1 instead -O2:
|RESET: 252.000000 | 0.000000
|RESET: 504.000000 | 252.000000
|RESET: 756.000000 | 504.000000
|RESET: 1008.000000 | 756.000000
|RESET: 1260.000000 | 1008.000000
|RESET: 1512.000000 | 1260.000000
|RESET: 1764.000000 | 1512.000000
|RESET: 2016.000000 | 1764.000000
|RESET: 2268.000000 | 2016.000000
 => 2268.000000
|RESET: 2520.000000 | 2268.000000
|RESET: 2772.000000 | 2520.000000

The "=>" line sets the the second value in the "|RESET" line. With -O1 is
remains where it is, with -O2 it gets overwritten. The original perl code gets
here a totally random values. 

Now. It is getting better. The source compiled with -S and the resulting
assembly file assembled with gcc-4.3 does not show this problem. After diffing
of the two resulting binaries I saw  a difference in __floatdidf() which is
called from Kino_OutStream_tell(). The variant which is attached by the 4.3
compiler does not use floating point instead it uses integer code which calls
other functions (__floatsidf, __muldf3, __floatunsidf, __adddf3) which use also
interger code. The 4.3 compiler was not compiled with --enable-e500_double. 

So after looking at the code I saw now the following:
10000c24 <__floatdidf>:
10000c6c:       11 23 1a 2c     evmergehi r9,r3,r3

This function is touching the complete 64bit r9 register
The code which calls it:

10000a40:       91 21 00 20     stw     r9,32(r1)
10000a44:       4e 80 04 21     bctrl   # tell function which in turn calls
floatdidf

10000a7c:       81 21 00 20     lwz     r9,32(r1)
10000a80:       38 60 00 00     li      r3,0    
10000a84:       7e 33 8b 78     mr      r19,r17 
10000a88:       12 49 92 e1     efdsub  r18,r9,r18
10000a8c:       10 80 92 fa     efdctsiz r4,r18
10000a90:       12 49 4a 17     evmr    r18,r9  

So we just save the lower 32bit of r9 before calling the function and the upper
32bit are overwritten by efdsub.


-- 
           Summary: Wrong code with e500 double floating point
           Product: gcc
           Version: 4.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at breakpoint dot cc
 GCC build triplet: powerpc-linux-gnuspe
  GCC host triplet: powerpc-linux-gnuspe
GCC target triplet: powerpc-linux-gnuspe


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44364


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

end of thread, other threads:[~2010-06-28 11:19 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-01 13:42 [Bug rtl-optimization/44364] New: Wrong code with e500 double floating point gcc at breakpoint dot cc
2010-06-01 13:42 ` [Bug rtl-optimization/44364] " gcc at breakpoint dot cc
2010-06-01 13:43 ` gcc at breakpoint dot cc
2010-06-03 19:26 ` [Bug target/44364] " Kyle dot D dot Moffett at boeing dot com
2010-06-03 20:09 ` Kyle dot D dot Moffett at boeing dot com
2010-06-03 20:17 ` gcc at breakpoint dot cc
2010-06-03 20:21 ` Kyle dot D dot Moffett at boeing dot com
2010-06-03 20:22 ` Kyle dot D dot Moffett at boeing dot com
2010-06-03 20:22 ` Kyle dot D dot Moffett at boeing dot com
2010-06-03 20:23 ` Kyle dot D dot Moffett at boeing dot com
2010-06-03 20:26 ` Kyle dot D dot Moffett at boeing dot com
2010-06-03 20:26 ` Kyle dot D dot Moffett at boeing dot com
2010-06-03 23:18 ` Kyle dot D dot Moffett at boeing dot com
2010-06-04  1:37 ` Kyle dot D dot Moffett at boeing dot com
2010-06-04  1:37 ` Kyle dot D dot Moffett at boeing dot com
2010-06-04  2:17 ` Kyle dot D dot Moffett at boeing dot com
2010-06-04  2:17 ` Kyle dot D dot Moffett at boeing dot com
2010-06-04 17:24 ` Kyle dot D dot Moffett at boeing dot com
2010-06-04 17:24 ` Kyle dot D dot Moffett at boeing dot com
2010-06-06 14:11 ` amodra at gmail dot com
2010-06-06 14:52 ` amodra at gmail dot com
2010-06-06 15:37 ` Kyle dot D dot Moffett at boeing dot com
2010-06-07  4:42 ` amodra at gmail dot com
2010-06-07  5:36 ` Kyle dot D dot Moffett at boeing dot com
2010-06-07  5:44 ` Kyle dot D dot Moffett at boeing dot com
2010-06-07  9:53 ` amodra at gmail dot com
2010-06-07 10:30 ` amodra at gmail dot com
2010-06-07 12:49 ` Kyle dot D dot Moffett at boeing dot com
2010-06-07 17:06 ` amodra at gmail dot com
2010-06-07 18:28 ` Kyle dot D dot Moffett at boeing dot com
2010-06-07 18:56 ` Kyle dot D dot Moffett at boeing dot com
2010-06-08  4:24 ` Kyle dot D dot Moffett at boeing dot com
2010-06-08  5:08 ` Kyle dot D dot Moffett at boeing dot com
2010-06-08  6:48 ` Kyle dot D dot Moffett at boeing dot com
2010-06-08 11:24 ` gcc at breakpoint dot cc
2010-06-08 15:23 ` Kyle dot D dot Moffett at boeing dot com
2010-06-08 20:34 ` Kyle dot D dot Moffett at boeing dot com
2010-06-09  7:51 ` gcc at breakpoint dot cc
2010-06-09  7:54 ` gcc at breakpoint dot cc
2010-06-09  8:59 ` harry dot he at freescale dot com
2010-06-09  9:23 ` harry dot he at freescale dot com
2010-06-09 13:26 ` amodra at gmail dot com
2010-06-09 13:53 ` gcc at breakpoint dot cc
2010-06-09 14:07 ` mark dot workman at acm dot org
2010-06-10  9:03 ` harry dot he at freescale dot com
2010-06-10 17:43 ` mark dot workman at acm dot org
2010-06-11  1:09 ` harry dot he at freescale dot com
2010-06-21 15:56 ` Kyle dot D dot Moffett at boeing dot com
2010-06-22 10:44 ` amodra at gcc dot gnu dot org
2010-06-28 11:19 ` gcc at breakpoint dot cc

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).