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-1168] xtensa: Fix RTL insn cost estimation about relaxed MOVI instructions
Date: Sun, 19 Jun 2022 23:26:02 +0000 (GMT)	[thread overview]
Message-ID: <20220619232602.00D343856DF6@sourceware.org> (raw)

https://gcc.gnu.org/g:46880cd8be7c307f147a8785ac8f58e04a35d34e

commit r13-1168-g46880cd8be7c307f147a8785ac8f58e04a35d34e
Author: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Date:   Mon Jun 20 04:13:56 2022 +0900

    xtensa: Fix RTL insn cost estimation about relaxed MOVI instructions
    
    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.

Diff:
---
 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;
 }


                 reply	other threads:[~2022-06-19 23:26 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=20220619232602.00D343856DF6@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).