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
This commit is contained in:
Maxim Kuvyrkov 2008-11-24 17:55:35 +00:00 committed by Maxim Kuvyrkov
parent 148153c18c
commit 5ad2f1a5f2
4 changed files with 55 additions and 3 deletions

View 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

View File

@ -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" "")

View 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

View File

@ -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);
}
}