This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Fix gcc.target/mips/dse-1.c for GNU/Linux


I promised David that gcc.target/mips/dse-1.c would be fixed by the
var-tracking patch, but that turned out not to be the case.  The "lw"
test still failed because we were generating abicalls code.  In fact,
the test still fails with -mno-abicalls and the implicit -G0, which is
probably something we'd want to fix eventually, but wasn't the original
purpose of this test.

I also noticed that the scan-assembler-nots were missing important cases:
they should check for unsigned loads as well.

I've adjusted the test as below.  It still fails if dse.c:replace_read
returns false unconditionally, but passes otherwise.

Tested on mips-linux-gnu and applied.

Richard


gcc/testsuite/
	* gcc.target/mips/dse-1.c: Pass the union as a second parameter
	to each function.  Check that there are no unsigned loads.

Index: gcc/testsuite/gcc.target/mips/dse-1.c
===================================================================
--- gcc/testsuite/gcc.target/mips/dse-1.c	(revision 129367)
+++ gcc/testsuite/gcc.target/mips/dse-1.c	(working copy)
@@ -1,19 +1,19 @@
 /* { dg-mips-options "-mgp64 -O" } */
 
 #define TEST(ID, TYPE1, TYPE2)					\
-  union {							\
+  union u##ID {							\
     TYPE1 m1[sizeof (TYPE2) / sizeof (TYPE1)];			\
     TYPE2 m2;							\
-  } u##ID;							\
+  };								\
 								\
   /* The MIPS16 versions of the shifts we need are too		\
      expensive.  */						\
   TYPE1 __attribute__((nomips16))				\
-  f##ID (TYPE2 x)						\
+  f##ID (TYPE2 x, union u##ID *u)				\
   {								\
-    u##ID.m2 = x;						\
-    return (u##ID.m1[0]						\
-	    + u##ID.m1[sizeof (TYPE2) / sizeof (TYPE1) - 1]);	\
+    u->m2 = x;							\
+    return (u->m1[0]						\
+	    + u->m1[sizeof (TYPE2) / sizeof (TYPE1) - 1]);	\
   }
 
 TEST (1, unsigned int, unsigned long long);
@@ -32,5 +32,8 @@ TEST (10, signed char, int);
    (char, short) tests won't pass.  */
 
 /* { dg-final { scan-assembler-not "\tlh\t" } } */
+/* { dg-final { scan-assembler-not "\tlhu\t" } } */
 /* { dg-final { scan-assembler-not "\tlw\t" } } */
+/* { dg-final { scan-assembler-not "\tlwu\t" } } */
 /* { dg-final { scan-assembler-not "\tlb\t" } } */
+/* { dg-final { scan-assembler-not "\tlbu\t" } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]