]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Implement the vector dot product operation with quadruple width.
authorLulu Cheng <chenglulu@loongson.cn>
Thu, 23 Oct 2025 09:14:19 +0000 (17:14 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Fri, 31 Oct 2025 01:06:23 +0000 (09:06 +0800)
commit4b1a27a7ed19872855d9ec93c0d2edc3d8272269
tree748342e203a772b37823ea2550be90f2c4a4a807
parent8a3838d53d6010914ce05cf3c09c96bd68f87bae
LoongArch: Implement the vector dot product operation with quadruple width.

The logic for the vector dot product operation, where the destination
elements are quadruple the width of the source elements, is as
follows (Take sdot_prodv4siv16qi as an example.):

v16i8 src1, src2;
v4i32 src3, dest;

dest[0] = src1[0] * src2[0] + src1[1] * src2[1]
  + src1[2] * src2[2] + src1[3] * src2[3]
  + src3[0]
dest[1] = src1[4] * src2[4] + src1[5] * src2[5]
  + src1[6] * src2[6] + src1[7] * src2[7]
  + src3[1]
dest[2] = src1[8] * src2[8] + src1[9] * src2[9]
  + src1[10] * src2[10] + src1[11] * src2[11]
  + src3[2]
dest[3] = src1[12] * src2[12] + src1[13] * src2[13]
  + src1[14] * src2[14] + src1[15] * src2[15]
  + src3[3]

gcc/ChangeLog:

* config/loongarch/lasx.md (ILASX_HB): Move to ...
* config/loongarch/lsx.md (ILSX_HB): Move to ...
* config/loongarch/simd.md (ILSX_HB): ... here.
(ILASX_HB): ... here.
(IVEC_HB): New iterator.
(WVEC_QUARTER): New attr.
(wvec_quarter): Likewise.
(simdfmt_qw): Likewise.
(<su>dot_prod<wvec_quarter><mode>): New template.
gcc/config/loongarch/lasx.md
gcc/config/loongarch/lsx.md
gcc/config/loongarch/simd.md