This patch is quite obvious patch which disallow for load/store address register
with RVV mode.
PR target/112535
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_legitimate_address_p): Disallow RVV modes base address.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr112535.c: New test.
riscv_legitimate_address_p (machine_mode mode, rtx x, bool strict_p,
code_helper = ERROR_MARK)
{
+ /* Disallow RVV modes base address.
+ E.g. (mem:SI (subreg:DI (reg:V1DI 155) 0). */
+ if (SUBREG_P (x) && riscv_v_ext_mode_p (GET_MODE (SUBREG_REG (x))))
+ return false;
struct riscv_address_info addr;
return riscv_classify_address (&addr, x, mode, strict_p);
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
+
+int *a, *f;
+char b, c;
+int ***d;
+static int ****e = &d;
+void g() {
+ c = 3;
+ for (; c; c--)
+ if (c < 8) {
+ f = 0;
+ ***e = a;
+ }
+ if (b)
+ ***d = 0;
+}