Patchwork [MIPS] fix MIPS16 jump table overflow

login
register
mail settings
Submitter Richard Sandiford
Date Aug. 23, 2012, 8:43 p.m.
Message ID <87fw7d49v8.fsf@talisman.home>
Download mbox | patch
Permalink /patch/179718/
State New
Headers show

Comments

Richard Sandiford - Aug. 23, 2012, 8:43 p.m.
Sandra Loosemore <sandra@codesourcery.com> writes:
> On 08/21/2012 02:23 PM, Richard Sandiford wrote:
>>
>> Would be nice to add a compile test for -mabi=64 just to make sure
>> that Pmode == DImode works.  A copy of an existing test like
>> code-readable-1.c would be fine.
>
> I'm having problems with this part -- it seems like every combination of 
> options with -mabi=64 I've tried with code-readable-1.c complains about 
> something-or-another being incompatible.

Yeah, -mabi=64 isn't supported, because the associated relocs haven't
been defined.  It has to be EABI64.

I committed the test case below after checking that it passed on
mips64-elf after your changes.  Nice to see that it worked first time!

Richard


gcc/testsuite/
	* gcc.target/mips/code-readable-4.c: New test.

Patch

Index: gcc/testsuite/gcc.target/mips/code-readable-4.c
===================================================================
--- /dev/null	2012-08-19 20:42:12.842999468 +0100
+++ gcc/testsuite/gcc.target/mips/code-readable-4.c	2012-08-23 21:38:12.956961995 +0100
@@ -0,0 +1,34 @@ 
+/* { dg-options "(-mips16) -mcode-readable=yes -mabi=eabi -mgp64 -O" } */
+
+MIPS16 int
+foo (int i)
+{
+  switch (i)
+    {
+    case 1: return 40;
+    case 2: return 11;
+    case 3: return 29;
+    case 4: return 10;
+    case 5: return 12;
+    case 6: return 35;
+    case 7: return 23;
+    default: return 0;
+    }
+}
+
+extern int k[];
+
+MIPS16 int *
+bar (void)
+{
+  return k;
+}
+
+/* { dg-final { scan-assembler "\tla\t" } } */
+/* { dg-final { scan-assembler "\t\\.half\t" } } */
+/* { dg-final { scan-assembler-not "%hi\\(\[^)\]*L" } } */
+/* { dg-final { scan-assembler-not "%lo\\(\[^)\]*L" } } */
+
+/* { dg-final { scan-assembler "\t\\.dword\tk\n" } } */
+/* { dg-final { scan-assembler-not "%hi\\(k\\)" } } */
+/* { dg-final { scan-assembler-not "%lo\\(k\\)" } } */