[patch, mips] Size savings for MIPS16 switch statements

Steve Ellcey sellcey@mips.com
Tue Jul 30 16:56:00 GMT 2013


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.

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;
     }
 }






More information about the Gcc-patches mailing list