This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Altivec ABI as default for powerpc64 linux






Geoff wrote:

> I think the error message could be improved, perhaps it should read

> Cannot pass argument because altivec instructions are disabled,
> use -maltivec to enable them.

Changed it.

> (or something shorter that says the same thing).

> Also, won't this patch produce two error messages for each vector
argument?

Yes, you are right, fixed it.

> > Segher brought to me the point, that we also might check for
> > function return, i. e. generate error message for function returning
> > altivec vector, but not having -maltivec turned on.

> Yes, that sounds like a good idea.

Did implement it.

OK to commit, under assumption it bootstraps etc ?
Also for 3.4 ?


ChangeLog:

2004-02-10  Hartmut Penner  <hpenner@de.ibm.com>

      * gcc/config/rs6000/rs6000.c (rs6000_override_options):
      Set AltiVec ABI and vrsave as default for powerpc64 linux.
      (init_cumulative_args): Post error, if try to return
      value in AltiVec register without enable AltiVec.
      (function_arg_advance): Ditto for passing arguments.


Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.595
diff -u -p -r1.595 rs6000.c
--- rs6000.c      9 Feb 2004 19:58:18 -0000     1.595
+++ rs6000.c      10 Feb 2004 08:01:49 -0000
@@ -836,6 +836,13 @@ rs6000_override_options (const char *def
      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 *c
       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 *c
   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.  */






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]