Closed
Description
A simple loop multiplying two arrays, with different multiplicity fails to vectorize efficiently on clang 14+, while it worked with clang 13.0.1
The loop is the following, where 4 consecutive values in data are multiplied by the same factor :
for (int i=0; i<n; i++) {
for (int k=0; k<4; k++) data[4*i+k] *= factor[i];
}
See on godbolt to see the crazy code generated by clang 14+, while clang 13.0.1 correctly uses vbroadcastsd
:
https://godbolt.org/z/desh4E49o