| Issue |
61461
|
| Summary |
Clang does not consider commutativity when combining vector multiplications
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
aqjune
|
Given this code:
```
#include <arm_neon.h>
void f (uint64x2_t *__restrict__ y, uint32x2_t x[4]) {
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
y[i * 4 + j] = vmull_u32(x[i], x[j]);
}
}
}
```
Clang trunk generates 16 umull instructions :https://godbolt.org/z/5qeE8MEG9
This is not optimal because x[i] * x[j] is x[j] * x[i].
GCC trunk considers this and generates 10 umull instructions: https://godbolt.org/z/jaxan53Gn
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs