public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix incorrect mode tieable which cause ICE in RA[PR111296]
@ 2023-09-11 13:38 Jeff Law
0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2023-09-11 13:38 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:821fdd7049282270a0a78a70694bc8def6292877
commit 821fdd7049282270a0a78a70694bc8def6292877
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date: Wed Sep 6 22:28:03 2023 +0800
RISC-V: Fix incorrect mode tieable which cause ICE in RA[PR111296]
This patch fix incorrect mode tieable between DI and V2SI which cause ICE
in RA.
gcc/ChangeLog:
PR target/111296
* config/riscv/riscv.cc (riscv_modes_tieable_p): Fix incorrect mode
tieable for RVV modes.
gcc/testsuite/ChangeLog:
PR target/111296
* g++.target/riscv/rvv/base/pr111296.C: New test.
(cherry picked from commit 6b96de22d6bcadb45530c1898b264e4738afa4fd)
Diff:
---
gcc/config/riscv/riscv.cc | 5 +++++
gcc/testsuite/g++.target/riscv/rvv/base/pr111296.C | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 228515acc1f0..a3d3389e7e25 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -7648,6 +7648,11 @@ riscv_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
static bool
riscv_modes_tieable_p (machine_mode mode1, machine_mode mode2)
{
+ /* We don't allow different REG_CLASS modes tieable since it
+ will cause ICE in register allocation (RA).
+ E.g. V2SI and DI are not tieable. */
+ if (riscv_v_ext_mode_p (mode1) != riscv_v_ext_mode_p (mode2))
+ return false;
return (mode1 == mode2
|| !(GET_MODE_CLASS (mode1) == MODE_FLOAT
&& GET_MODE_CLASS (mode2) == MODE_FLOAT));
diff --git a/gcc/testsuite/g++.target/riscv/rvv/base/pr111296.C b/gcc/testsuite/g++.target/riscv/rvv/base/pr111296.C
new file mode 100644
index 000000000000..6eb14fd83a80
--- /dev/null
+++ b/gcc/testsuite/g++.target/riscv/rvv/base/pr111296.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c++03 -march=rv64gcv -mabi=lp64d -Ofast -ftree-vectorize --param=riscv-autovec-preference=scalable" } */
+
+struct a
+{
+ int b;
+ int c;
+};
+int d;
+a
+e ()
+{
+ a f;
+ int g = d - 1, h = d / 2 - 1;
+ f.b = g;
+ f.c = h;
+ return f;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-11 13:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 13:38 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix incorrect mode tieable which cause ICE in RA[PR111296] Jeff Law
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).