diff mbox

[ARM] Fix PR45094

Message ID 20100801145827.GB2569@qiyaows
State New
Headers show

Commit Message

Yao Qi Aug. 1, 2010, 2:58 p.m. UTC
On Sun, Aug 01, 2010 at 01:43:09PM +0100, John Tytgat wrote:
> In message <20100801083614.GA2569@qiyaows>
>           Yao Qi <yao@codesourcery.com> wrote:
> 
> > This patch fixes generated wrong instructions reported in PR45094,
> > which is caused by typo.
> > 
> > Tested on arm-unknown-linux-gnueabi, fixes the new test.
> > [...]
> 
> > Index: config/arm/arm.c
> > ===================================================================
> > --- config/arm/arm.c	(revision 162792)
> > +++ config/arm/arm.c	(working copy)
> > @@ -12570,13 +12570,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 ("strr%?\t%H0, [%1, #4]", otherops);
>                                       ^^^
> 
> Typo (one 'r') ?
>

Oops...  Correct typo in new patch.
 
> >  		}
> >  	      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)

Comments

Daniel Jacobowitz Aug. 2, 2010, 12:38 a.m. UTC | #1
On Sun, Aug 01, 2010 at 10:58:29PM +0800, Yao Qi wrote:
> Oops...  Correct typo in new patch.

This suggests there should be an execute test.  When possible, those
are better.
diff mbox

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 162792)
+++ config/arm/arm.c	(working copy)
@@ -12570,13 +12570,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,20 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp" } */
+
+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);
+    return !buffer[0];
+}
+
+/* { dg-final { scan-assembler "str" } } */