This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch: vector register arguments
- To: gcc patches <gcc-patches at gcc dot gnu dot org>
- Subject: patch: vector register arguments
- From: Aldy Hernandez <aldyh at redhat dot com>
- Date: 01 Nov 2001 18:55:50 -0500
- Cc: Geoff Keating <geoffk at cygnus dot com>
hi guys.
the altivec abi has 8 vector registers in which to pass vector
arguments. __builtin_apply does not handle vector arguments, only INT
and FLOAT. consequently, apply_args_size() and apply_result_size() are
dying.
here is a patch to handle MODE_VECTOR_FLOAT and MODE_VECTOR_INT. i put
MODE_VECTOR_FLOAT first because the common denominator among mmx/altivec
style extensions is float vectors.
i assume this was just an oversight.
ok to install?
--
Aldy Hernandez E-mail: aldyh@redhat.com
Professional Gypsy
Red Hat, Inc.
2001-11-01 Aldy Hernandez <aldyh@redhat.com>
* builtins.c (apply_args_size): Handle vector arguments.
(apply_result_size): Same.
Index: builtins.c
===================================================================
RCS file: /cvs/uberbaum/gcc/builtins.c,v
retrieving revision 1.125
diff -c -p -r1.125 builtins.c
*** builtins.c 2001/10/28 20:42:29 1.125
--- builtins.c 2001/11/01 23:50:09
*************** apply_args_size ()
*** 836,841 ****
--- 836,857 ----
&& have_insn_for (SET, mode))
best_mode = mode;
+ if (best_mode == VOIDmode)
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ if (HARD_REGNO_MODE_OK (regno, mode)
+ && have_insn_for (SET, mode))
+ best_mode = mode;
+
+ if (best_mode == VOIDmode)
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ if (HARD_REGNO_MODE_OK (regno, mode)
+ && have_insn_for (SET, mode))
+ best_mode = mode;
+
mode = best_mode;
if (mode == VOIDmode)
abort ();
*************** apply_result_size ()
*** 886,891 ****
--- 902,923 ----
if (best_mode == VOIDmode)
for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ if (HARD_REGNO_MODE_OK (regno, mode)
+ && have_insn_for (SET, mode))
+ best_mode = mode;
+
+ if (best_mode == VOIDmode)
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ if (HARD_REGNO_MODE_OK (regno, mode)
+ && have_insn_for (SET, mode))
+ best_mode = mode;
+
+ if (best_mode == VOIDmode)
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)