[Issue 4380] New: Poor optimisation of x*x, where x is real
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 24 03:02:47 PDT 2010
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: nobody at puremagic.com
ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at 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: -------
More information about the Digitalmars-d-bugs
mailing list