[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values

2019-01-07 Thread mateuszb at poczta dot onet.pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85667

--- Comment #6 from mateuszb at poczta dot onet.pl ---
Now it is fixed for 64-bit GCC 9.
For 32-bit GCC 9 it is not fixed (return goes to st(0)).

[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values

2018-12-19 Thread lokeshjanghel91 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85667

--- Comment #5 from Lokesh Janghel  ---
>>I think we should check if type is aggregate before we return in eax and 
leave xmm0 for float and double.
>>break;
>>+ case 8:
>>+ case 4:
>>+   if (valtype != NULL_TREE && AGGREGATE_TYPE_P (valtype))
>>+ break;
>>+   if (mode == SFmode || mode == DFmode)
>>+ regno = FIRST_SSE_REG;
>>+   break;

It is working in both targets (x86_64 & mingw-w64). I tested in both targets.

[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values

2018-12-19 Thread mateuszb at poczta dot onet.pl
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;
 }

[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values

2018-12-04 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85667

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
So fixed?

[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values

2018-11-21 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85667

--- Comment #2 from uros at gcc dot gnu.org ---
Author: uros
Date: Wed Nov 21 20:09:56 2018
New Revision: 266355

URL: https://gcc.gnu.org/viewcvs?rev=266355=gcc=rev
Log:
PR target/85667
* config/i386/i386.c (function_value_ms_64): Return AX_REG instead
of FIRST_SSE_REG for 4 or 8 byte modes.

testsuite/ChangeLog:

PR target/85667
* gcc.target/pr85667-1.c: New testcase.
* gcc.target/pr85667-2.c: New testcase.
* gcc.target/pr85667-3.c: New testcase.
* gcc.target/pr85667-4.c: New testcase.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr85667-1.c
trunk/gcc/testsuite/gcc.target/i386/pr85667-2.c
trunk/gcc/testsuite/gcc.target/i386/pr85667-3.c
trunk/gcc/testsuite/gcc.target/i386/pr85667-4.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog

[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values

2018-10-17 Thread vinay.m.engg at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85667

Vinay Kumar  changed:

   What|Removed |Added

 CC||vinay.m.engg at gmail dot com

--- Comment #1 from Vinay Kumar  ---
Hi,

The current exists in latest trunk sources also. Please let me know is there
any progress on this.

Regards,
Vinay

[Bug target/85667] (x86_64) ms_abi rules aren't followed when returning short structs with float values

2018-05-05 Thread green at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85667

Anthony Green  changed:

   What|Removed |Added

 Target||x86_64-pc-linux-gnu
   Priority|P3  |P2