http://d.puremagic.com/issues/show_bug.cgi?id=4380

           Summary: Poor optimisation of x*x, where x is real
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2010-06-24 03:02:44 PDT ---
// TEST CASE
int main(string[] args) {
    real x = args.length == 2 ? 6.0 : 4.0; // just to defeat the optimiser
    real y = x*x;
    return cast(int)y;  
}
----

With double x, produces:
                fstp    qword ptr [ESP] // store x
                fld     qword ptr [ESP]
                fmul    ST,ST(0)
Does the same for float x.

With real x, produces                
                fstp    tbyte ptr [ESP] // store x
                fld     tbyte ptr [ESP]
                fld     tbyte ptr [ESP] // Why is it loading this twice???
                fmulp   ST(1),ST

The last two lines should just be fmul ST, ST(0)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to