public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-2630] xtensa: Implement new target hook: TARGET_CONSTANT_OK_FOR_CPROP_P
Date: Mon, 12 Sep 2022 19:37:33 +0000 (GMT)	[thread overview]
Message-ID: <20220912193733.69A1F385C301@sourceware.org> (raw)

https://gcc.gnu.org/g:936efcac733fe49e5ea9e636403e5941f24ff1b3

commit r13-2630-g936efcac733fe49e5ea9e636403e5941f24ff1b3
Author: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Date:   Sun Sep 11 20:51:15 2022 +0900

    xtensa: Implement new target hook: TARGET_CONSTANT_OK_FOR_CPROP_P
    
    This patch implements new target hook TARGET_CONSTANT_OK_FOR_CPROP_P in
    order to exclude CONST_INTs that cannot fit into a MOVI machine instruction
    from cprop.
    
    gcc/ChangeLog:
    
            * config/xtensa/xtensa.cc (TARGET_CONSTANT_OK_FOR_CPROP_P):
            New macro definition.
            (xtensa_constant_ok_for_cprop_p):
            Implement the hook as mentioned above.

Diff:
---
 gcc/config/xtensa/xtensa.cc | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index f1b3331ea55..cc1829d4aba 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -191,6 +191,7 @@ static bool xtensa_can_eliminate (const int from ATTRIBUTE_UNUSED,
 static HOST_WIDE_INT xtensa_starting_frame_offset (void);
 static unsigned HOST_WIDE_INT xtensa_asan_shadow_offset (void);
 static bool xtensa_function_ok_for_sibcall (tree, tree);
+static bool xtensa_constant_ok_for_cprop_p (const_rtx);
 static rtx xtensa_delegitimize_address (rtx);
 
 \f
@@ -345,12 +346,15 @@ static rtx xtensa_delegitimize_address (rtx);
 #undef TARGET_HAVE_SPECULATION_SAFE_VALUE
 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
 
-#undef TARGET_DELEGITIMIZE_ADDRESS
-#define TARGET_DELEGITIMIZE_ADDRESS xtensa_delegitimize_address
-
 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
 #define TARGET_FUNCTION_OK_FOR_SIBCALL xtensa_function_ok_for_sibcall
 
+#undef TARGET_CONSTANT_OK_FOR_CPROP_P
+#define TARGET_CONSTANT_OK_FOR_CPROP_P xtensa_constant_ok_for_cprop_p
+
+#undef TARGET_DELEGITIMIZE_ADDRESS
+#define TARGET_DELEGITIMIZE_ADDRESS xtensa_delegitimize_address
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 \f
@@ -4983,6 +4987,16 @@ xtensa_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED, tree exp ATTRIBUTE_U
   return true;
 }
 
+/* Implement TARGET_CONSTANT_OK_FOR_CPROP_P.  */
+static bool
+xtensa_constant_ok_for_cprop_p (const_rtx x)
+{
+  if (CONST_INT_P (x) && ! xtensa_simm12b (INTVAL (x)))
+    return false;
+
+  return true;
+}
+
 static rtx
 xtensa_delegitimize_address (rtx op)
 {

                 reply	other threads:[~2022-09-12 19:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220912193733.69A1F385C301@sourceware.org \
    --to=jcmvbkbc@gcc.gnu.org \
    --cc=gcc-cvs@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).