Commit e1617c1d by Yury Gribov Committed by Yury Gribov

Fix PowerPC tests in PR 81535.

gcc/testsuite/

2018-02-16  Yury Gribov  <tetra2005@gmail.com>

	PR target/81535
	* gcc.dg/pr56727-1.c: Prevent tailcalls and update for powerpc*-*-*.
	* gcc.dg/pr56727-2.c: Ditto.
	* gcc.target/powerpc/pr79439.c: Renamed to...
	* gcc.target/powerpc/pr79439-1.c: ...this.
	* gcc.target/powerpc/pr79439-2.c: New test.
	* gcc.target/powerpc/pr79439-3.c: New test.

From-SVN: r257760
parent 023e7b55
2018-02-16 Yury Gribov <tetra2005@gmail.com>
PR target/81535
* gcc.dg/pr56727-1.c: Prevent tailcalls and update for powerpc*-*-*.
* gcc.dg/pr56727-2.c: Ditto.
* gcc.target/powerpc/pr79439.c: Renamed to...
* gcc.target/powerpc/pr79439-1.c: ...this.
* gcc.target/powerpc/pr79439-2.c: New test.
* gcc.target/powerpc/pr79439-3.c: New test.
2018-02-16 Will Schmidt <will_schmidt@vnet.ibm.com> 2018-02-16 Will Schmidt <will_schmidt@vnet.ibm.com>
target/pr84371 target/pr84371
......
/* { dg-do compile { target fpic } } */ /* { dg-do compile { target fpic } } */
/* { dg-options "-O2 -fPIC" } */ /* { dg-options "-O2 -fPIC" } */
/* { dg-final { scan-assembler-not "@(PLT|plt)" { target i?86-*-* x86_64-*-* powerpc*-*-* } } } */
#define define_func(type) \ #define define_func(type) \
void f_ ## type (type b) { f_ ## type (0); } \ void f_ ## type (type b) { f_ ## type (0); } \
...@@ -21,3 +20,7 @@ int __attribute__((noinline, noclone)) foo_noinline(int n) ...@@ -21,3 +20,7 @@ int __attribute__((noinline, noclone)) foo_noinline(int n)
{ {
return (n == 1 || n == 2) ? 1 : foo_noinline(n-1) * foo_noinline(n-2); return (n == 1 || n == 2) ? 1 : foo_noinline(n-1) * foo_noinline(n-2);
} }
/* { dg-final { scan-assembler-not "@(PLT|plt)" { target i?86-*-* x86_64-*-* } } } */
/* { dg-final { scan-assembler-not "@(PLT|plt)" { target { powerpc*-*-* && ilp32 } } } } */
/* { dg-final { scan-assembler-not "bl \[a-z_\]*\n\\s*nop" { target { powerpc*-*-* && lp64 } } } } */
/* { dg-do compile { target fpic } } */ /* { dg-do compile { target fpic } } */
/* { dg-options "-O2 -fPIC" } */ /* { dg-options "-O2 -fPIC" } */
/* { dg-require-alias "" } */ /* { dg-require-alias "" } */
/* { dg-final { scan-assembler "@(PLT|plt)" { target i?86-*-* x86_64-*-* powerpc*-*-linux* } } } */
__attribute__((noinline, noclone)) __attribute__((noinline, noclone))
void f (short b) void f (short b)
{ {
__builtin_setjmp (0); /* Prevent tailcall */
f (0); f (0);
} }
...@@ -15,3 +15,7 @@ void h () ...@@ -15,3 +15,7 @@ void h ()
{ {
g (0); g (0);
} }
/* { dg-final { scan-assembler "@(PLT|plt)" { target i?86-*-* x86_64-*-* } } } */
/* { dg-final { scan-assembler "@(PLT|plt)" { target { powerpc*-*-linux* && ilp32 } } } } */
/* { dg-final { scan-assembler "bl f\n\\s*nop" { target { powerpc*-*-linux* && lp64 } } } } */
/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
/* { dg-options "-O2 -fpic -fno-reorder-blocks" } */
/* On the Linux 64-bit ABIs, we eliminate NOP in the 'rec' call even if
-fpic is used. The recursive call should call the local alias. The
Linux 32-bit ABIs do not require NOPs after the BL instruction. */
int f (void);
void
g (void)
{
}
int
rec (int a)
{
int ret = 0;
if (a > 10 && f ())
ret += rec (a - 1);
g ();
return a + ret;
}
/* { dg-final { scan-assembler-times {\mbl f\M} 1 } } */
/* { dg-final { scan-assembler-times {\mbl g\M} 1 } } */
/* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */
/* { dg-final { scan-assembler-times {\mnop\M} 2 } } */
/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */ /* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
/* { dg-options "-O2 -fpic" } */ /* { dg-options "-O2 -fpic -fno-reorder-blocks" } */
/* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if /* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if
-fpic is used because rec can be interposed at link time (since it is -fpic is used because rec can be interposed at link time (since it has an
external), and the recursive call should call the interposed function. The alias), and the recursive call should call the interposed function. The
Linux 32-bit ABIs do not require NOPs after the BL instruction. */ Linux 32-bit ABIs do not require NOPs after the BL instruction. */
int f (void); int f (void);
...@@ -23,6 +23,8 @@ rec (int a) ...@@ -23,6 +23,8 @@ rec (int a)
return a + ret; return a + ret;
} }
int rec_alias (int) __attribute__ ((alias ("rec")));
/* { dg-final { scan-assembler-times {\mbl f\M} 1 } } */ /* { dg-final { scan-assembler-times {\mbl f\M} 1 } } */
/* { dg-final { scan-assembler-times {\mbl g\M} 1 } } */ /* { dg-final { scan-assembler-times {\mbl g\M} 1 } } */
/* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */ /* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */
......
/* { dg-do compile { target { powerpc-*-linux* && ilp32 } } } */
/* { dg-options "-O2 -fpic -fno-reorder-blocks" } */
/* Analog of pr79439-1.c for 32-bit Linux. */
int f (void);
void
g (void)
{
}
int
rec (int a)
{
int ret = 0;
if (a > 10 && f ())
ret += rec (a - 1);
g ();
return a + ret;
}
/* { dg-final { scan-assembler-times {\mbl f@plt\M} 1 } } */
/* { dg-final { scan-assembler-times {\mbl g@plt\M} 1 } } */
/* { dg-final { scan-assembler-times {\mbl rec@plt\M} 0 } } */
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