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]

[PATCH,ARM,4.4] fix PR43722 ice-on-valid in NEON parameter passing


This patch fixes PR target/43722 on ARM, where passing a NEON vector
as a function parameter can trigger an ICE due to missing support for
PRE_DEC addressing modes.  This bug affects 4.4 and 4.3 branches.

For 4.5 this was fixed as a side-effect of a patch which added NEON
vld1/vst1 support <http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01122.html>.
I've extracted the minimal bits from that patch needed to handle PRE_DEC
addressing modes and thus avoid the ICE.

Bootstrapped and regtested on armv5tel-unknown-linux-gnueabi.  I don't
have NEON hardware so no runtime tests of NEON functionality was done.

Ok for 4.4?  (I don't have svn write access.)

The test case is new.  Should it be added to trunk and 4.5 too?

The same patch, modulo renaming 'templ' to 'template' in output_move_neon(),
fixes the ICE on 4.3 branch too, and has likewise been bootstrapped and
regtested.

gcc/

2010-04-15  Mikael Pettersson  <mikpe@it.uu.se>

	PR target/43722
	Backport from mainline:

	2009-05-15  Paul Brook  <paul@codesourcery.com>
		    Sandra Loosemore  <sandra@codesourcery.com>

	* config/arm/arm.c (neon_vector_mem_operand): Allow PRE_DEC.
	(output_move_neon): Handle PRE_DEC.

gcc/testsuite/

2010-04-15  Mikael Pettersson  <mikpe@it.uu.se>

	PR target/43722
	* gcc.target/arm/pr43722.c: New test.

--- gcc-4.4-20100413/gcc/config/arm/arm.c.~1~	2010-02-24 12:21:18.000000000 +0100
+++ gcc-4.4-20100413/gcc/config/arm/arm.c	2010-04-15 14:47:01.000000000 +0200
@@ -6966,7 +6966,7 @@ neon_vector_mem_operand (rtx op, bool co
     return arm_address_register_rtx_p (ind, 0);
 
   /* Allow post-increment with Neon registers.  */
-  if (!core && GET_CODE (ind) == POST_INC)
+  if (!core && (GET_CODE (ind) == POST_INC || GET_CODE (ind) == PRE_DEC))
     return arm_address_register_rtx_p (XEXP (ind, 0), 0);
 
 #if 0
@@ -10963,6 +10963,13 @@ output_move_neon (rtx *operands)
       ops[1] = reg;
       break;
 
+    case PRE_DEC:
+      /* FIXME: We should be using vld1/vst1 here in BE mode?  */
+      templ = "v%smdb%%?\t%%0!, %%h1";
+      ops[0] = XEXP (addr, 0);
+      ops[1] = reg;
+      break;
+    
     case POST_MODIFY:
       /* FIXME: Not currently enabled in neon_vector_mem_operand.  */
       gcc_unreachable ();
--- gcc-4.4-20100413/gcc/testsuite/gcc.target/arm/pr43722.c.~1~	1970-01-01 01:00:00.000000000 +0100
+++ gcc-4.4-20100413/gcc/testsuite/gcc.target/arm/pr43722.c	2010-04-15 14:47:01.000000000 +0200
@@ -0,0 +1,14 @@
+/* PR target/43722 ice-on-valid-code */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-mfpu=neon -mfloat-abi=softfp" } */
+
+#include <arm_neon.h>
+
+extern void printv_f32(const float32x4_t *v);
+
+void foo(void)
+{
+    float32x4_t v = {0.0, 1.0f, 2.0f, 3.0f};
+    printv_f32(&v);
+}


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