llvm / llvm/llvm-project

[LoopVectorize] Fails to generate VNNI vpdpbusd for u8xi8 dot product loops

Open
#187,779 4 comments 1 reaction 1 assignee Claimed by @hhy3 View on GitHub
backend:X86 missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

for simple u8xi8 dot product loops, gcc can generate expected vpdpbusd instructions while clang can only generate vpdpwssd.
```c++
int32_t dot_u8_i8(const uint8_t *a, const int8_t *b, int n) {
int32_t sum = 0;
for (int i = 0; i < n; i++) {
sum += (int32_t)a[i] * (int32_t)b[i];
}
return sum;
}
```
gcc: https://godbolt.org/z/4d678xfn8
clang: https://godbolt.org/z/G8sr99PMc

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.