[libc-commits] [clang] [libc] [RFC][clang][libc] Extend the ext_vector_type attribute to support the scalable vector sizes (PR #183307)

Paul Osmialowski via libc-commits libc-commits at lists.llvm.org
Sat Feb 28 07:42:02 PST 2026


pawosm-arm wrote:

> I don't think a negative number is the most straightforward solution.

I looked into it more closely, and I guess there is a better solution for this. We may try to extend the `ext_vector_type` attribute with an optional boolean parameter. Similarly to the optional `offset` parameter in the `assume_aligned` attribute, where `offset` is taken to be zero if omitted:

```
__attribute__((assume_aligned(<alignment>[, <offset>]))
```

We could do similar thing to the `ext_vector_type` attribute, where `is_scalable` is taken to be `false` if omitted:

```
__attribute__((ext_vector_type(<size>[, <is_scalable>]))
```

The C++ `simd` template would be simply something like this:

```
template <typename T,
                   size_t N = internal::native_vector_size<T>,
                   bool S = internal::native_vector_is_scalable<T>>
using simd = T [[clang::ext_vector_type(N, S)]];
```

Meanwhile, I'll try to prepare a rudimentary PoC for this.

https://github.com/llvm/llvm-project/pull/183307


More information about the libc-commits mailing list