This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
altivec: disallow pre_inc and pre_dec
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, dje at watson dot ibm dot com
- Date: Thu, 2 May 2002 11:58:31 +1000
- Subject: altivec: disallow pre_inc and pre_dec
hmmm, wonder why we never caught this.
print_operand was dying because it was getting an invalid address.
would it be ok if started appending these compile tests to altivec-7.c
instead of adding more tests?
ok for mainline?
2002-05-02 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/altivec-8.c: New.
* config/rs6000/rs6000.c (rs6000_legitimate_address): Disallow
PRE_INC and PRE_DEC for altivec modes.
Index: testsuite/gcc.dg/altivec-8.c
===================================================================
RCS file: testsuite/gcc.dg/altivec-8.c
diff -N testsuite/gcc.dg/altivec-8.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/altivec-8.c 2 May 2002 01:46:31 -0000
***************
*** 0 ****
--- 1,18 ----
+ /* Origin: Aldy Hernandez <aldyh@redhat.com> */
+ /* Test rs6000_legitimate_address. PRE_INC should be invalid. */
+
+ /* { dg-do compile { target powerpc-*-* } } */
+ /* { dg-options "-maltivec" } */
+
+ #include <altivec.h>
+
+ vector signed short *hannah;
+
+ int
+ main ()
+ {
+ *hannah++ = __builtin_altivec_vspltish (5);
+ *hannah++ = __builtin_altivec_vspltish (6);
+
+ return 0;
+ }
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.312
diff -c -p -r1.312 rs6000.c
*** config/rs6000/rs6000.c 1 May 2002 01:50:21 -0000 1.312
--- config/rs6000/rs6000.c 2 May 2002 01:46:37 -0000
*************** rs6000_legitimate_address (mode, x, reg_
*** 2048,2053 ****
--- 2048,2054 ----
if (LEGITIMATE_INDIRECT_ADDRESS_P (x, reg_ok_strict))
return 1;
if ((GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC)
+ && !ALTIVEC_VECTOR_MODE (mode)
&& TARGET_UPDATE
&& LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (x, 0), reg_ok_strict))
return 1;