aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/riscv/thead.cc
diff options
context:
space:
mode:
authorChristoph Müllner <christoph.muellner@vrull.eu>2023-12-05 01:00:11 +0100
committerChristoph Müllner <christoph.muellner@vrull.eu>2023-12-07 10:31:36 +0100
commit8c09c73adf4c537876e8ef418378d6581b768a64 (patch)
tree67ba42ad73c4b6e63408a5bcbb501c18c63d006a /gcc/config/riscv/thead.cc
parentbf38c6374b5fb6a2afa05af26432f1fd1a120bc4 (diff)
downloadgcc-8c09c73adf4c537876e8ef418378d6581b768a64.zip
gcc-8c09c73adf4c537876e8ef418378d6581b768a64.tar.gz
gcc-8c09c73adf4c537876e8ef418378d6581b768a64.tar.bz2
RISC-V: xtheadfmemidx: Disable if xtheadmemidx is not available
XTheadMemIdx provides register-register offsets for GP register loads/stores. XTheadFMemIdx does the same for FP registers. We've observed an issue with XTheadFMemIdx-only builds, where FP registers have been promoted to GP registers: (insn 26 22 51 (set (reg:DF 15 a5 [orig:136 <retval> ] [136]) (mem/u:DF (plus:DI (reg/f:DI 15 a5 [141]) (reg:DI 10 a0 [144])) [1 CSWTCH.2[_10]+0 S8 A64])) 217 {*movdf_hardfloat_rv64} (expr_list:REG_DEAD (reg:DI 10 a0 [144]) (nil))) This results in the following assembler error: Assembler messages: Error: unrecognized opcode `th.lrd a5,a5,a0,0', extension `xtheadmemidx' required There seems to be a (reasonable) assumption, that addressing modes for FP registers are compatible with those of GP registers. We already ran into a similar issue during development of the XTheadFMemIdx support patch, where we could trace the issue down to the optimization splitters. Back then we simply disabled them in case XTheadMemIdx is not available. But as it turned out, that was not enough. To ensure, we won't see such issues anymore, let's make the support for XTheadFMemIdx depend on XTheadMemIdx. I.e., if only XTheadFMemIdx is available, then no instructions of this extension will be emitted. While this looks a bit drastic at first view, it is the best practical solution since XTheadFMemIdx without XTheadMemIdx does not exist in real hardware and would be an odd thing to do. gcc/ChangeLog: * config/riscv/thead.cc (th_memidx_classify_address_index): Require TARGET_XTHEADMEMIDX for FP modes. * config/riscv/thead.md: Require TARGET_XTHEADMEMIDX for all XTheadFMemIdx pattern. gcc/testsuite/ChangeLog: * gcc.target/riscv/xtheadfmemidx-without-xtheadmemidx.c: New test. Reported-by: Jin Ma <jinma@linux.alibaba.com> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Diffstat (limited to 'gcc/config/riscv/thead.cc')
-rw-r--r--gcc/config/riscv/thead.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/config/riscv/thead.cc b/gcc/config/riscv/thead.cc
index bd9af7e..2035399 100644
--- a/gcc/config/riscv/thead.cc
+++ b/gcc/config/riscv/thead.cc
@@ -603,7 +603,8 @@ th_memidx_classify_address_index (struct riscv_address_info *info, rtx x,
{
/* Ensure that the mode is supported. */
if (!(TARGET_XTHEADMEMIDX && is_memidx_mode (mode))
- && !(TARGET_XTHEADFMEMIDX && is_fmemidx_mode (mode)))
+ && !(TARGET_XTHEADMEMIDX
+ && TARGET_XTHEADFMEMIDX && is_fmemidx_mode (mode)))
return false;
if (GET_CODE (x) != PLUS)