www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2888] New: [PATCH] float * 2.0 is unnecessarily slow

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2888

           Summary: [PATCH] float * 2.0 is unnecessarily slow
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: patch, performance
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: clugdbug yahoo.com.au


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.


-- 
Apr 24 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2888






Created an attachment (id=338)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=338&action=view)
Patch against DMD2.029

This will be a useful step towards further optimisation of pure functions with
real return values.


-- 
Apr 24 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2888


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
            Summary|[PATCH] float * 2.0 is      |[PATCH] speedup for float *
                   |unnecessarily slow          |2.0





Renaming this issue to be less negative


-- 
Apr 27 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2888


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





02:48:31 PDT ---
Fixed dmd 1.046 and 2.031

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