Commit 8e2be5ae by Maciej W. Rozycki Committed by Maciej W. Rozycki

microMIPS/GCC: Fix PIC call relaxation

	gcc/
	* config/mips/mips.c (mips_output_jump): Output R_MICROMIPS_JALR
	rather than R_MIPS_JALR relocation in microMIPS code.  Do not
	cancel short delay slots in PIC call relaxation.

	gcc/testsuite/
	* gcc.target/mips/call-1.c (dg-options): Add `-mno-micromips'.
	(dg-final): Remove microMIPS JALRS mnemonic matching.
	* gcc.target/mips/call-2.c (dg-options): Add `-mno-micromips'.
	(dg-final): Remove microMIPS JALRS mnemonic matching.
	* gcc.target/mips/call-3.c (dg-options): Add `-mno-micromips'.
	(dg-final): Remove microMIPS JALRS mnemonic matching.
	* gcc.target/mips/call-4.c (dg-options): Add `-mno-micromips'.
	* gcc.target/mips/call-5.c (dg-options): Add `-mno-micromips'.
	* gcc.target/mips/call-6.c (dg-options): Add `-mno-micromips'.
	* gcc.target/mips/call-1u.c: New test case.
	* gcc.target/mips/call-2u.c: New test case.
	* gcc.target/mips/call-3u.c: New test case.
	* gcc.target/mips/call-4u.c: New test case.
	* gcc.target/mips/call-5u.c: New test case.
	* gcc.target/mips/call-6u.c: New test case.

From-SVN: r242512
parent 3549e181
2016-11-16 Maciej W. Rozycki <macro@imgtec.com>
* config/mips/mips.c (mips_output_jump): Output R_MICROMIPS_JALR
rather than R_MIPS_JALR relocation in microMIPS code. Do not
cancel short delay slots in PIC call relaxation.
2016-11-16 Thomas Preud'homme <thomas.preudhomme@arm.com> 2016-11-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/arm/arm.md (arm_addsi3): Add alternative for addition of * config/arm/arm.md (arm_addsi3): Add alternative for addition of
...@@ -13618,12 +13618,9 @@ mips_output_jump (rtx *operands, int target_opno, int size_opno, bool link_p) ...@@ -13618,12 +13618,9 @@ mips_output_jump (rtx *operands, int target_opno, int size_opno, bool link_p)
s += sprintf (s, ".option\tpic0\n\t"); s += sprintf (s, ".option\tpic0\n\t");
if (reg_p && mips_get_pic_call_symbol (operands, size_opno)) if (reg_p && mips_get_pic_call_symbol (operands, size_opno))
{ s += sprintf (s, "%%*.reloc\t1f,%s,%%%d\n1:\t",
s += sprintf (s, "%%*.reloc\t1f,R_MIPS_JALR,%%%d\n1:\t", size_opno); TARGET_MICROMIPS ? "R_MICROMIPS_JALR" : "R_MIPS_JALR",
/* Not sure why this shouldn't permit a short delay but it did not size_opno);
allow it before so we still don't allow it. */
short_delay = "";
}
else else
s += sprintf (s, "%%*"); s += sprintf (s, "%%*");
......
2016-11-16 Maciej W. Rozycki <macro@imgtec.com>
* gcc.target/mips/call-1.c (dg-options): Add `-mno-micromips'.
(dg-final): Remove microMIPS JALRS mnemonic matching.
* gcc.target/mips/call-2.c (dg-options): Add `-mno-micromips'.
(dg-final): Remove microMIPS JALRS mnemonic matching.
* gcc.target/mips/call-3.c (dg-options): Add `-mno-micromips'.
(dg-final): Remove microMIPS JALRS mnemonic matching.
* gcc.target/mips/call-4.c (dg-options): Add `-mno-micromips'.
* gcc.target/mips/call-5.c (dg-options): Add `-mno-micromips'.
* gcc.target/mips/call-6.c (dg-options): Add `-mno-micromips'.
* gcc.target/mips/call-1u.c: New test case.
* gcc.target/mips/call-2u.c: New test case.
* gcc.target/mips/call-3u.c: New test case.
* gcc.target/mips/call-4u.c: New test case.
* gcc.target/mips/call-5u.c: New test case.
* gcc.target/mips/call-6u.c: New test case.
2016-11-16 Thomas Preud'homme <thomas.preudhomme@arm.com> 2016-11-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
* gcc.target/arm/empty_fiq_handler.c: New test. * gcc.target/arm/empty_fiq_handler.c: New test.
......
/* { dg-options "-mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=32" } */ /* { dg-options "-mno-micromips -mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=32" } */
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */ /* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalrc?s?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalrc?s?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,staticfunc\n1:\tjalrc?s?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,staticfunc\n1:\tjalrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail\n1:\tjrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail\n1:\tjrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail2\n1:\tjrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail2\n1:\tjrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail3\n1:\tjrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail3\n1:\tjrc?\t" } } */
......
/* { dg-options "-mmicromips -mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=32" } */
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,normal\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,normal2\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,staticfunc\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail\n1:\tjrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail2\n1:\tjrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail3\n1:\tjrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail4\n1:\tjrc?\t" } } */
__attribute__ ((noinline)) static void staticfunc () { asm (""); }
int normal ();
void normal2 ();
int
NOMIPS16 f (int *p)
{
*p = normal ();
normal2 ();
staticfunc ();
return 1;
}
int tail ();
int
NOMIPS16 h ()
{
return tail ();
}
void tail2 ();
NOMIPS16 void g ()
{
tail2 ();
}
__attribute__ ((visibility ("hidden"))) void tail3 ();
NOMIPS16 void j ()
{
tail3 ();
}
__attribute__ ((noinline)) static void tail4 () { asm (""); }
NOMIPS16 void k ()
{
tail4 ();
}
/* See through some simple data-flow. */ /* See through some simple data-flow. */
/* { dg-options "-mrelax-pic-calls" } */ /* { dg-options "-mno-micromips -mrelax-pic-calls" } */
/* { dg-final { scan-assembler-times "\\.reloc\t1f,R_MIPS_JALR,g\n1:\tjalrc?s?\t" 2 } } */ /* { dg-final { scan-assembler-times "\\.reloc\t1f,R_MIPS_JALR,g\n1:\tjalrc?\t" 2 } } */
extern void g (void); extern void g (void);
......
/* See through some simple data-flow. */
/* { dg-options "-mmicromips -mrelax-pic-calls" } */
/* { dg-final { scan-assembler-times "\\.reloc\t1f,R_MICROMIPS_JALR,g\n1:\tjalrs?\t" 2 } } */
extern void g (void);
int
NOMIPS16 f ()
{
g ();
g ();
return 1;
}
/* { dg-options "-mrelax-pic-calls -mno-shared" } */ /* { dg-options "-mno-micromips -mrelax-pic-calls -mno-shared" } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,g\n1:\tjalrc?s?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,g\n1:\tjalrc?\t" } } */
/* { dg-require-visibility "" } */ /* { dg-require-visibility "" } */
__attribute__ ((visibility ("hidden"))) void g (); __attribute__ ((visibility ("hidden"))) void g ();
......
/* { dg-options "-mmicromips -mrelax-pic-calls -mno-shared" } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,g\n1:\tjalrs?\t" } } */
/* { dg-require-visibility "" } */
__attribute__ ((visibility ("hidden"))) void g ();
int
NOMIPS16 f ()
{
g ();
return 1;
}
/* See through some simple data-flow. */ /* See through some simple data-flow. */
/* { dg-options "-mrelax-pic-calls" } */ /* { dg-options "-mno-micromips -mrelax-pic-calls" } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,g\n1:\tjalrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,g\n1:\tjalrc?\t" } } */
extern void g (void); extern void g (void);
......
/* See through some simple data-flow. */
/* { dg-options "-mmicromips -mrelax-pic-calls" } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,g\n1:\tjalrs?\t" } } */
extern void g (void);
int
NOMIPS16 f (int i)
{
while (i--)
g ();
}
/* Like call-1.c, but for n32. We cannot use sibling calls for tail and tail2 /* Like call-1.c, but for n32. We cannot use sibling calls for tail and tail2
in this case (PR target/57260). */ in this case (PR target/57260). */
/* { dg-options "-mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=n32" } */ /* { dg-options "-mno-micromips -mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=n32" } */
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */ /* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalrc?\t" } } */
......
/* Like call-1.c, but for n32. We cannot use sibling calls for tail and tail2
in this case (PR target/57260). */
/* { dg-options "-mmicromips -mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=n32" } */
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,normal\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,normal2\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,staticfunc\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail2\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail3\n1:\tjrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail4\n1:\tjrc?\t" } } */
__attribute__ ((noinline)) static void staticfunc () { asm (""); }
int normal ();
void normal2 ();
int
NOMIPS16 f (int *p)
{
*p = normal ();
normal2 ();
staticfunc ();
return 1;
}
int tail ();
int
NOMIPS16 h ()
{
return tail ();
}
void tail2 ();
NOMIPS16 void g ()
{
tail2 ();
}
__attribute__ ((visibility ("hidden"))) void tail3 ();
NOMIPS16 void j ()
{
tail3 ();
}
__attribute__ ((noinline)) static void tail4 () { asm (""); }
NOMIPS16 void k ()
{
tail4 ();
}
/* Like call-5.c, but for n64. */ /* Like call-5.c, but for n64. */
/* { dg-options "-mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=64" } */ /* { dg-options "-mno-micromips -mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=64" } */
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */ /* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalrc?\t" } } */ /* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalrc?\t" } } */
......
/* Like call-5.c, but for n64. */
/* { dg-options "-mmicromips -mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=64" } */
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,normal\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,normal2\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,staticfunc\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail2\n1:\tjalrs?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail3\n1:\tjrc?\t" } } */
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MICROMIPS_JALR,tail4\n1:\tjrc?\t" } } */
__attribute__ ((noinline)) static void staticfunc () { asm (""); }
int normal ();
void normal2 ();
int
NOMIPS16 f (int *p)
{
*p = normal ();
normal2 ();
staticfunc ();
return 1;
}
int tail ();
int
NOMIPS16 h ()
{
return tail ();
}
void tail2 ();
NOMIPS16 void g ()
{
tail2 ();
}
__attribute__ ((visibility ("hidden"))) void tail3 ();
NOMIPS16 void j ()
{
tail3 ();
}
__attribute__ ((noinline)) static void tail4 () { asm (""); }
NOMIPS16 void k ()
{
tail4 ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment