www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5885] New: wrong codegen for OPu32_d

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

           Summary: wrong codegen for OPu32_d
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



Created an attachment (id=948)
patch

struct Value {
  uint a, b;
}

double mul(Value val, double fac) {
  return val.a * fac;
}

int main() {
  auto a = mul(Value(10), 10.0); // seems to work as val.b == 0
  auto b = mul(Value(10, 20), 10.0); // loads the 20 in the fpu
  return a == b ? 0 : 1;
}

--

What happens is that the complete rdi register gets pushed and a 64 bit integer
is loaded from that address to the FPU. Maybe I'm missing something but loading
an 32 bit simplifies even the 32-bit code. See attached patch.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 25 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5885


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------

           obsolete|                            |



Created an attachment (id=988)
new fix

The proposed patch was wrong. FILD m64int needs to be used as there are no
unsigned->fpu load instructions. The new patch explicitly zeros the upper 4
bytes.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 21 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5885


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



15:00:31 PDT ---
https://github.com/D-Programming-Language/dmd/commit/64a24b9276fd45c3040b5c726452a28add714cb7

https://github.com/D-Programming-Language/dmd/commit/bb40a40b6f804614ffc76ec79e10e7e1881b4c38

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 28 2011