[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values
mateuszb at poczta dot onet.pl
gcc-bugzilla@gcc.gnu.org
Wed Dec 19 23:18:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85667
mateuszb at poczta dot onet.pl changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mateuszb at poczta dot onet.pl
--- Comment #4 from mateuszb at poczta dot onet.pl ---
Now gcc 9 is heavily broken for mingw-w64 target -- so it is not fixed.
Functions that returns float or double should return in xmm0 (not eax).
In gcc-9 source code there are some hints:
gcc/config/i386/cygming.h from line #400:
/* MSVC returns aggregate types of up to 8 bytes via registers.
See i386.c:ix86_return_in_memory. */
#undef MS_AGGREGATE_RETURN
#define MS_AGGREGATE_RETURN 1
I think we should check if type is aggregate before we return in eax and leave
xmm0 for float and double, for example:
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 267268)
+++ gcc/config/i386/i386.c (working copy)
@@ -9063,6 +9063,13 @@
&& !COMPLEX_MODE_P (mode))
regno = FIRST_SSE_REG;
break;
+ case 8:
+ case 4:
+ if (valtype != NULL_TREE && AGGREGATE_TYPE_P (valtype))
+ break;
+ if (mode == SFmode || mode == DFmode)
+ regno = FIRST_SSE_REG;
+ break;
default:
break;
}
More information about the Gcc-bugs
mailing list