[Issue 4380] Poor optimisation of x*x, where x is real

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 17 21:02:47 PDT 2013


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


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies at gmail.com


--- Comment #2 from yebblies <yebblies at gmail.com> 2013-08-18 14:02:45 EST ---
In cg87, line 1661 (load87) it has this code:

if ((ty == TYldouble || ty == TYildouble) &&
    op != -1 && e->Eoper != OPd_ld)
    goto Ldefault;

op is 0 here (OPvar), and ty == TYldouble, so all the normal var cse checking
is skipped.


Down at 1887, we have

#if 1           /* Do this instead of codelem() to avoid the freenode(e).
                   We also lose CSE capability  */
                if (e->Eoper == OPconst)
                {
                    c = load87(e, 0, &retregs, NULL, -1);
                }
                else
                    c = (*cdxxx[e->Eoper])(e,&retregs);
#else
                c = codelem(e,&retregs,FALSE);
#endif

So it looks like this was intentional to avoid some kind of compiler internal
bug.  Removing both conditions results in the correct code, but who knows what
else it breaks.

-- 
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