public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Fix up lra effective target
@ 2024-02-16 10:16 Jakub Jelinek
  2024-02-16 18:43 ` Mike Stump
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jakub Jelinek @ 2024-02-16 10:16 UTC (permalink / raw)
  To: Richard Biener, Rainer Orth, Mike Stump, Thomas Schwinge; +Cc: gcc-patches

Hi!

Given the recent discussions on IRC started with Andrew P. mentioning that
an asm goto outputs test should have { target lra } and the lra effective
target in GCC 11/12 only returning 0 for PA and in 13/14 for PA/AVR, while
we clearly have 14 other targets which don't support LRA and a couple of
further ones which have an -mlra/-mno-lra switch (whatever default they
have), seems to me the effective target is quite broken.

The following patch rewrites it, such that it has a fast path for heavily
used targets which are for years known to use only LRA (just an
optimization) plus determines whether it is a LRA target or reload target
by scanning the -fdump-rtl-reload-details dump on an empty function,
LRA has quite a few always emitted messages in that case while reload has
none of those.

Tested on x86_64-linux and cross to s390x-linux, for the latter with both
make check-gcc RUNTESTFLAGS='--target_board=unix/-mno-lra dg.exp=pr107385.c'
where the test is now UNSUPPORTED and
make check-gcc RUNTESTFLAGS='--target_board=unix/-mlra dg.exp=pr107385.c'
where it fails because I don't have libc around.

Ok for trunk?

There is one special case, NVPTX, which is a TARGET_NO_REGISTER_ALLOCATION
target.  I think claiming for it that it is a lra target is strange (even
though it effectively returns true for targetm.lra_p ()), unsure if it
supports asm goto with outputs or not, if it does and we want to test it,
perhaps we should introduce asm_goto_outputs effective target and use
lra || nvptx-*-* for that?

2024-02-16  Jakub Jelinek  <jakub@redhat.com>

	* lib/target-supports.exp (check_effective_target_lra): Rewrite
	to list some heavily used always LRA targets and otherwise check the
	-fdump-rtl-reload-details dump for messages specific to LRA.

--- gcc/testsuite/lib/target-supports.exp.jj	2024-02-15 09:51:34.591064180 +0100
+++ gcc/testsuite/lib/target-supports.exp	2024-02-16 10:50:29.986180603 +0100
@@ -13215,10 +13215,17 @@ proc check_effective_target_powerpc_as_p
 # return 1 if LRA is supported.
 
 proc check_effective_target_lra { } {
-    if { [istarget hppa*-*-*] || [istarget avr-*-*] } {
-	return 0
+    # Start with heavily used targets which are known to always use LRA.
+    if { [istarget i?86-*-*] || [istarget x86_64-*-*]
+	 || [istarget aarch64*-*-*] || [istarget arm*-*-*]
+	 || [istarget powerpc*-*-*] || [istarget riscv*-*-*] } {
+	return 1
     }
-    return 1
+
+    # Otherwise check the reload dump for messages emitted solely by LRA.
+    return [check_no_messages_and_pattern lra "\\\*{9} Local #1: \\\*{9}" rtl-reload {
+        void foo (void) {}
+    } {-O2 -fdump-rtl-reload-details}] ;# LRA notes requires a detailed dump.
 }
 
 # Test whether optimizations are enabled ('__OPTIMIZE__') per the

	Jakub


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-08 20:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 10:16 [PATCH] testsuite: Fix up lra effective target Jakub Jelinek
2024-02-16 18:43 ` Mike Stump
2024-02-16 18:48 ` Mike Stump
2024-03-21 11:20   ` New effective-target 'asm_goto_with_outputs' (was: [PATCH] testsuite: Fix up lra effective target) Thomas Schwinge
2024-03-22 18:17     ` New effective-target 'asm_goto_with_outputs' Jeff Law
2024-03-22 18:24       ` Jakub Jelinek
2024-03-22 18:55         ` Jeff Law
2024-04-08 20:13     ` New effective-target 'asm_goto_with_outputs' (was: [PATCH] testsuite: Fix up lra effective target) Thomas Schwinge
2024-02-26  2:10 ` [PATCH] testsuite: Fix up lra effective target Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).