[Issue 2888] New: [PATCH] float * 2.0 is unnecessarily slow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 24 13:11:40 PDT 2009


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 at digitalmars.com
        ReportedBy: clugdbug at 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.


-- 



More information about the Digitalmars-d-bugs mailing list