* gcc/config/rs6000/rs6000.c (rs6000_override_options)

Set AltiVec ABI and vrsave as default for ppc64 linux.
       (init_cumulative_args): Post error, if try to return
       value in AltiVec register without enable AltiVec.
       (function_arg_advance): Ditto for passing arguments.

From-SVN: r77642
This commit is contained in:
Hartmut Penner 2004-02-11 09:00:08 +00:00 committed by Hartmut Penner
parent 7537fc907c
commit 6d0ef01e47
4 changed files with 64 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2004-02-11 Hartmut Penner <hpenner@de.ibm.com>
* gcc/config/rs6000/rs6000.c (rs6000_override_options)
Set AltiVec ABI and vrsave as default for ppc64 linux.
(init_cumulative_args): Post error, if try to return
value in AltiVec register without enable AltiVec.
(function_arg_advance): Ditto for passing arguments.
2004-02-11 Richard Sandiford <rsandifo@redhat.com>
* emit-rtl.c (mark_label_nuses): Check that a LABEL_REF refers to

View File

@ -836,6 +836,13 @@ rs6000_override_options (const char *default_cpu)
rs6000_long_double_type_size = size;
}
/* Set Altivec ABI as default for powerpc64 linux. */
if (TARGET_ELF && TARGET_64BIT)
{
rs6000_altivec_abi = 1;
rs6000_altivec_vrsave = 1;
}
/* Handle -mabi= options. */
rs6000_parse_abi_options ();
@ -3836,6 +3843,16 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
fprintf (stderr, " proto = %d, nargs = %d\n",
cum->prototype, cum->nargs_prototype);
}
if (fntype
&& !TARGET_ALTIVEC
&& TARGET_ALTIVEC_ABI
&& ALTIVEC_VECTOR_MODE (TYPE_MODE (TREE_TYPE (fntype))))
{
error ("Cannot return value in vector register because"
" altivec instructions are disabled, use -maltivec"
" to enable them.");
}
}
/* If defined, a C expression which determines whether, and in which
@ -3928,8 +3945,13 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
if (TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (mode))
{
if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
cum->vregno++;
{
cum->vregno++;
if (!TARGET_ALTIVEC)
error ("Cannot pass argument in vector register because"
" altivec instructions are disabled, use -maltivec"
" to enable them.");
}
/* PowerPC64 Linux and AIX allocates GPRs for a vector argument
even if it is going to be passed in a vector register.
Darwin does the same for variable-argument functions. */

View File

@ -1,3 +1,7 @@
2004-02-11 Hartmut Penner <hpenner@de.ibm.com>
* gcc.dg/ppc64-abi-3.c: New test.
2004-02-10 Paolo Bonzini <bonzini@gnu.org>
PR c/14092

View File

@ -0,0 +1,28 @@
/* { dg-do compile { target powerpc64-*-linux* } } */
/* { dg-options "-Wall" } */
/* Testcase to check for ABI compliance of parameter passing
for the PowerPC64 ABI. */
typedef int __attribute__((mode(V4SI))) v4si;
typedef int __attribute__((mode(V2SI))) v2si;
v4si
f(v4si v)
{ /* { dg-error "altivec instructions are disabled" } */
return v;
}
v2si
g(v2si v)
{
return v;
}
int
main()
{
v4si v;
v2si w;
v = f (v); /* { dg-error "altivec instructions are disabled" } */
w = g (w);
}