This patch adds 2 new target supports options for the testsuite.  One is for
whether prefixed instructins with 34-bit offsets are supported.  The other is
whether PC-relative instructions are supported.  This was originally part of V5
patch #12, but it was split out to be a separate patch.

Along with the other patches, I have done bootstraps on a little endian power8
system, and there were no regressions in the test suite.  I have built both
Spec 2006 and Spec 2017 with all of these patches installed using -mcpu=future,
and there were no failures.  Can I check this into the trunk?

Note, I may have limited email access on October 17th and 18th, 2019.

2019-10-15   Michael Meissner  <meiss...@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 276974)
+++ gcc/testsuite/lib/target-supports.exp       (working copy)
@@ -5307,16 +5307,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"]
@@ -5325,6 +5323,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.
 
@@ -7223,6 +7261,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: meiss...@linux.ibm.com, phone: +1 (978) 899-4797

Reply via email to