在 2025/3/7 下午2:37, Lulu Cheng 写道:

在 2025/2/14 下午8:21, Xi Ruoyao 写道:
Despite it's just a special case of "a widening product of which the
result used for reduction," having these standard names allows to
recognize the dot product pattern earlier and it may be beneficial to
optimization.  Also fix some test failures with the test cases:

- gcc.dg/vect/vect-reduc-chain-2.c
- gcc.dg/vect/vect-reduc-chain-3.c
- gcc.dg/vect/vect-reduc-chain-dot-slp-3.c
- gcc.dg/vect/vect-reduc-chain-dot-slp-4.c

gcc/ChangeLog:

    * config/loongarch/simd.md (wvec_half): New define_mode_attr.
    (<su>dot_prod<wvec_half><mode>): New define_expand.

gcc/testsuite/ChangeLog:

    * gcc.target/loongarch/wide-mul-reduc-2.c (dg-final): Scan
    DOT_PROD_EXPR in optimized tree.
---
  gcc/config/loongarch/simd.md                  | 29 +++++++++++++++++++
  .../gcc.target/loongarch/wide-mul-reduc-2.c   |  3 +-
  2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/gcc/config/loongarch/simd.md b/gcc/config/loongarch/simd.md
index 661f5dc8dda..45d2bcaec2e 100644
--- a/gcc/config/loongarch/simd.md
+++ b/gcc/config/loongarch/simd.md
/* snip */
  +(define_expand "<su>dot_prod<wvec_half><mode>"
+  [(match_operand:<WVEC_HALF> 0 "register_operand" "=f,f")
+   (match_operand:IVEC          1 "register_operand" " f,f")
+   (match_operand:IVEC          2 "register_operand" " f,f")
+   (match_operand:<WVEC_HALF> 3 "reg_or_0_operand" " 0,YG")

Hi,

I have a question, why should operands[3] be the same operand as operands[0]?

Oh, I think I get it now, because we need to use vmaddw{ev/add}.

Thanks.



+   (any_extend (const_int 0))]
+  ""

Reply via email to