Index: gcc/testsuite/gcc.target/i386/x87regparm-2.c =================================================================== --- gcc/testsuite/gcc.target/i386/x87regparm-2.c (revision 0) +++ gcc/testsuite/gcc.target/i386/x87regparm-2.c (revision 0) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mx87regparm -fomit-frame-pointer -ffast-math" } */ +/* { dg-require-effective-target ilp32 } */ + +float efoo_f(float); +double efoo_d(double); +long double efoo_ld(long double); + +void test() +{ + float f = 1234.5678; + double d = 1234.5678; + long double ld = 1234.5678; + + f = efoo_f(f); + d = efoo_d(d); + ld = efoo_ld(ld); +} + +/* Check that no memory is used to pass arguments. */ + +/* { dg-final { scan-assembler-not "\\(%esp\\)" } } */ Index: gcc/testsuite/gcc.target/i386/x87regparm-3.c =================================================================== --- gcc/testsuite/gcc.target/i386/x87regparm-3.c (revision 0) +++ gcc/testsuite/gcc.target/i386/x87regparm-3.c (revision 0) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target ilp32 } */ + +static float __attribute__((noinline)) foo_f(float f) { return f; } +static double __attribute__((noinline)) foo_d(double d) { return d; } +static long double __attribute__((noinline)) foo_ld(long double ld) { return ld; } + +void test() +{ + float f = 1234.5678; + double d = 1234.5678; + long double ld = 1234.5678; + + f = foo_f(f); + d = foo_d(d); + ld = foo_ld(ld); +} + +/* Check that float and dobule arguments are passed through memory. */ + +/* { dg-final { scan-assembler-times "\\(%ebp\\)" 2 } } */ Index: gcc/testsuite/gcc.target/i386/x87regparm-1.c =================================================================== --- gcc/testsuite/gcc.target/i386/x87regparm-1.c (revision 0) +++ gcc/testsuite/gcc.target/i386/x87regparm-1.c (revision 0) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fomit-frame-pointer -ffast-math" } */ +/* { dg-require-effective-target ilp32 } */ + +float efoo_f(float) __attribute__((x87regparm)); +double efoo_d(double) __attribute__((x87regparm)); +long double efoo_ld(long double) __attribute__((x87regparm)); + +static float __attribute__((noinline)) foo_f(float f) { return f; } +static double __attribute__((noinline)) foo_d(double d) { return d; } +static long double __attribute__((noinline)) foo_ld(long double ld) { return ld; } + +void test() +{ + float f = 1234.5678; + double d = 1234.5678; + long double ld = 1234.5678; + + f = efoo_f(f); + d = efoo_d(d); + ld = efoo_ld(ld); + + f = foo_f(f); + d = foo_d(d); + ld = foo_ld(ld); +} + +/* Check that no memory is used to pass arguments. */ + +/* { dg-final { scan-assembler-not "\\(%esp\\)" } } */