[patch, MIPS, testsuite] Fix gcc.target/mips/branch-1.c

Steve Ellcey sellcey@imgtec.com
Mon May 11 16:02:00 GMT 2015


The test gcc.target/mips/branch-1.c has started failing because it is trying
to verify that each of 4 functions generates and 'andi' instruction and only
finding 2 of them.  With a recent change (fixing PR 65150) GCC determined that
the f1 and f2 functions generate identical code and that the f3 and f4
functions generate identical code and so it replaced f1 with a tail call to f2
and f3 with a tail call to f4.  Thus only 2 'andi' instructions show up and
the test fails.

There is an existing bug report (PR 65534) about whether or not this
is a good optimization but I would like to fix this test so that that
optimization can not happen since that is not what this test is intended
to check for.  My solution is to pass different arguments to bar() in
each function so the code in each function is unique.

Tested with mips-mti-linux-gnu, OK to checkin?

Steve Ellcey
sellcey@imgtec.com


2015-05-11  Steve Ellcey  <sellcey@mips.com>

	* gcc.target/mips/branch-1.c: Pass argument to bar().


diff --git a/gcc/testsuite/gcc.target/mips/branch-1.c b/gcc/testsuite/gcc.target/mips/branch-1.c
index 6ef50e8..83d7180 100644
--- a/gcc/testsuite/gcc.target/mips/branch-1.c
+++ b/gcc/testsuite/gcc.target/mips/branch-1.c
@@ -4,11 +4,11 @@
    on zero.  */
 /* { dg-options "forbid_cpu=octeon.*" } */
 
-void bar (void);
-NOMIPS16 void f1 (int x) { if (x & 4) bar (); }
-NOMIPS16 void f2 (int x) { if ((x >> 2) & 1) bar (); }
-NOMIPS16 void f3 (unsigned int x) { if (x & 0x10) bar (); }
-NOMIPS16 void f4 (unsigned int x) { if ((x >> 4) & 1) bar (); }
+void bar (int);
+NOMIPS16 void f1 (int x) { if (x & 4) bar (1); }
+NOMIPS16 void f2 (int x) { if ((x >> 2) & 1) bar (2); }
+NOMIPS16 void f3 (unsigned int x) { if (x & 0x10) bar (3); }
+NOMIPS16 void f4 (unsigned int x) { if ((x >> 4) & 1) bar (4); }
 /* { dg-final { scan-assembler "\tandi\t.*\tandi\t.*\tandi\t.*\tandi\t" } } */
 /* { dg-final { scan-assembler-not "\tsrl\t" } } */
 /* { dg-final { scan-assembler-not "\tsra\t" } } */



More information about the Gcc-patches mailing list