Skip to content

simd vectorization regression starting with clang 14 #82936

Closed
@nschaeff

Description

@nschaeff

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions