Patchwork [arm] Backport PR45094 fix to 4.5

login
register
mail settings
Submitter Yao Qi
Date Dec. 27, 2010, 8:15 a.m.
Message ID <4D184B17.1030106@codesourcery.com>
Download mbox | patch
Permalink /patch/76759/
State New
Headers show

Comments

Yao Qi - Dec. 27, 2010, 8:15 a.m.
PR 45094 was fixed by this patch on mainline
http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00249.html.  This patch is
to backport this fix to 4.5 branch.
Note that since 'dg-add-options arm_neon' doesn't work on 4.5 branch, it
is replaced by '-mfpu=neon -mfloat-abi=softfp' in dg-options.

OK for 4.5?
Ramana Radhakrishnan - Jan. 26, 2011, 12:16 p.m.
On Mon, Dec 27, 2010 at 8:15 AM, Yao Qi <yao@codesourcery.com> wrote:
> PR 45094 was fixed by this patch on mainline
> http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00249.html.  This patch is
> to backport this fix to 4.5 branch.
> Note that since 'dg-add-options arm_neon' doesn't work on 4.5 branch, it
> is replaced by '-mfpu=neon -mfloat-abi=softfp' in dg-options.

I can't approve or reject your patch but is there any reason why that
bit of testsuite infrastructure can't be backported to 4.5 ? Otherwise
this test will fail regularly on hardware where you have no neon.

cheers
Ramana
>
> OK for 4.5?
>
> --
> Yao (齐尧)
>
Richard Earnshaw - Jan. 28, 2011, 2:29 p.m.
On Wed, 2011-01-26 at 12:16 +0000, Ramana Radhakrishnan wrote:
> On Mon, Dec 27, 2010 at 8:15 AM, Yao Qi <yao@codesourcery.com> wrote:
> > PR 45094 was fixed by this patch on mainline
> > http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00249.html.  This patch is
> > to backport this fix to 4.5 branch.
> > Note that since 'dg-add-options arm_neon' doesn't work on 4.5 branch, it
> > is replaced by '-mfpu=neon -mfloat-abi=softfp' in dg-options.
> 
> I can't approve or reject your patch but is there any reason why that
> bit of testsuite infrastructure can't be backported to 4.5 ? Otherwise
> this test will fail regularly on hardware where you have no neon.
> 
> cheers
> Ramana
> >
> > OK for 4.5?
> >
> > --
> > Yao (齐尧)
> >
> 

The patch to the compiler is a good thing.  In the interests of
stability I just suggest that we don't bother back-porting the test if
it will cause problems.  It's a useful test for long-term validation of
trunk, but not of great value on the branch.

R.

Patch

gcc/
	PR target/45094
	* config/arm/arm.c (output_move_double): Fix typo generating 
	instructions ('ldr'->'str').

gcc/testsuite/

	PR target/45094
	* gcc.target/arm/pr45094.c: New test.

Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 167948)
+++ config/arm/arm.c	(working copy)
@@ -1114,6 +1114,7 @@ 
 			     va_list_type);
   DECL_ARTIFICIAL (va_list_name) = 1;
   TYPE_NAME (va_list_type) = va_list_name;
+  TYPE_STUB_DECL (va_list_type) = va_list_name;
   /* Create the __ap field.  */
   ap_field = build_decl (BUILTINS_LOCATION,
 			 FIELD_DECL, 
@@ -12182,13 +12183,13 @@ 
 	    {
 	      if (GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)
 		{
-		  output_asm_insn ("ldr%?\t%0, [%1, %2]!", otherops);
-		  output_asm_insn ("ldr%?\t%H0, [%1, #4]", otherops);
+		  output_asm_insn ("str%?\t%0, [%1, %2]!", otherops);
+		  output_asm_insn ("str%?\t%H0, [%1, #4]", otherops);
 		}
 	      else
 		{
-		  output_asm_insn ("ldr%?\t%H0, [%1, #4]", otherops);
-		  output_asm_insn ("ldr%?\t%0, [%1], %2", otherops);
+		  output_asm_insn ("str%?\t%H0, [%1, #4]", otherops);
+		  output_asm_insn ("str%?\t%0, [%1], %2", otherops);
 		}
 	    }
 	  else if (GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)
Index: testsuite/gcc.target/arm/pr45094.c
===================================================================
--- testsuite/gcc.target/arm/pr45094.c	(revision 0)
+++ testsuite/gcc.target/arm/pr45094.c	(revision 0)
@@ -0,0 +1,26 @@ 
+/* { dg-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
+/* { dg-options "-O2 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp" } */
+
+#include <stdlib.h>
+
+long long buffer[32];
+
+void __attribute__((noinline)) f(long long *p, int n)
+{
+  while (--n >= 0)
+    {
+      *p = 1;
+      p += 32;
+    }
+}
+
+int main(void)
+{
+  f(buffer, 1);
+  
+  if (!buffer[0])
+    abort();
+
+  return 0;
+}