This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH], V7, #5 of 7, Add more effective targets for the 'future' system to target-supports.
- From: Michael Meissner <meissner at linux dot ibm dot com>
- To: Michael Meissner <meissner at linux dot ibm dot com>, gcc-patches at gcc dot gnu dot org, Segher Boessenkool <segher at kernel dot crashing dot org>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Thu, 14 Nov 2019 17:56:50 -0500
- Subject: [PATCH], V7, #5 of 7, Add more effective targets for the 'future' system to target-supports.
- References: <20191114222509.GA7581@ibm-toto.the-meissners.org>
This patch adds more effective targets to the target-supports.exp in the
testsuite. I tried to break it down to whether prefixed instructions are
allowed, whether the target is generating 64-bit code with prefixed
instructions, and if -mpcrel support is available. I also enabled 'future'
testing on the actual hardware (or simulator).
The tests in V8 will use some of these capabilities.
I have run the test suite on a little endian power8 system with no degradation.
Can I check this into the FSF trunk?
2019-11-14 Michael Meissner <meissner@linux.ibm.com>
* lib/target-supports.exp
(check_effective_target_powerpc_future_ok): Do not require 64-bit
or Linux support before doing the test. Use a 32-bit constant in
PLI.
(check_effective_target_powerpc_prefixed_addr_ok): New effective
target test to see if prefixed memory instructions are supported.
(check_effective_target_powerpc_pcrel_ok): New effective target
test to test whether PC-relative addressing is supported.
(is-effective-target): Add test for the PowerPC 'future' hardware
support.
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp (revision 278173)
+++ gcc/testsuite/lib/target-supports.exp (working copy)
@@ -5345,16 +5345,14 @@ proc check_effective_target_powerpc_p9mo
}
}
-# Return 1 if this is a PowerPC target supporting -mfuture.
-# Limit this to 64-bit linux systems for now until other
-# targets support FUTURE.
+# Return 1 if this is a PowerPC target supporting -mcpu=future.
proc check_effective_target_powerpc_future_ok { } {
- if { ([istarget powerpc64*-*-linux*]) } {
+ if { ([istarget powerpc*-*-*]) } {
return [check_no_compiler_messages powerpc_future_ok object {
int main (void) {
long e;
- asm ("pli %0,%1" : "=r" (e) : "n" (0x12345));
+ asm ("pli %0,%1" : "=r" (e) : "n" (0x1234));
return e;
}
} "-mfuture"]
@@ -5363,6 +5361,46 @@ proc check_effective_target_powerpc_futu
}
}
+# Return 1 if this is a PowerPC target supporting -mcpu=future. The compiler
+# must support large numeric prefixed addresses by default when -mfuture is
+# used. We test loading up a large constant to verify that the full 34-bit
+# offset for prefixed instructions is supported and we check for a prefixed
+# load as well.
+
+proc check_effective_target_powerpc_prefixed_addr_ok { } {
+ if { ([istarget powerpc*-*-*]) } {
+ return [check_no_compiler_messages powerpc_prefixed_addr_ok object {
+ int main (void) {
+ extern long l[];
+ long e, e2;
+ asm ("pli %0,%1" : "=r" (e) : "n" (0x12345678));
+ asm ("pld %0,0x12345678(%1)" : "=r" (e2) : "r" (& l[0]));
+ return e - e2;
+ }
+ } "-mfuture"]
+ } else {
+ return 0
+ }
+}
+
+# Return 1 if this is a PowerPC target supporting -mfuture. The compiler must
+# support PC-relative addressing when -mcpu=future is used to pass this test.
+
+proc check_effective_target_powerpc_pcrel_ok { } {
+ if { ([istarget powerpc*-*-*]) } {
+ return [check_no_compiler_messages powerpc_pcrel_ok object {
+ int main (void) {
+ static int s __attribute__((__used__));
+ int e;
+ asm ("plwa %0,s@pcrel(0),1" : "=r" (e));
+ return e;
+ }
+ } "-mfuture"]
+ } else {
+ return 0
+ }
+}
+
# Return 1 if this is a PowerPC target supporting -mfloat128 via either
# software emulation on power7/power8 systems or hardware support on power9.
@@ -7261,6 +7299,7 @@ proc is-effective-target { arg } {
"named_sections" { set selected [check_named_sections_available] }
"gc_sections" { set selected [check_gc_sections_available] }
"cxa_atexit" { set selected [check_cxa_atexit_available] }
+ "powerpc_future_hw" { set selected [check_powerpc_future_hw_available] }
default { error "unknown effective target keyword `$arg'" }
}
}
--
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797