Skip to contentSkip to conversation

target/riscv: rvv: Handle mask/source overlap of vector reduction instructions

PATCH Applied Anton Blanchard 3 participants 3 messages Apr 17 – Apr 28 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/riscv: rvv: Handle mask/source overlap of vector reduction instructions

Masked vector reduction instructions must not use v0 as a source register. Check rs1 and rs2 against the mask register when vm=0.

---
 target/riscv/insn_trans/trans_rvv.c.inc | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/insn_trans/trans_rvv.c.inc +2 -0
index d9a0027e0b..6e8d32636e 100644
@@ -3046,6 +3046,8 @@ static bool reduction_check(DisasContext *s, arg_rmrr *a)
 {
     return require_rvv(s) &&
            vext_check_isa_ill(s) &&
+           require_vm(a->vm, a->rs1) &&
+           require_vm(a->vm, a->rs2) &&
            vext_check_reduction(s, a->rs2);
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Anton Blanchard

Masked vector reduction instructions must not use v0 as a source register. Check rs1 and rs2 against the mask register when vm=0.

---

Quoted 16 lines
  target/riscv/insn_trans/trans_rvv.c.inc | 2 ++
  1 file changed, 2 insertions(+)
target/riscv/insn_trans/trans_rvv.c.inc +2 -0
index d9a0027e0b..6e8d32636e 100644
@@ -3046,6 +3046,8 @@ static bool reduction_check(DisasContext *s, arg_rmrr *a)
  {
      return require_rvv(s) &&
             vext_check_isa_ill(s) &&
+           require_vm(a->vm, a->rs1) &&
+           require_vm(a->vm, a->rs2) &&
             vext_check_reduction(s, a->rs2);
  }
 
#2 lore raw
In reply to Anton Blanchard
Quoted 5 lines · Anton Blanchard

Masked vector reduction instructions must not use v0 as a source register. Check rs1 and rs2 against the mask register when vm=0.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 21 lines
---
 target/riscv/insn_trans/trans_rvv.c.inc | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/insn_trans/trans_rvv.c.inc +2 -1
index d9a0027e0b..6e8d32636e 100644
@@ -3046,6 +3046,8 @@ static bool reduction_check(DisasContext *s, arg_rmrr *a)
 {
     return require_rvv(s) &&
            vext_check_isa_ill(s) &&
+           require_vm(a->vm, a->rs1) &&
+           require_vm(a->vm, a->rs2) &&
            vext_check_reduction(s, a->rs2);
 }
 
--

2.34.1