re PR target/85667 (ms_abi rules aren't followed when returning short structs with float values)

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.

From-SVN: r266355
This commit is contained in:
Lokesh Janghel 2018-11-21 20:09:56 +00:00 committed by Uros Bizjak
parent 99b5ace469
commit c339a8985d
7 changed files with 110 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2018-11-21 Lokesh Janghel <lokeshjanghel91@gmail.com>
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.
2018-11-21 Jan Hubicka <jh@suse.cz>
PR lto/87957

View File

@ -9005,11 +9005,6 @@ function_value_ms_64 (machine_mode orig_mode, machine_mode mode,
&& !COMPLEX_MODE_P (mode))
regno = FIRST_SSE_REG;
break;
case 8:
case 4:
if (mode == SFmode || mode == DFmode)
regno = FIRST_SSE_REG;
break;
default:
break;
}

View File

@ -1,3 +1,11 @@
018-11-21 Lokesh Janghel <lokeshjanghel91@gmail.com>
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.
2018-11-21 Jan Hubicka <hubicka@ucw.cz>
PR lto/87957

View File

@ -0,0 +1,33 @@
/* { dg-do run { target lp64 } } */
/* { dg-options "-O2" } */
void abort (void);
typedef struct
{
float x;
} Float;
Float __attribute__((ms_abi)) fn1 ()
{
Float v;
v.x = 3.145;
return v;
}
Float fn2 ()
{
Float v;
v.x = 3.145;
return v;
}
int main ()
{
Float a, b;
a = fn1 ();
b = fn2 ();
if (a.x == 3.145f && b.x == 3.145f)
return 0;
abort ();
}

View File

@ -0,0 +1,15 @@
/* { dg-do compile { target lp64 } } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-times "movl\[^\n\r]*, %eax|mov\[ \t]*eax," 1 } } */
typedef struct
{
float x;
} Float;
Float __attribute__((ms_abi)) fn1 ()
{
Float v;
v.x = 3.145;
return v;
}

View File

@ -0,0 +1,33 @@
/* { dg-do run { target lp64 } } */
/* { dg-options "-O2" } */
void abort (void);
typedef struct
{
double x;
} Double;
Double __attribute__((ms_abi)) fn1 ()
{
Double v;
v.x = 3.145;
return v;
}
Double fn2 ()
{
Double v;
v.x = 3.145;
return v;
}
int main ()
{
Double a, b;
a = fn1 ();
b = fn2 ();
if (a.x == 3.145 && b.x == 3.145)
return 0;
abort ();
}

View File

@ -0,0 +1,15 @@
/* { dg-do compile { target lp64 } } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-times "movq\[^\n\r]*, %rax|mov\[ \t]*rax," 1 } } */
typedef struct
{
double x;
} Double;
Double __attribute__((ms_abi)) fn1 ()
{
Double v;
v.x = 3.145;
return v;
}