Patchwork [mips] Size savings for MIPS16 switch statements

login
register
mail settings
Submitter Steve Ellcey
Date July 30, 2013, 4:55 p.m.
Message ID <1375203322.1690.192.camel@ubuntu-sellcey>
Download mbox | patch
Permalink /patch/263446/
State New
Headers show

Comments

Steve Ellcey - July 30, 2013, 4:55 p.m.
On Tue, 2013-07-30 at 11:18 +0100, Maciej W. Rozycki wrote:
> 
> -- it may be that the tests have to be disabled at -Os just like e.g. 
> code-readable-1.c already is at -O0.
> 
>   Maciej

Sorry about that, not sure why I didn't notice the failures.  Rather
then skipping the tests for -Os I was thinking it might be better to
increase the size of the switch statements.  Here is a patch I have
tested to fix these failures.

Richard, does this look OK for checkin?

Steve Ellcey
sellcey@mips.com


2013-07-30  Steve Ellcey  <sellcey@mips.com>

	* gcc.target/mips/code-readable-1.c: Increase switch size.
	* gcc.target/mips/code-readable-2.c: Ditto.
	* gcc.target/mips/code-readable-3.c: Ditto.
	* gcc.target/mips/code-readable-4.c: Ditto.
Maciej W. Rozycki - July 30, 2013, 6:44 p.m.
On Tue, 30 Jul 2013, Steve Ellcey wrote:

> > -- it may be that the tests have to be disabled at -Os just like e.g. 
> > code-readable-1.c already is at -O0.
> 
> Sorry about that, not sure why I didn't notice the failures.  Rather
> then skipping the tests for -Os I was thinking it might be better to
> increase the size of the switch statements.  Here is a patch I have
> tested to fix these failures.

 That sounds even better to me -- perhaps you can take the opportunity and 
test the new threshold too?  I.e. another test case for MIPS16 and -Os 
only that makes sure the code produced is switched between the two models 
when the size of a switch statement crosses the boundary?

  Maciej
Richard Sandiford - July 30, 2013, 7:13 p.m.
Steve Ellcey <sellcey@mips.com> writes:
> 2013-07-30  Steve Ellcey  <sellcey@mips.com>
>
> 	* gcc.target/mips/code-readable-1.c: Increase switch size.
> 	* gcc.target/mips/code-readable-2.c: Ditto.
> 	* gcc.target/mips/code-readable-3.c: Ditto.
> 	* gcc.target/mips/code-readable-4.c: Ditto.

OK, thanks.

Richard

Patch

diff --git a/gcc/testsuite/gcc.target/mips/code-readable-1.c b/gcc/testsuite/gcc.target/mips/code-readable-1.c
index 34c2c0a..b3e864d 100644
--- a/gcc/testsuite/gcc.target/mips/code-readable-1.c
+++ b/gcc/testsuite/gcc.target/mips/code-readable-1.c
@@ -8,6 +8,10 @@  volatile int x4;
 volatile int x5;
 volatile int x6;
 volatile int x7;
+volatile int x8;
+volatile int x9;
+volatile int x10;
+volatile int x11;
 
 MIPS16 int
 foo (int i, volatile *x)
@@ -21,6 +25,10 @@  foo (int i, volatile *x)
     case 5: return x5 + x[4];
     case 6: return x6 + x[5];
     case 7: return x7 + x[6];
+    case 8: return x8 + x[7];
+    case 9: return x9 + x[8];
+    case 10: return x10 + x[9];
+    case 11: return x11 + x[10];
     default: return 0;
     }
 }
diff --git a/gcc/testsuite/gcc.target/mips/code-readable-2.c b/gcc/testsuite/gcc.target/mips/code-readable-2.c
index 71aeb13..3d32504 100644
--- a/gcc/testsuite/gcc.target/mips/code-readable-2.c
+++ b/gcc/testsuite/gcc.target/mips/code-readable-2.c
@@ -7,6 +7,10 @@  volatile int x4;
 volatile int x5;
 volatile int x6;
 volatile int x7;
+volatile int x8;
+volatile int x9;
+volatile int x10;
+volatile int x11;
 
 MIPS16 int
 foo (int i, volatile *x)
@@ -20,6 +24,10 @@  foo (int i, volatile *x)
     case 5: return x5 + x[4];
     case 6: return x6 + x[5];
     case 7: return x7 + x[6];
+    case 8: return x8 + x[7];
+    case 9: return x9 + x[8];
+    case 10: return x10 + x[9];
+    case 11: return x11 + x[10];
     default: return 0;
     }
 }
diff --git a/gcc/testsuite/gcc.target/mips/code-readable-3.c b/gcc/testsuite/gcc.target/mips/code-readable-3.c
index fc78505..aaf1874 100644
--- a/gcc/testsuite/gcc.target/mips/code-readable-3.c
+++ b/gcc/testsuite/gcc.target/mips/code-readable-3.c
@@ -7,6 +7,10 @@  volatile int x4;
 volatile int x5;
 volatile int x6;
 volatile int x7;
+volatile int x8;
+volatile int x9;
+volatile int x10;
+volatile int x11;
 
 MIPS16 int
 foo (int i, volatile *x)
@@ -20,6 +24,10 @@  foo (int i, volatile *x)
     case 5: return x5 + x[4];
     case 6: return x6 + x[5];
     case 7: return x7 + x[6];
+    case 8: return x8 + x[7];
+    case 9: return x9 + x[8];
+    case 10: return x10 + x[9];
+    case 11: return x11 + x[10];
     default: return 0;
     }
 }
diff --git a/gcc/testsuite/gcc.target/mips/code-readable-4.c b/gcc/testsuite/gcc.target/mips/code-readable-4.c
index ae8ff8a..4db89f8 100644
--- a/gcc/testsuite/gcc.target/mips/code-readable-4.c
+++ b/gcc/testsuite/gcc.target/mips/code-readable-4.c
@@ -8,6 +8,10 @@  volatile int x4;
 volatile int x5;
 volatile int x6;
 volatile int x7;
+volatile int x8;
+volatile int x9;
+volatile int x10;
+volatile int x11;
 
 MIPS16 int
 foo (int i, volatile *x)
@@ -21,6 +25,10 @@  foo (int i, volatile *x)
     case 5: return x5 + x[4];
     case 6: return x6 + x[5];
     case 7: return x7 + x[6];
+    case 8: return x8 + x[7];
+    case 9: return x9 + x[8];
+    case 10: return x10 + x[9];
+    case 11: return x11 + x[10];
     default: return 0;
     }
 }