This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] gcc.target/m68k/pr36134.c: Restrict to ColdFire.
- From: kazu at codesourcery dot com (Kazu Hirata)
- To: gcc-patches at gcc dot gnu dot org
- Cc: janis187 at us dot ibm dot com
- Cc: law at redhat dot com
- Date: Mon, 4 May 2009 05:08:55 -0700 (PDT)
- Subject: [patch] gcc.target/m68k/pr36134.c: Restrict to ColdFire.
Hi,
Attached is a patch to restrict pr36134.c to ColdFire.
gcc.target/m68k/pr36134.c FAILs because the testcase looks for LEA
instruction, but GCC does not generate the instruction on CPU32,
including fido. GCC prefers a sequence of ADDQ and SUBQ on CPU32
because that is faster.
Note that the patch to fix PR 36134 was specific to ColdFire as you
can see in:
http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00581.html
This patch fixes the problem by specifying -mcpu=5208 as the
optimization is specific to ColdFire. If there is a conflict
involving -mcpu=, we skip the testcase.
Tested by running the testcase on fido-none-elf. OK to apply?
Kazu Hirata
2009-05-04 Kazu Hirata <kazu@codesourcery.com>
* gcc.target/m68k/pr36134.c: Use dg-skip-if to skip the testcase
if there is a conflict with -mcpu=. Use -mcpu=5208.
Index: gcc/testsuite/gcc.target/m68k/pr36134.c
===================================================================
--- gcc/testsuite/gcc.target/m68k/pr36134.c (revision 146079)
+++ gcc/testsuite/gcc.target/m68k/pr36134.c (working copy)
@@ -1,10 +1,15 @@
/* pr36134.c
This test ensures that the shorter LEA instruction is used in preference
- to the longer ADD instruction. */
+ to the longer ADD instruction.
+
+ This preference is applicable to ColdFire only. On CPU32, we can
+ use a sequence of two ADDQ instructions, which is faster than the
+ LEA instruction. */
/* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-skip-if "" { *-*-* } { "-mcpu=*" } { "-mcpu=5208" } } */
+/* { dg-options "-O2 -mcpu=5208" } */
/* { dg-final { scan-assembler "lea" } } */
/* { dg-final { scan-assembler-not "add" } } */