aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim@codesourcery.com>2008-11-24 17:55:35 +0000
committerMaxim Kuvyrkov <mkuvyrkov@gcc.gnu.org>2008-11-24 17:55:35 +0000
commit5ad2f1a5f298eb353fb393d96ccb3e87d3e96eb9 (patch)
tree4f61423a367d4a03cf1547609eb974c2a1085138 /gcc
parent148153c18ccc773df6b67034796295a489658814 (diff)
downloadgcc-5ad2f1a5f298eb353fb393d96ccb3e87d3e96eb9.zip
gcc-5ad2f1a5f298eb353fb393d96ccb3e87d3e96eb9.tar.gz
gcc-5ad2f1a5f298eb353fb393d96ccb3e87d3e96eb9.tar.bz2
re PR target/35018 ([m68k-elf] Gcc ouputs invalid asm when compiling with -O2 or higher)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/m68k/m68k.md16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/m68k/pr35018.c31
4 files changed, 55 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5423742..6ed8922 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 75f36dc..8522cc1 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -244,6 +244,15 @@
(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)))
;; Mode macros for floating point operations.
;; Valid floating point modes
@@ -2281,8 +2290,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 +2311,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" "")
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d66b4eb..0c2f722 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..fadea86
--- /dev/null
+++ b/gcc/testsuite/gcc.target/m68k/pr35018.c
@@ -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);
+ }
+}
+