]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PowerPC: PowerPC tests: Add prefixed/pcrel tests
authorMichael Meissner <meissner@linux.ibm.com>
Tue, 9 Jun 2020 18:48:24 +0000 (14:48 -0400)
committerPeter Bergner <bergner@linux.ibm.com>
Thu, 2 Jul 2020 17:28:56 +0000 (12:28 -0500)
2020-06-09  Michael Meissner  <meissner@linux.ibm.com>

gcc/testsuite/
* lib/target-supports.exp (check_effective_target_powerpc_pcrel): New.
(check_effective_target_powerpc_prefixed_addr): New.

(cherry picked from commit 6e52b2297ecce1243c00d76b3f079b71016b8ffa)

gcc/testsuite/lib/target-supports.exp

index 74249750b0a79a1c1b14cce988ab46942fe0b945..ce7908be07323fc777c2e47dd75d60ba2df2d919 100644 (file)
@@ -2170,6 +2170,25 @@ proc check_p9vector_hw_available { } {
     }]
 }
 
+# Return 1 if the PowerPC target generates PC-relative instructions
+# automatically for targets that support PC-relative instructions.
+proc check_effective_target_powerpc_pcrel { } {
+    return [check_no_messages_and_pattern powerpc_pcrel \
+       {\mpla\M} assembly {
+           static unsigned short s;
+           unsigned short *p_foo (void) { return &s; }
+       } {-O2 -mcpu=power10}]
+}
+
+# Return 1 if the PowerPC target generates prefixed instructions automatically
+# for targets that support prefixed instructions.
+proc check_effective_target_powerpc_prefixed_addr { } {
+    return [check_no_messages_and_pattern powerpc_prefixed_addr \
+       {\mplwz\M} assembly {
+           unsigned int foo (unsigned int *p) { return p[0x12345]; }
+       } {-O2 -mcpu=power10}]
+}
+
 # Return 1 if the target supports executing power9 modulo instructions, 0
 # otherwise.  Cache the result.