Patchwork [ARM,3/3] Adjust tests gcc.target/arm/interrupt-*.c

login
register
mail settings
Submitter Greta Yorsh
Date Oct. 10, 2012, 2:41 p.m.
Message ID <001201cda6f5$60d60710$22821530$@yorsh@arm.com>
Download mbox | patch
Permalink /patch/190659/
State New
Headers show

Comments

Greta Yorsh - Oct. 10, 2012, 2:41 p.m.
Sorry, forgot to attach the patch. Here it is.

-----Original Message-----
From: Greta Yorsh 
Sent: 10 October 2012 15:37
To: Greta Yorsh; GCC Patches
Cc: Ramana Radhakrishnan; Richard Earnshaw; nickc@redhat.com;
paul@codesourcery.com
Subject: [PATCH, ARM][3/3] Adjust tests gcc.target/arm/interrupt-*.c

This patch adjusts the tests to accept LDRD or LDM, depending on effective
target arm_prefer_ldrd_strd. To handle the cases in which this test is not
valid, use effective target arm_notthumb instead of __thumb_ predefine.

With this patch, the test interrup-2.c will fail when arm_prefer_ldrd_strd
holds:
FAIL: gcc.dg/fixed-point/cast-bad.c (test for excess errors)
FAIL: gcc.dg/fixed-point/muldiv-warning.c  (test for warnings, line 68)
FAIL: gcc.dg/fixed-point/muldiv-warning.c (test for excess errors)
It fails because epilogue still uses LDM instead of LDRD, but the generated
assembly is correct. These failures are caused by an issue with
__attribute__((__interrupt__)) and epilogue generation in RTL, which is
unrelated to LDRD epilogue patched and therefore will be addressed by a
separate patch.


ChangeLog

gcc/testsuite/

2012-10-10  Greta Yorsh  <Greta.Yorsh@arm.com>

        * gcc.target/arm/interrupt-1.c: Likewise.
        * gcc.target/arm/interrupt-2.c: Likewise.

Patch

diff --git a/gcc/testsuite/gcc.target/arm/interrupt-1.c b/gcc/testsuite/gcc.target/arm/interrupt-1.c
index 18379de..19d13e4 100644
--- a/gcc/testsuite/gcc.target/arm/interrupt-1.c
+++ b/gcc/testsuite/gcc.target/arm/interrupt-1.c
@@ -1,10 +1,10 @@ 
 /* Verify that prologue and epilogue are correct for functions with
    __attribute__ ((interrupt)).  */
 /* { dg-do compile } */
-/* { dg-options "-O0" } */
+/* { dg-require-effective-target arm_nothumb } */
+/* { dg-options "-O0 -marm" } */
 
-/* This test is not valid when -mthumb.  We just cheat.  */
-#ifndef __thumb__
+/* This test is not valid when -mthumb.  */
 extern void bar (int);
 extern void foo (void) __attribute__ ((interrupt("IRQ")));
 
@@ -12,12 +12,13 @@  void foo ()
 {
   bar (0);
 }
-#else
-void foo ()
-{
-  asm ("stmfd\tsp!, {r0, r1, r2, r3, r4, fp, ip, lr}");
-  asm ("ldmfd\tsp!, {r0, r1, r2, r3, r4, fp, ip, pc}^");
-}
-#endif
-/* { dg-final { scan-assembler "stmfd\tsp!, {r0, r1, r2, r3, r4, fp, ip, lr}" } } */
-/* { dg-final { scan-assembler "ldmfd\tsp!, {r0, r1, r2, r3, r4, fp, ip, pc}\\^" } } */
+
+/* { dg-final { scan-assembler "stmfd\tsp!, {r0, r1, r2, r3, r4, fp, ip, lr}"  { target { ! { arm_prefer_ldrd_strd } } } } } */
+/* { dg-final { scan-assembler "ldmfd\tsp!, {r0, r1, r2, r3, r4, fp, ip, pc}\\^"  { target { ! { arm_prefer_ldrd_strd } } } } } */
+
+/* { dg-final { scan-assembler "strd\tr0"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "strd\tr2"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "stmfd\tsp!, {r4, fp, ip, lr}"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "ldrd\tr0"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "ldrd\tr2"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "ldmfd\tsp!, {r4, fp, ip, pc}\\^"  { target { arm_prefer_ldrd_strd } } } } */
diff --git a/gcc/testsuite/gcc.target/arm/interrupt-2.c b/gcc/testsuite/gcc.target/arm/interrupt-2.c
index b979bf1..93d8f80 100644
--- a/gcc/testsuite/gcc.target/arm/interrupt-2.c
+++ b/gcc/testsuite/gcc.target/arm/interrupt-2.c
@@ -1,10 +1,10 @@ 
 /* Verify that prologue and epilogue are correct for functions with
    __attribute__ ((interrupt)).  */
 /* { dg-do compile } */
-/* { dg-options "-O1" } */
+/* { dg-require-effective-target arm_nothumb } */
+/* { dg-options "-O1 -marm" } */
 
-/* This test is not valid when -mthum.  We just cheat.  */
-#ifndef __thumb__
+/* This test is not valid when -mthumb.  */
 extern void bar (int);
 extern void test (void) __attribute__((__interrupt__));
 
@@ -14,13 +14,15 @@  void test()
   funcptrs(foo);
   foo = 0;
 }
-#else
-void test ()
-{
-  asm ("stmfd\tsp!, {r0, r1, r2, r3, r4, r5, ip, lr}");
-  asm ("ldmfd\tsp!, {r0, r1, r2, r3, r4, r5, ip, pc}^");
-}
-#endif
 
-/* { dg-final { scan-assembler "stmfd\tsp!, {r0, r1, r2, r3, r4, r5, ip, lr}" } } */
-/* { dg-final { scan-assembler "ldmfd\tsp!, {r0, r1, r2, r3, r4, r5, ip, pc}\\^" } } */
+/* { dg-final { scan-assembler "stmfd\tsp!, {r0, r1, r2, r3, r4, r5, ip, lr}" { target { ! { arm_prefer_ldrd_strd } } } } } */
+/* { dg-final { scan-assembler "ldmfd\tsp!, {r0, r1, r2, r3, r4, r5, ip, pc}\\^" { target { ! { arm_prefer_ldrd_strd } } } } } */
+
+/* { dg-final { scan-assembler "strd\tr0"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "strd\tr2"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "strd\tr4"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "stmfd\tsp!, {ip, lr}"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "ldrd\tr0"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "ldrd\tr2"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "ldrd\tr4"  { target { arm_prefer_ldrd_strd } } } } */
+/* { dg-final { scan-assembler "ldmfd\tsp!, {ip, pc}"  { target { arm_prefer_ldrd_strd } } } } */