public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@axis.com>
To: <gcc-patches@gcc.gnu.org>
Subject: [PATCH 1/3] testsuite: Add tail_call effective target
Date: Mon, 6 Mar 2023 19:45:42 +0100	[thread overview]
Message-ID: <20230306184542.0517B20405@pchp3.se.axis.com> (raw)

Ok to commit?
-- >8 --
The RTL "expand" dump is the first RTL dump, and it also appears to be
the earliest trace of the target having implemented sibcalls.
Including the "," in the pattern searched for, to try and avoid
possible false matches, but there doesn't appear to be any identifiers
or target names nearby so this is just belts and suspenders.  Using
"tail_call" as a shorter and more commonly used term than a derivative
of "sibling calls", and expecting only gcc folks to have heard of
"sibcalls".

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

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 0ca7a9680bb4..958537b3b7c0 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -11684,6 +11684,15 @@ proc check_effective_target_frame_pointer_for_non_leaf { } {
   return 0
 }
 
+# Return 1 if the target can perform tail-call optimizations of the
+# most trivial type.
+proc check_effective_target_tail_call { } {
+    return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
+	__attribute__((__noipa__)) void foo (void) { }
+	__attribute__((__noipa__)) void bar (void) { foo(); }
+    } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+}
+
 # Return 1 if the target's calling sequence or its ABI
 # create implicit stack probes at or prior to function entry.
 proc check_effective_target_caller_implicit_probes { } {
-- 
2.30.2


             reply	other threads:[~2023-03-06 18:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 18:45 Hans-Peter Nilsson [this message]
2023-03-06 18:47 ` [PATCH 2/3] doc: Document testsuite check_effective_target_tail_call Hans-Peter Nilsson
2023-03-06 18:50 ` [PATCH 3/3] testsuite: Gate gcc.dg/plugin/must-tail-call-1.c and -2.c on tail_call Hans-Peter Nilsson
2023-03-06 18:52 ` [PATCH] testsuite: Support scanning tree-dumps Hans-Peter Nilsson
2023-03-06 21:17   ` Mike Stump
2023-03-06 21:14 ` [PATCH 1/3] testsuite: Add tail_call effective target Mike Stump

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=20230306184542.0517B20405@pchp3.se.axis.com \
    --to=hp@axis.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).