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][M68K]: Fix PR35018


Hello,

The patch below fixes PR35018 in a rather trivial way: it adds new ColdFire-friendly alternatives to the instruction pattern and makes original alternative be skipped when compiling for ColdFire.

This patch employs new instruction attribute "ok_for_coldfire" that is added by a similar patch in http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00964.html.

Tested on ColdFire bare-metal QEMU emulator (gcc, g++, libstdc++); ok for trunk?


Thanks,


MaximK
CodeSourcery
2008-11-20  Maxim Kuvyrkov  <maxim@codesourcery.com>

	PR target/35018
	* config/m68k/m68k.md (addsi_lshrsi_31): Add ColdFire-friendly
	alternatives.

2008-11-20  Maxim Kuvyrkov  <maxim@codesourcery.com>

	PR target/35018
	* gcc.target/m68k/pr35018.c: New.
Index: testsuite/gcc.target/m68k/pr35018.c
===================================================================
--- testsuite/gcc.target/m68k/pr35018.c	(revision 0)
+++ testsuite/gcc.target/m68k/pr35018.c	(revision 0)
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -mcpu=5249" } */
+
+static inline void vect_add(int *x, int *y, int n)
+{
+    asm volatile ("nop;"
+                : [n] "+d" (n), [x] "+a" (x), [y] "+a" (y)
+                : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3",
+                    "cc", "memory");
+}
+
+extern void vect_copy (int *, int *, int);
+
+void vorbis_synthesis_blockin(int *blocksizes)
+{
+    int j, *pcm, *p;
+
+    int n=blocksizes[*p]/2;
+    int n0=blocksizes[0]/2;
+    int n1=blocksizes[1]/2;
+
+    for(j=0;j<*p;j++)
+    {
+        vect_add(p, pcm, n1);
+        vect_add(pcm, p, n0);
+        vect_add(p, pcm, n0);
+        vect_add(p, pcm, n0);
+        vect_copy(pcm, p, n);
+    }
+}
+
Index: config/m68k/m68k.md
===================================================================
--- config/m68k/m68k.md	(revision 142004)
+++ config/m68k/m68k.md	(working copy)
@@ -2281,8 +2281,8 @@
 })
 
 (define_insn "addsi_lshrsi_31"
-  [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
-    (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
+  [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,dm,d<Q>")
+    (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm,r<Q>,rm")
             (const_int 31))
         (match_dup 1)))]
   ""
@@ -2302,7 +2302,8 @@
   (*targetm.asm_out.internal_label) (asm_out_file, "L",
 				CODE_LABEL_NUMBER (operands[3]));
   return "";
-})
+}
+  [(set_attr "ok_for_coldfire" "no,yes,yes")])
 
 (define_expand "addsi3"
   [(set (match_operand:SI 0 "nonimmediate_operand" "")

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