Commit 2f84b963 by Richard Guenther Committed by Richard Biener

extend.texi: Document sseregparm target attribute.

2005-06-16  Richard Guenther  <rguenth@gcc.gnu.org>

	* doc/extend.texi: Document sseregparm target attribute.
	Clarify fastcall and regparm documentation.
	* config/i386/i386.h: Adjust float_in_sse documentation.
	* config/i386/i386.c: Add new target attribute sseregparm.
	(ix86_handle_cdecl_attribute, ix86_handle_regparm_attribute):
	Merge into ...
	(ix86_handle_cconv_attribute): ... here.  Also handle
	sseregparm attribute.
	(ix86_comp_type_attributes): Compare sseregparm attributes.
	(ix86_function_sseregparm): New function, split out from ...
	(init_cumulative_args): ... here.  Use to decide use
	of SSE registers and error in case of missing support.
	(ix86_value_regno): Likewise.
	(function_arg_advance): Do not bail out for DFmode if we need
	to pass doubles in registers.
	(function_arg): Likewise.

	* gcc.target/i386/attributes-error.c: New testcase.
	* gcc.target/i386/fastcall-sseregparm.c: Likewise.
	* gcc.target/i386/regparm-stdcall.c: Likewise.
	* gcc.target/i386/sseregparm-1.c: Likewise.
	* gcc.target/i386/sseregparm-2.c: Likewise.

From-SVN: r101085
parent 9f18db39
2005-06-16 Richard Guenther <rguenth@gcc.gnu.org>
* doc/extend.texi: Document sseregparm target attribute.
Clarify fastcall and regparm documentation.
* config/i386/i386.h: Adjust float_in_sse documentation.
* config/i386/i386.c: Add new target attribute sseregparm.
(ix86_handle_cdecl_attribute, ix86_handle_regparm_attribute):
Merge into ...
(ix86_handle_cconv_attribute): ... here. Also handle
sseregparm attribute.
(ix86_comp_type_attributes): Compare sseregparm attributes.
(ix86_function_sseregparm): New function, split out from ...
(init_cumulative_args): ... here. Use to decide use
of SSE registers and error in case of missing support.
(ix86_value_regno): Likewise.
(function_arg_advance): Do not bail out for DFmode if we need
to pass doubles in registers.
(function_arg): Likewise.
2005-06-16 Paolo Bonzini <bonzini@gnu.org> 2005-06-16 Paolo Bonzini <bonzini@gnu.org>
Daniel Jacobowitz <dan@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com>
Alan Modra <amodra.bigpond.net.au> Alan Modra <amodra.bigpond.net.au>
......
...@@ -1478,8 +1478,8 @@ typedef struct ix86_args { ...@@ -1478,8 +1478,8 @@ typedef struct ix86_args {
int mmx_nregs; /* # mmx registers available for passing */ int mmx_nregs; /* # mmx registers available for passing */
int mmx_regno; /* next available mmx register number */ int mmx_regno; /* next available mmx register number */
int maybe_vaarg; /* true for calls to possibly vardic fncts. */ int maybe_vaarg; /* true for calls to possibly vardic fncts. */
int float_in_sse; /* true if in 32-bit mode SFmode/DFmode should int float_in_sse; /* 1 if in 32-bit mode SFmode (2 for DFmode) should
be passed in SSE registers. */ be passed in SSE registers. Otherwise 0. */
} CUMULATIVE_ARGS; } CUMULATIVE_ARGS;
/* Initialize a variable CUM of type CUMULATIVE_ARGS /* Initialize a variable CUM of type CUMULATIVE_ARGS
......
...@@ -1752,9 +1752,10 @@ the @code{rtc}. ...@@ -1752,9 +1752,10 @@ the @code{rtc}.
@item fastcall @item fastcall
@cindex functions that pop the argument stack on the 386 @cindex functions that pop the argument stack on the 386
On the Intel 386, the @code{fastcall} attribute causes the compiler to On the Intel 386, the @code{fastcall} attribute causes the compiler to
pass the first two arguments in the registers ECX and EDX@. Subsequent pass the first argument (if of integral type) in the register ECX and
arguments are passed on the stack. The called function will pop the the second argument (if of integral type) in the register EDX@. Subsequent
arguments off the stack. If the number of arguments is variable all and other typed arguments are passed on the stack. The called function will
pop the arguments off the stack. If the number of arguments is variable all
arguments are pushed on the stack. arguments are pushed on the stack.
@item format (@var{archetype}, @var{string-index}, @var{first-to-check}) @item format (@var{archetype}, @var{string-index}, @var{first-to-check})
...@@ -2126,9 +2127,9 @@ than 2.96. ...@@ -2126,9 +2127,9 @@ than 2.96.
@cindex @code{regparm} attribute @cindex @code{regparm} attribute
@cindex functions that are passed arguments in registers on the 386 @cindex functions that are passed arguments in registers on the 386
On the Intel 386, the @code{regparm} attribute causes the compiler to On the Intel 386, the @code{regparm} attribute causes the compiler to
pass up to @var{number} integer arguments in registers EAX, pass arguments number one to @var{number} if they are of integral type
EDX, and ECX instead of on the stack. Functions that take a in registers EAX, EDX, and ECX instead of on the stack. Functions that
variable number of arguments will continue to be passed all of their take a variable number of arguments will continue to be passed all of their
arguments on the stack. arguments on the stack.
Beware that on some ELF systems this attribute is unsuitable for Beware that on some ELF systems this attribute is unsuitable for
...@@ -2141,6 +2142,14 @@ safe since the loaders there save all registers. (Lazy binding can be ...@@ -2141,6 +2142,14 @@ safe since the loaders there save all registers. (Lazy binding can be
disabled with the linker or the loader if desired, to avoid the disabled with the linker or the loader if desired, to avoid the
problem.) problem.)
@item sseregparm
@cindex @code{sseregparm} attribute
On the Intel 386 with SSE support, the @code{sseregparm} attribute
causes the compiler to pass up to 8 floating point arguments in
SSE registers instead of on the stack. Functions that take a
variable number of arguments will continue to pass all of their
floating point arguments on the stack.
@item returns_twice @item returns_twice
@cindex @code{returns_twice} attribute @cindex @code{returns_twice} attribute
The @code{returns_twice} attribute tells the compiler that a function may The @code{returns_twice} attribute tells the compiler that a function may
......
2005-06-16 Richard Guenther <rguenth@gcc.gnu.org>
* gcc.target/i386/attributes-error.c: New testcase.
* gcc.target/i386/fastcall-sseregparm.c: Likewise.
* gcc.target/i386/regparm-stdcall.c: Likewise.
* gcc.target/i386/sseregparm-1.c: Likewise.
* gcc.target/i386/sseregparm-2.c: Likewise.
2005-06-16 Nathan Sidwell <nathan@codesourcery.com> 2005-06-16 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/rtti/crash2.C: New. * g++.dg/rtti/crash2.C: New.
......
/* { dg-do compile { target i?86-*-* } } */
void foo1(int i, int j) __attribute__((fastcall, cdecl)); /* { dg-error "not compatible" } */
void foo2(int i, int j) __attribute__((fastcall, stdcall)); /* { dg-error "not compatible" } */
void foo3(int i, int j) __attribute__((fastcall, regparm(2))); /* { dg-error "not compatible" } */
void foo4(int i, int j) __attribute__((stdcall, cdecl)); /* { dg-error "not compatible" } */
void foo5(int i, int j) __attribute__((stdcall, fastcall)); /* { dg-error "not compatible" } */
void foo6(int i, int j) __attribute__((cdecl, fastcall)); /* { dg-error "not compatible" } */
void foo7(int i, int j) __attribute__((cdecl, stdcall)); /* { dg-error "not compatible" } */
void foo8(int i, int j) __attribute__((regparm(2), fastcall)); /* { dg-error "not compatible" } */
/* { dg-do run } */
/* { dg-options "-mpreferred-stack-boundary=4 -msse" } */
extern void abort(void);
void __attribute__((fastcall, sseregparm)) foo(int i, int j, float x)
{
static int last_align = -1;
int dummy, align = (int)&dummy & 15;
if (last_align < 0)
last_align = align;
else if (align != last_align)
abort ();
}
int main()
{
foo(0,0,0.0);
foo(0,0,0.0);
return 0;
}
/* { dg-do run } */
/* { dg-options -mpreferred-stack-boundary=4 } */
extern void abort(void);
void __attribute__((regparm(2), stdcall)) foo(int i, int j, float x)
{
static int last_align = -1;
int dummy, align = (int)&dummy & 15;
if (last_align < 0)
last_align = align;
else if (align != last_align)
abort ();
}
int main()
{
foo(0,0,0.0);
foo(0,0,0.0);
return 0;
}
/* { dg-do compile } */
/* { dg-options "-O2 -msse" } */
float essef(float) __attribute__((sseregparm));
double essed(double) __attribute__((sseregparm));
float __attribute__((sseregparm, noinline)) ssef(float f) { return f; }
double __attribute__((sseregparm, noinline)) ssed(double d) { return d; }
extern double d;
extern float f;
void test(void)
{
f = essef(f);
d = essed(d);
f = ssef(f);
d = ssed(d);
}
/* { dg-final { scan-assembler-not "fldl" } } */
/* { dg-do compile } */
/* { dg-options "-mno-sse" } */
float essef(float) __attribute__((sseregparm));
double essed(double) __attribute__((sseregparm));
float __attribute__((sseregparm, noinline)) ssef(float f) { return f; } /* { dg-warning "SSE" } */
double __attribute__((sseregparm, noinline)) ssed(double d) { return d; } /* { dg-warning "SSE" } */
extern double d;
extern float f;
void test(void)
{
f = essef(f); /* { dg-warning "SSE" } */
d = essed(d); /* { dg-warning "SSE" } */
f = ssef(f); /* { dg-warning "SSE" } */
d = ssed(d); /* { dg-warning "SSE" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment