[1/7] PowerPC tests: Add prefixed/pcrel tests.

Message ID 1591041222-24243-2-git-send-email-meissner@linux.ibm.com
State New
Headers show
Series
  • [1/7] PowerPC tests: Add prefixed/pcrel tests.
Related show

Commit Message

Kees Cook via Gcc-patches June 1, 2020, 7:53 p.m.
2020-06-01  Michael Meissner  <meissner@linux.ibm.com>

	* lib/target-supports.exp (check_effective_target_powerpc_pcrel):
	New.
	(check_effective_target_powerpc_prefixed_addr): New.
---
 gcc/testsuite/lib/target-supports.exp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

-- 
1.8.3.1

Comments

Segher Boessenkool June 9, 2020, 1:09 a.m. | #1
Hi!

On Mon, Jun 01, 2020 at 03:53:36PM -0400, Michael Meissner wrote:
> +# Return 1 if the target generates PC-relative instructions automatically for

> +# the PowerPC 'future' machine.


"... automatically, for configurations that allow it"?

If the selector was only for the "future" target, that should be part of
the name; but it is not, that is just a detail of the actual test.

> +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=future}]

> +}



> +# Return 1 if the target generates prefixed instructions automatically for the

> +# PowerPC 'future' machine.


Same here.

(It is important that the description for each selector is clear and
accurate, and guides the potential user to what selector to use where).

Okay for trunk with that changed.  Thanks!


Segher

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index b335108..9d880f4 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2163,6 +2163,25 @@  proc check_p9vector_hw_available { } {
     }]
 }
 
+# Return 1 if the target generates PC-relative instructions automatically for
+# the PowerPC 'future' machine.
+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=future}]
+}
+
+# Return 1 if the target generates prefixed instructions automatically for the
+# PowerPC 'future' machine.
+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=future}]
+}
+
 # Return 1 if the target supports executing power9 modulo instructions, 0
 # otherwise.  Cache the result.