D-Programming-Language/dmd — pull request #769 by yebblies (2012-02-26 16:26:01+00:00)
Title: Floating point and xmm codegen

Starting with 4155, every time I fixed one bug I ran into another while testing it.

4155 - jmpopcode assumes that <80bit floating point types are converted to bool by moving them into integer registers and doubling, but this is not the case when they're returned from a function on the floating point stack or in xmm registers.

7581 - fixresult_complex87 treats cfloat and cdouble _exactly_ the same. This means a trying to return a cfloat in an xmm reg which is on the floating point stack results the value getting written to memory as a double, read into xmm as a double, then returned to code expecting the xmm regs to hold a float.

7591 - The backend constfolding code for complex ==/!= incorrectly inverts the result if either operand contains nans. Using the built-in comparison generates the correct result.

7592 - e2ir contains a typo which makes it use the wrong op for casting from ireal -> ifloat via idouble

7593 - cdcnvt takes the wrong path when converting cfloat to cdouble, because the check to see if dealing with complex types is after the check for using xmm regs

7594 - Code generation for real+imaginary,imaginary+real,real-imaginary and
imaginary-real is done by xmmorth, which implements it the same as real+real,
resulting in very wrong code.

http://d.puremagic.com/issues/show_bug.cgi?id=4155
http://d.puremagic.com/issues/show_bug.cgi?id=7581
http://d.puremagic.com/issues/show_bug.cgi?id=7591
http://d.puremagic.com/issues/show_bug.cgi?id=7592
http://d.puremagic.com/issues/show_bug.cgi?id=7593
http://d.puremagic.com/issues/show_bug.cgi?id=7594