https://gcc.gnu.org/g:2e046596d270a5c61b8a02e18e69211a04453d16

commit r17-6133-g2e046596d270a5c61b8a02e18e69211a04453d16
Author: Pan Li <[email protected]>
Date:   Fri Nov 6 10:39:51 2026 +0800

    RISC-V: Fix reg overlap for vs1 of vwadd[u].wv
    
    The vs2 of the vwadd[u].wv is read with EEW = 2 * SEW while the vs1
    is read with EEW = SEW.  The section 5.2 of the vector spec reserves
    any encoding in which one vector register supplies source operands
    with two or more different EEWs.  Thus, the vs1 must not fall inside
    the vs2 register group, but we may have below asm dump when the vs1
    comes from the vs2 register group.
    
      vwadd.wv v4,v4,v6
    
    Like the vfwadd.wv, take the Wn4 constraint for the operand 3 (aka vs2)
    of the vwadd[u].wv.  See below issue of the riscv-isa-manual for more
    details.
    
      https://github.com/riscv/riscv-isa-manual/issues/2350
    
    gcc/ChangeLog:
    
            * config/riscv/vector.md: Take the Wn4 constraint for the
            operand 3 of the vwadd[u].wv.
    
    Signed-off-by: Pan Li <[email protected]>

Diff:
---
 gcc/config/riscv/vector.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index 7fbee404694a..12025181f177 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -4237,7 +4237,7 @@
          (plus:VWEXTI
            (any_extend:VWEXTI
              (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" 
"Wvr,Wvr,Wvr,Wvr"))
-           (match_operand:VWEXTI 3 "register_operand"             " vr, vr, 
vr, vr"))
+           (match_operand:VWEXTI 3 "register_operand"             
"Wn4,Wn4,Wn4,Wn4"))
          (match_operand:VWEXTI 2 "vector_merge_operand"           " vu,  0, 
vu,  0")))]
   "TARGET_VECTOR"
   "vwadd<any_extend:u>.wv\t%0,%3,%4%p1"

Reply via email to