The V registers are always clobbered on calls.
gcc/ChangeLog
* config/riscv/riscv.cc (riscv_conditional_register_usage):
Always mark the V registers as clobbered on calls.
---
gcc/config/riscv/riscv.cc | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 675d92c0961..c18e61f4a03 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -5442,11 +5442,18 @@ riscv_conditional_register_usage (void)
if (!TARGET_VECTOR)
{
for (int regno = V_REG_FIRST; regno <= V_REG_LAST; regno++)
- fixed_regs[regno] = call_used_regs[regno] = 1;
+ fixed_regs[regno] = 1;
- fixed_regs[VTYPE_REGNUM] = call_used_regs[VTYPE_REGNUM] = 1;
- fixed_regs[VL_REGNUM] = call_used_regs[VL_REGNUM] = 1;
+ fixed_regs[VTYPE_REGNUM] = 1;
+ fixed_regs[VL_REGNUM] = 1;
}
+
+ /* The standard ABIs all clobber the entire vector state on calls. */
+ for (int regno = V_REG_FIRST; regno <= V_REG_LAST; regno++)
+ call_used_regs[regno] = 1;
+
+ call_used_regs[VTYPE_REGNUM] = 1;
+ call_used_regs[VL_REGNUM] = 1;
}
/* Return a register priority for hard reg REGNO. */
--
2.34.1