Bug 2888 – [PATCH] speedup for float * 2.0

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-04-24T15:11:00Z
Last change time
2015-06-09T01:26:26Z
Keywords
patch, performance
Assigned to
bugzilla
Creator
clugdbug

Attachments

IDFilenameSummaryContent-TypeSize
338floatmul2.patchPatch against DMD2.029text/plain1219

Comments

Comment #0 by clugdbug — 2009-04-24T15:11:47Z
DMD generates slow code in simple situations such as: double foo(double x) { return x*2; } It creates a floating-point constant 2.0, and then generates an FMUL to multiply by it. It's particularly slow in the 80-bit real case, where two instructions (FLD and FMULP) are required. The attached patch generates the fast and simple FADD ST(0), ST; instead. It only applies to float,double, real, not to complex numbers.
Comment #1 by clugdbug — 2009-04-24T15:13:08Z
Created attachment 338 Patch against DMD2.029 This will be a useful step towards further optimisation of pure functions with real return values.
Comment #2 by clugdbug — 2009-04-27T04:36:33Z
Renaming this issue to be less negative
Comment #3 by bugzilla — 2009-07-09T02:48:31Z
Fixed dmd 1.046 and 2.031