From: Pan Li <[email protected]>

The widening absolute difference and accumulate insn vwabda[u].vv
reads the vd as the accumulator with EEW = 2 * SEW, while the vs1
and vs2 are 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 and vs2
must not overlap the vd register group, even in the highest-numbered
part.  But the Wvr constraint introduced by the commit 6df026ea07b
allows that, and we may have below asm dump.

  vwabda.vv v8,v9,v10   # LMUL = 1, SEW = 16

Disable the register overlap for vwabda[u].vv by the early clobber
vr, like the other widening multiply-add insns.

        PR target/128162

gcc/ChangeLog:

        * config/riscv/vector.md: Take the early clobber vr instead of
        the Wvr constraint for vwabda[u].vv.

Signed-off-by: Pan Li <[email protected]>
---
 gcc/config/riscv/vector.md | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index 6c7c944ee5b..8a97f35967f 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -9317,20 +9317,20 @@ (define_insn "@pred_vabd<su><mode>"
    (set_attr "mode" "<MODE>")])
 
 (define_insn "@pred_widen_abd_plus<su><mode>"
-  [(set (match_operand:VWEXTI_HS 0 "register_operand"    "=vd,  vr")
+  [(set (match_operand:VWEXTI_HS 0 "register_operand"              "=&vr")
        (if_then_else:VWEXTI_HS
          (unspec:<VM>
-           [(match_operand:<VM> 1 "vector_mask_operand" " vm, Wc1")
-            (match_operand 5 "vector_length_operand"    "rvl, rvl")
-            (match_operand 6 "const_int_operand"        " i,    i")
-            (match_operand 7 "const_int_operand"        " i,    i")
-            (match_operand 8 "const_int_operand"        " i,    i")
+           [(match_operand:<VM> 1 "vector_mask_operand"          "vmWc1")
+            (match_operand 5 "vector_length_operand"             "  rvl")
+            (match_operand 6 "const_int_operand"                 "    i")
+            (match_operand 7 "const_int_operand"                 "    i")
+            (match_operand 8 "const_int_operand"                 "    i")
             (reg:SI VL_REGNUM)
             (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
          (unspec:VWEXTI_HS
-           [(match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "Wvr, Wvr")
-            (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "Wvr, Wvr")
-            (match_operand:VWEXTI_HS 2 "register_operand"        "  0,   0")]
+           [(match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "   vr")
+            (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "   vr")
+            (match_operand:VWEXTI_HS        2 "register_operand" "    0")]
            UNSPEC_VABDA)
          (match_dup 2)))]
   "TARGET_ZVABD"
-- 
2.43.0

Reply via email to