public inbox for
help / color / mirror / Atom feed
* [gcc r13-2630] xtensa: Implement new target hook: TARGET_CONSTANT_OK_FOR_CPROP_P
@ 2022-09-12 19:37 Max Filippov
  0 siblings, 0 replies; only message in thread
From: Max Filippov @ 2022-09-12 19:37 UTC (permalink / raw)
  To: gcc-cvs

commit r13-2630-g936efcac733fe49e5ea9e636403e5941f24ff1b3
Author: Takayuki 'January June' Suwa <>
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.
            * config/xtensa/ (TARGET_CONSTANT_OK_FOR_CPROP_P):
            New macro definition.
            Implement the hook as mentioned above.

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

diff --git a/gcc/config/xtensa/ b/gcc/config/xtensa/
index f1b3331ea55..cc1829d4aba 100644
--- a/gcc/config/xtensa/
+++ b/gcc/config/xtensa/
@@ -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);
@@ -345,12 +346,15 @@ static rtx xtensa_delegitimize_address (rtx);
 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
-#define TARGET_DELEGITIMIZE_ADDRESS xtensa_delegitimize_address
 #define TARGET_FUNCTION_OK_FOR_SIBCALL xtensa_function_ok_for_sibcall
+#define TARGET_CONSTANT_OK_FOR_CPROP_P xtensa_constant_ok_for_cprop_p
+#define TARGET_DELEGITIMIZE_ADDRESS xtensa_delegitimize_address
 struct gcc_target targetm = TARGET_INITIALIZER;
@@ -4983,6 +4987,16 @@ xtensa_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED, tree exp ATTRIBUTE_U
   return true;
+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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-12 19:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 19:37 [gcc r13-2630] xtensa: Implement new target hook: TARGET_CONSTANT_OK_FOR_CPROP_P Max Filippov

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).