From: Hartmut Penner Date: Wed, 11 Feb 2004 09:00:08 +0000 (+0000) Subject: * gcc/config/rs6000/rs6000.c (rs6000_override_options) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d0ef01e47ee5fa08d471d5801417942ecfdb3f9;p=gcc.git * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a6d6857dbe..ea05ce02789 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-02-11 Hartmut Penner + + * 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 * emit-rtl.c (mark_label_nuses): Check that a LABEL_REF refers to diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index f0bdd74b475..59cd6236687 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a22f644a4ab..d49569a3833 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-02-11 Hartmut Penner + + * gcc.dg/ppc64-abi-3.c: New test. + 2004-02-10 Paolo Bonzini PR c/14092 diff --git a/gcc/testsuite/gcc.dg/ppc64-abi-3.c b/gcc/testsuite/gcc.dg/ppc64-abi-3.c new file mode 100644 index 00000000000..58f161dae6c --- /dev/null +++ b/gcc/testsuite/gcc.dg/ppc64-abi-3.c @@ -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); +}