diff options
author | Hartmut Penner <hpenner@de.ibm.com> | 2004-02-11 09:00:08 +0000 |
---|---|---|
committer | Hartmut Penner <hpenner@gcc.gnu.org> | 2004-02-11 09:00:08 +0000 |
commit | 6d0ef01e47ee5fa08d471d5801417942ecfdb3f9 (patch) | |
tree | 0af995a584d4fcb00fec8ad9c65d9a334be7d977 /gcc | |
parent | 7537fc907c7f1137ae49a7012cba15db6e8ddcff (diff) | |
download | gcc-6d0ef01e47ee5fa08d471d5801417942ecfdb3f9.zip gcc-6d0ef01e47ee5fa08d471d5801417942ecfdb3f9.tar.gz gcc-6d0ef01e47ee5fa08d471d5801417942ecfdb3f9.tar.bz2 |
* 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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 26 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ppc64-abi-3.c | 28 |
4 files changed, 64 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a6d685..ea05ce0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index f0bdd74..59cd623 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 a22f644..d49569a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 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 0000000..58f161d --- /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); +} |