https://gcc.gnu.org/g:b95850f0c0df9e90f7a5bad61f76627bff5501c9

commit r17-5911-gb95850f0c0df9e90f7a5bad61f76627bff5501c9
Author: Pan Li <[email protected]>
Date:   Mon Nov 2 10:18:01 2026 +0800

    RISC-V: Fix reg overlap for vs1 of the widening float reduction
    
    Like the widening integer reduction, the vs1 of the widening float
    reduction (aka vfwredosum.vs and vfwredusum.vs) is read with
    EEW = 2 * SEW while the vs2 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.
    
      vfwredosum.vs v4,v4,v5
    
    Take the Wn3 constraint for the operand 4 (aka vs1) of the widening
    float reduction.  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 Wn3 constraint for the
            operand 4 of the widening float reduction.
    
    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 8a97f35967f5..7fbee404694a 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -8240,7 +8240,7 @@
             (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
            (unspec:<V_EXT_LMUL1> [
             (match_operand:VF_HS          3 "register_operand"      "   vr,   
vr")
-            (match_operand:<V_EXT_LMUL1>  4 "register_operand"      "   vr,   
vr")
+            (match_operand:<V_EXT_LMUL1>  4 "register_operand"      "  Wn3,  
Wn3")
            ] ANY_FWREDUC_SUM)
           (match_operand:<V_EXT_LMUL1>    2 "vector_merge_operand"  "   vu,    
0")] UNSPEC_REDUC))]
   "TARGET_VECTOR"

Reply via email to