| Issue |
60946
|
| Summary |
Clang ignores the `min_vector_width` attribute
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
He3lixxx
|
Consider this code snippet ([godbolt](https://godbolt.org/z/b59MvarKq)):
```c++
void test(uint64_t* input_, uint64_t* output_) __attribute__((min_vector_width(512))) {
uint64_t* __restrict input = std::assume_aligned<64>(input_);
uint64_t* __restrict output = std::assume_aligned<64>(output_);
for (size_t i = 0; i < 64; ++i) {
output[i] = input[i] * 16;
}
}
```
When compiling on x86 with `-std=c++20 -O3 -march=icelake-server`, this resulting assembly does not use the 512-bit registers (`zmm`), but the AVX2 256-bit registers (`ymm`).
I understand that clang defaults to `-mprefer-vector-width=256`, but [according to the documentation](https://clang.llvm.org/docs/AttributeReference.html#min-vector-width), the `min_vector_width` attribute should overrule this default.
With `-mprefer-vector-width=512`, clang [uses the `zmm` registers](https://godbolt.org/z/eEoPE96xT).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs