public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 2/2] xtensa: Fix RTL insn cost estimation about relaxed MOVI instructions
@ 2022-06-19 19:13 Takayuki 'January June' Suwa
  2022-06-19 23:27 ` Max Filippov
  0 siblings, 1 reply; 2+ messages in thread
From: Takayuki 'January June' Suwa @ 2022-06-19 19:13 UTC (permalink / raw)
  To: GCC Patches

These instructions will all be converted to L32R ones with litpool entries
by the assembler.

gcc/ChangeLog:

	* config/xtensa/xtensa.cc (xtensa_is_insn_L32R_p):
	Consider relaxed MOVI instructions as L32R.
---
 gcc/config/xtensa/xtensa.cc | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index 2c534ff9c60..13f2b2b832c 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -4286,17 +4286,23 @@ xtensa_is_insn_L32R_p (const rtx_insn *insn)
 {
   rtx x = PATTERN (insn);
 
-  if (GET_CODE (x) == SET)
+  if (GET_CODE (x) != SET)
+    return false;
+
+  x = XEXP (x, 1);
+  if (MEM_P (x))
     {
-      x = SET_SRC (x);
-      if (MEM_P (x))
-	{
-	  x = XEXP (x, 0);
-	  return (SYMBOL_REF_P (x) || CONST_INT_P (x))
-		 && CONSTANT_POOL_ADDRESS_P (x);
-	}
+      x = XEXP (x, 0);
+      return (SYMBOL_REF_P (x) || CONST_INT_P (x))
+	     && CONSTANT_POOL_ADDRESS_P (x);
     }
 
+  /* relaxed MOVI instructions, that will be converted to L32R by the
+     assembler.  */
+  if (CONST_INT_P (x)
+      && ! xtensa_simm12b (INTVAL (x)))
+    return true;
+
   return false;
 }
 
-- 
2.20.1

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

* Re: [PATCH 2/2] xtensa: Fix RTL insn cost estimation about relaxed MOVI instructions
  2022-06-19 19:13 [PATCH 2/2] xtensa: Fix RTL insn cost estimation about relaxed MOVI instructions Takayuki 'January June' Suwa
@ 2022-06-19 23:27 ` Max Filippov
  0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2022-06-19 23:27 UTC (permalink / raw)
  To: Takayuki 'January June' Suwa; +Cc: GCC Patches

On Sun, Jun 19, 2022 at 12:15 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> These instructions will all be converted to L32R ones with litpool entries
> by the assembler.
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.cc (xtensa_is_insn_L32R_p):
>         Consider relaxed MOVI instructions as L32R.
> ---
>  gcc/config/xtensa/xtensa.cc | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)

Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.

-- 
Thanks.
-- Max

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

end of thread, other threads:[~2022-06-19 23:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-19 19:13 [PATCH 2/2] xtensa: Fix RTL insn cost estimation about relaxed MOVI instructions Takayuki 'January June' Suwa
2022-06-19 23:27 ` 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).