re PR target/35018 ([m68k-elf] Gcc ouputs invalid asm when compiling with -O2 or...
authorMaxim Kuvyrkov <maxim@codesourcery.com>
Mon, 24 Nov 2008 17:55:35 +0000 (17:55 +0000)
committerMaxim Kuvyrkov <mkuvyrkov@gcc.gnu.org>
Mon, 24 Nov 2008 17:55:35 +0000 (17:55 +0000)
PR target/35018

* config/m68k/m68k.md (ok_for_coldfire, enabled): New attributes.
(addsi_lshrsi_31): Add ColdFire-friendly alternatives.

* gcc.target/m68k/pr35018.c: New.

From-SVN: r142161

gcc/ChangeLog
gcc/config/m68k/m68k.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/m68k/pr35018.c [new file with mode: 0644]

index 5423742..6ed8922 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-24  Maxim Kuvyrkov  <maxim@codesourcery.com>
+
+       PR target/35018
+       * config/m68k/m68k.md (ok_for_coldfire, enabled): New attributes.
+       (addsi_lshrsi_31): Add ColdFire-friendly alternatives.
+
 2008-11-24  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (UNSPECV_CMPXCHG): Rename from
index 75f36dc..8522cc1 100644 (file)
 (define_attr "size" "1,2,3"
   (symbol_ref "m68k_sched_attr_size (insn)"))
 
+;; Alternative is OK for ColdFire.
+(define_attr "ok_for_coldfire" "yes,no" (const_string "yes"))
+
+;; Define 'enabled' attribute.
+(define_attr "enabled" ""
+  (cond [(and (ne (symbol_ref "TARGET_COLDFIRE") (const_int 0))
+             (eq_attr "ok_for_coldfire" "no"))
+        (const_int 0)]
+       (const_int 1)))
 \f
 ;; Mode macros for floating point operations.
 ;; Valid floating point modes
 })
 
 (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)))]
   ""
   (*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 d66b4eb..0c2f722 100644 (file)
@@ -1,3 +1,8 @@
+2008-11-24  Maxim Kuvyrkov  <maxim@codesourcery.com>
+
+       PR target/35018
+       * gcc.target/m68k/pr35018.c: New.
+
 2008-11-24  Daniel Kraft  <d@domob.eu>
 
        PR fortran/37779
diff --git a/gcc/testsuite/gcc.target/m68k/pr35018.c b/gcc/testsuite/gcc.target/m68k/pr35018.c
new file mode 100644 (file)
index 0000000..fadea86
--- /dev/null
@@ -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);
+    }
+}
+