<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63971>63971</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SIMD] auto-vectorization using instruction usdot
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vfdff
</td>
</tr>
</table>
<pre>
test: https://gcc.godbolt.org/z/f86hxd8cT
```
#define N 480
unsigned int
f (unsigned int res, signed char *restrict a,
unsigned char *restrict b)
{
for (__INTPTR_TYPE__ i = 0; i < N; ++i)
{
int av = a[i];
int bv = b[i];
signed short mult = av * bv;
res += mult;
}
return res;
}
```
According [gcc-12](https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/gcc-12), **Armv8.6-A** introduced a new dot-product instruction for when the sign of the operands differ called [usdot](https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/USDOT--by-element---Dot-Product-with-unsigned-and-signed-integers--vector--by-element--). This instruction is introduced behind the **+i8mm** compiler flag.
Starting with GCC 12 the auto-vectorizer can now automatically recognize and use this instruction, while llvm can't.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVM9v-6gT_WvGlxGWA0lsH3xI6q-_6mG71TZ72FOFAdusbKgAJ9v-9StI-nM_UuXC8Jh58-YF7r0ejVIN7I6wazO-hsm65jzIYch6K1-boHwAdsAphBcP7AC0A9qNQuSjlb2dQ27dCLR7A9oN1X76R1biBEULxQH2xe3vuqVMqkEbhQ-4rd6D6buaREOiNuEaGRBo9TWMTnmgd3iLiIk7BHpwygenRUAO9O56FRE_Lv4H1gOtb5XL4zt-sBFUPT_fP5weT388n_56_N_zM2oE1mIB7JiWd_gQl0CPQI_6Iw8i4meuyJSf00UOu6OGXQvs-InEhOiviP7XiBt3P1kXcFnncE13jo1gf_6BdsonTqxN2G-nULbvG6fC6kxS8R3xcfpzUOl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