Bug 27946 - double to long long and back to double stores to the stack
Summary: double to long long and back to double stores to the stack
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: 4.4.0
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: missed-optimization, patch, ra
Depends on: 18427
Blocks: 4.4pending
  Show dependency treegraph
 
Reported: 2006-06-08 04:54 UTC by Andrew Pinski
Modified: 2008-03-21 22:18 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-07-02 21:29:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2006-06-08 04:54:07 UTC
Testcase:
void f(double a, double *b)
{
  long long c = a;
  *b = c;
}

-----
We currently get:
_f:
        fctidz f1,f1
        fcfid f0,f1
        stfd f1,-16(r1) ; <--- not needed
        stfd f0,0(r4)
        blr

--------
On the Yara branch we get:
        fctidz f0,f1
        fcfid f0,f0
        stfd f0,0(r4)
        blr

So this is a RA issue, I am recording this to make sure that the next ra that goes in as default actually fixes it.
Comment 1 Andrew Pinski 2006-06-23 01:41:49 UTC
*** Bug 26525 has been marked as a duplicate of this bug. ***
Comment 2 Andrew Pinski 2006-06-23 01:42:05 UTC
Confirmed.
Comment 3 Andrew Pinski 2007-10-23 17:24:18 UTC
Ok, changing the constraint to "!f#r" fixes the problem without a performance issue so I am going to test it.
Comment 4 David Edelsohn 2007-10-23 17:34:02 UTC
It might be appropriate for both fix_truncdfdi2 and floatdidf2.
Comment 5 Andrew Pinski 2007-10-23 17:35:56 UTC
(In reply to comment #4)
> It might be appropriate for both fix_truncdfdi2 and floatdidf2.

That is exactly what I am testing.  I ran the benchmarks which I have for the PS3 toolchain and there was no performance regressions.
Comment 6 David Edelsohn 2007-10-23 17:40:33 UTC
What about *f#r ?
Comment 7 Andrew Pinski 2007-10-23 17:58:56 UTC
(In reply to comment #6)
> What about *f#r ?

Well that says don't consider f for the register class chosing at all and does not fix the issue as it still choses the GPR register class.
Comment 8 Andrew Pinski 2008-03-21 22:18:56 UTC
Fixed.
Comment 9 Andrew Pinski 2008-03-21 22:19:02 UTC
Subject: Bug 27946

Author: pinskia
Date: Fri Mar 21 22:18:23 2008
New Revision: 133439

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133439
Log:
2008-03-21  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR target/27946
        * config/rs6000/rs6000.md (floatdidf2): Discouraging fprs and
        encouraging but not allowing gprs for input;
        change the input constraint to !f#r.
        (fix_truncdfdi2): Discouraging fprs and encouraging but not allowing
        gprs for output;
        change the output constraint to !f#r.


2008-03-21  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR target/27946
        * gcc.target/powerpc/ppc64-double-1.c: New testcase.



Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog