[Issue 6505] Wrong code for expression involving 8 floats, only with -O
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 16 06:37:52 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6505
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #1 from bearophile_hugs at eml.cc 2011-08-16 06:37:50 PDT ---
Simplified a little:
double foo() {
return 1.0;
}
void main() {
double a = foo();
double b = foo();
double x = a*a + a*a + a*a + a*a + a*a + a*a + a*a +
a*b + a*b;
assert(x > 0);
}
---------------------------
Asm normal compilation:
_D4test3fooFZd comdat
fld1
ret
__Dmain comdat
L0: enter 024h,0
call near ptr _D4test3fooFZd
fstp qword ptr -018h[EBP]
call near ptr _D4test3fooFZd
fstp qword ptr -010h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -010h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -010h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -018h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -018h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -018h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -018h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -018h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -018h[EBP]
fdecstp
fstp qword ptr -024h[EBP]
fld qword ptr -018h[EBP]
fmul qword ptr -018h[EBP]
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
fld qword ptr -024h[EBP]
faddp ST(1),ST
fstp qword ptr -8[EBP]
fld qword ptr -8[EBP]
ftst
fstsw AX
sahf
fstp ST
ja L7B
mov EAX,9
call near ptr _D4test8__assertFiZv
L7B: xor EAX,EAX
leave
ret
----------------------------
Asm compilation with -O:
_D4test3fooFZd comdat
fld qword ptr FLAT:_DATA[00h]
ret
__Dmain comdat
L0: sub ESP,034h
call near ptr _D4test3fooFZd
fstp qword ptr 0Ch[ESP]
call near ptr _D4test3fooFZd
fld qword ptr 0Ch[ESP]
fld qword ptr 0Ch[ESP]
fxch ST2
fstp qword ptr 014h[ESP]
fmul qword ptr 014h[ESP]
fxch ST1
fld qword ptr 0Ch[ESP]
fxch ST1
fmul qword ptr 014h[ESP]
fxch ST1
fmul ST,ST(0)
fld qword ptr 0Ch[ESP]
fmul ST,ST(0)
fld qword ptr 0Ch[ESP]
fmul ST,ST(0)
fld qword ptr 0Ch[ESP]
fmul ST,ST(0)
fld qword ptr 0Ch[ESP]
fmul ST,ST(0)
fld qword ptr 0Ch[ESP]
fmul ST,ST(0)
fdecstp
fld qword ptr 0Ch[ESP]
fxch ST1
fstp qword ptr [ESP]
fmul ST,ST(0)
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
faddp ST(1),ST
fld qword ptr [ESP]
faddp ST(1),ST
ftst
fstsw AX
fstp ST
sahf
ja L84
mov EAX,9
call near ptr _D4test8__assertFiZv
L84 add ESP,034h
xor EAX,EAX
ret
------------------------
--
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