public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>,
	Rainer Orth <ro@cebitec.uni-bielefeld.de>,
	Mike Stump <mikestump@comcast.net>,
	Thomas Schwinge <tschwinge@baylibre.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] testsuite: Fix up lra effective target
Date: Fri, 16 Feb 2024 11:16:22 +0100	[thread overview]
Message-ID: <Zc819iVeHfLDZb5y@tucnak> (raw)

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


             reply	other threads:[~2024-02-16 10:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 10:16 Jakub Jelinek [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zc819iVeHfLDZb5y@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikestump@comcast.net \
    --cc=rguenther@suse.de \
    --cc=ro@cebitec.uni-bielefeld.de \
    --cc=tschwinge@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).