[Issue 21526] New: x87 not rounding to precision on assignment on some platforms
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 5 09:45:28 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21526
Issue ID: 21526
Summary: x87 not rounding to precision on assignment on some
platforms
Product: D
Version: D2
Hardware: x86
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bugzilla at digitalmars.com
For the code:
float f(float a, float b)
{
float c = a + b;
float d = c - b;
return d;
}
When compiling with -m32 -O, on Windows c is stored to memory rounding it to
float precision. This is correct.
push EAX
push EAX
fld float ptr 010h[ESP]
fadd float ptr 0Ch[ESP]
fstp float ptr [ESP] // store
fld float ptr [ESP] // reload
fsub float ptr 0Ch[ESP]
fstp float ptr 4[ESP]
fld float ptr 4[ESP]
add ESP,8
ret 8
On Linux, it does not, which is incorrect.
fld float ptr 8[ESP]
fadd float ptr 4[ESP]
fsub float ptr 4[ESP]
ret 8
--
More information about the Digitalmars-d-bugs
mailing list