From: Robin Dapp <rdapp.gcc@gmail.com>
To: Robin Dapp via Gcc-patches <gcc-patches@gcc.gnu.org>,
jeffreyalaw <jeffreyalaw@gmail.com>,
"juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>,
Richard Biener <rguenther@suse.de>,
richard.sandiford@arm.com
Cc: rdapp.gcc@gmail.com
Subject: [PATCH v2] genopinit: Allow more than 256 modes.
Date: Tue, 11 Jul 2023 22:24:44 +0200 [thread overview]
Message-ID: <7f4427e7-37f2-428e-7d6b-8196f688ee72@gmail.com> (raw)
In-Reply-To: <mptfs5uwi4f.fsf@arm.com>
Attached is v2 that does not switch to uint64_t but stays within
32 bits by shifting the optab by 20 and the mode(s) by 10 bits.
Regards
Robin
Upcoming changes for RISC-V will have us exceed 255 modes or 8 bits.
This patch increases the limit to 10 bits and adjusts the hashing
function for the gen* and optabs-query lookups accordingly.
Consequently, the number of optabs is limited to 4095.
gcc/ChangeLog:
* genopinit.cc (main): Adjust maximal number of optabs and
machine modes.
* gensupport.cc (find_optab): Shift optab by 20 and mode by
10 bits.
* optabs-query.h (optab_handler): Ditto.
(convert_optab_handler): Ditto.
---
gcc/genopinit.cc | 5 ++---
gcc/gensupport.cc | 2 +-
gcc/optabs-query.h | 4 ++--
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/gcc/genopinit.cc b/gcc/genopinit.cc
index 6bd8858a1d9..2a841006884 100644
--- a/gcc/genopinit.cc
+++ b/gcc/genopinit.cc
@@ -182,8 +182,7 @@ main (int argc, const char **argv)
progname = "genopinit";
- if (NUM_OPTABS > 0xffff
- || MAX_MACHINE_MODE >= ((1 << MACHINE_MODE_BITSIZE) - 1))
+ if (NUM_OPTABS > 0xfff || NUM_MACHINE_MODES > 0x3ff)
fatal ("genopinit range assumptions invalid");
if (!init_rtx_reader_args_cb (argc, argv, handle_arg))
@@ -439,7 +438,7 @@ main (int argc, const char **argv)
"bool\n"
"swap_optab_enable (optab op, machine_mode m, bool set)\n"
"{\n"
- " unsigned scode = (op << 16) | m;\n"
+ " unsigned scode = (op << 20) | m;\n"
" int i = lookup_handler (scode);\n"
" if (i >= 0)\n"
" {\n"
diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
index e39e6dacce2..959d1d9c83c 100644
--- a/gcc/gensupport.cc
+++ b/gcc/gensupport.cc
@@ -3806,7 +3806,7 @@ find_optab (optab_pattern *p, const char *name)
{
p->name = name;
p->op = optabs[pindex].op;
- p->sort_num = (p->op << 16) | (p->m2 << 8) | p->m1;
+ p->sort_num = (p->op << 20) | (p->m2 << 10) | p->m1;
return true;
}
}
diff --git a/gcc/optabs-query.h b/gcc/optabs-query.h
index 043e9791bc1..920eb6a1b67 100644
--- a/gcc/optabs-query.h
+++ b/gcc/optabs-query.h
@@ -37,7 +37,7 @@ convert_optab_p (optab op)
inline enum insn_code
optab_handler (optab op, machine_mode mode)
{
- unsigned scode = (op << 16) | mode;
+ unsigned scode = (op << 20) | mode;
gcc_assert (op > LAST_CONV_OPTAB);
return raw_optab_handler (scode);
}
@@ -50,7 +50,7 @@ inline enum insn_code
convert_optab_handler (convert_optab op, machine_mode to_mode,
machine_mode from_mode)
{
- unsigned scode = (op << 16) | (from_mode << 8) | to_mode;
+ unsigned scode = (op << 20) | (from_mode << 10) | to_mode;
gcc_assert (convert_optab_p (op));
return raw_optab_handler (scode);
}
--
2.41.0
next prev parent reply other threads:[~2023-07-11 20:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 11:51 [PATCH] " Robin Dapp
2023-07-11 11:53 ` 钟居哲
2023-07-11 13:03 ` Richard Biener
2023-07-11 12:36 ` Richard Sandiford
2023-07-11 12:39 ` Richard Sandiford
2023-07-11 13:01 ` Robin Dapp
2023-07-11 13:31 ` Robin Dapp
2023-07-11 13:55 ` 钟居哲
[not found] ` <2023071121551283579845@rivai.ai>
2023-07-11 13:55 ` 钟居哲
2023-07-11 16:03 ` Richard Sandiford
2023-07-11 20:24 ` Robin Dapp [this message]
2023-07-12 7:18 ` [PATCH v2] " Richard Biener
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=7f4427e7-37f2-428e-7d6b-8196f688ee72@gmail.com \
--to=rdapp.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=juzhe.zhong@rivai.ai \
--cc=rguenther@suse.de \
--cc=richard.sandiford@arm.com \
/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).