[PATCH} rs6000: Enable PC-relative by default and test

Message ID b634e232-c30d-511f-aa3b-7682ab82c6a0@linux.ibm.com
State New
Headers show
Series
  • [PATCH} rs6000: Enable PC-relative by default and test
Related show

Commit Message

Bill Schmidt May 23, 2019, 9:15 p.m.
Hi,

This is a short patch that enables PC-relative support by default, and provides a
test case to ensure that the correct .localentry name,1 directive is produced iff
PC-relative support is enabled.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu.  Okay for trunk?

Thanks,
Bill


[gcc]

2019-05-23  Bill Schmidt  <wschmidt@linux.ibm.com>
	    Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000-cpus.def (OTHER_FUTURES_MASK): New #define.

[gcc/testsuite]

2019-05-23  Bill Schmidt  <wschmidt@linux.ibm.com>

	* gcc.target/powerpc/pcrel-detect-1.c: New file.

Comments

Segher Boessenkool May 24, 2019, 8:49 a.m. | #1
Hi,

On Thu, May 23, 2019 at 04:15:26PM -0500, Bill Schmidt wrote:
> This is a short patch that enables PC-relative support by default, and provides a

> test case to ensure that the correct .localentry name,1 directive is produced iff

> PC-relative support is enabled.


> 2019-05-23  Bill Schmidt  <wschmidt@linux.ibm.com>

> 

> 	* gcc.target/powerpc/pcrel-detect-1.c: New file.


That's a very strange file name for what it tests, then.  Improve it?

> diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-detect-1.c b/gcc/testsuite/gcc.target/powerpc/pcrel-detect-1.c

> new file mode 100644

> index 00000000000..8e0e9053dc7

> --- /dev/null

> +++ b/gcc/testsuite/gcc.target/powerpc/pcrel-detect-1.c

> @@ -0,0 +1,12 @@

> +/* { dg-do compile { target { powerpc*-*-* } } } */


Just

/* { dg-do compile } */

is enough.

> +/* { dg-require-effective-target powerpc_elfv2 } */

> +/* { dg-options "-O3 -mdejagnu-cpu=future" } */


Please use -O2 if there is not specific reason for -O3.

Okay with those things fixed somehow.  Thanks,


Segher

Patch

diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def
index 64292c923e6..5337382bdcf 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -77,6 +77,9 @@ 
 				 | OPTION_MASK_FUTURE			\
 				 | OPTION_MASK_PCREL)
 
+/* Flags that need to be turned off if -mno-future.  */
+#define OTHER_FUTURE_MASKS	(OPTION_MASK_PCREL)
+
 /* Flags that need to be turned off if -mno-power9-vector.  */
 #define OTHER_P9_VECTOR_MASKS	(OPTION_MASK_FLOAT128_HW		\
 				 | OPTION_MASK_P9_MINMAX)
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-detect-1.c b/gcc/testsuite/gcc.target/powerpc/pcrel-detect-1.c
new file mode 100644
index 00000000000..8e0e9053dc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-detect-1.c
@@ -0,0 +1,12 @@ 
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-options "-O3 -mdejagnu-cpu=future" } */
+
+
+int localentry1 () { return 5; }
+
+#pragma GCC target ("cpu=power9")
+int localentry2 () { return 5; }
+
+/* { dg-final { scan-assembler {\.localentry\tlocalentry1,1\M} } } */
+/* { dg-final { scan-assembler-not {\.localentry\tlocalentry2,1\M} } } */