+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
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 ();
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.");
+ }
}
\f
/* If defined, a C expression which determines whether, and in which
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. */
--- /dev/null
+/* { 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);
+}