From: Pan Li <[email protected]>

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]>
---
 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 8a97f35967f..7fbee404694 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -8240,7 +8240,7 @@ (define_insn "@pred_<reduc_op_pat_name><mode>"
             (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"
-- 
2.43.0

Reply via email to