public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "palmer at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/115687] RISC-V optimization when "lui" instructions can be merged
Date: Thu, 27 Jun 2024 18:54:37 +0000	[thread overview]
Message-ID: <bug-115687-4-aM54IfKlTU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115687-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115687

--- Comment #5 from palmer at gcc dot gnu.org ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > There is some code in cse.cc which does handle this.
> > See
> > https://gcc.gnu.org/onlinedocs/gccint/Misc.html#index-
> > TARGET_005fCONST_005fANCHOR also.
> 
> MIPS, aarch64 and rs6000 all define TARGET_CONST_ANCHOR (well MIPS sets
> targetm.const_anchor depending on if it is mips16/micromips or mips32/64).

Oh, thanks, I didn't know about that.  It looks like just adding 

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 9bba5da016e..6080298c36c 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -12019,6 +12019,9 @@ riscv_c_mode_for_floating_type (enum tree_index ti)
 #undef TARGET_C_MODE_FOR_FLOATING_TYPE
 #define TARGET_C_MODE_FOR_FLOATING_TYPE riscv_c_mode_for_floating_type

+#undef TARGET_CONST_ANCHOR
+#define TARGET_CONST_ANCHOR 0x4000
+
 struct gcc_target targetm = TARGET_INITIALIZER;

 #include "gt-riscv.h"

isn't enough for us here, but it seems like we should have something along
those lines.  2d7c73ee5ea ("AArch64: Enable TARGET_CONST_ANCHOR") has a test
case, so hopefully it's not that tricky to get something that exposes the issue
on RISC-V as well...

  parent reply	other threads:[~2024-06-27 18:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 17:51 [Bug other/115687] New: " Explorer09 at gmail dot com
2024-06-27 18:17 ` [Bug target/115687] " palmer at gcc dot gnu.org
2024-06-27 18:30 ` pinskia at gcc dot gnu.org
2024-06-27 18:32 ` pinskia at gcc dot gnu.org
2024-06-27 18:49 ` palmer at gcc dot gnu.org
2024-06-27 18:54 ` palmer at gcc dot gnu.org [this message]
2024-06-27 20:39 ` andrew at sifive dot com
2024-06-27 21:02 ` vineetg at gcc dot gnu.org
2024-06-27 21:57 ` palmer at gcc dot gnu.org

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=bug-115687-4-aM54IfKlTU@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).