[clang] [Clang] Treat `ext_vector_type` as a regular type attribute (PR #130177)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 6 16:30:45 PST 2025
AlexVlx wrote:
> > I'm not super thrilled about NOT having to introduce a type name, I'm not looking forward to the exciting world of `void foo(int __attribute__((ext_vector_type(4))) x)` replacing `void foo(int4 x)`.
>
> This makes introducing a type name easier because you can use `using` with templates. But I really don't think that it makes sense to restrict this to _only_ typedef, it's even listed as a FIXME in the original patch.
It is not restricted to `typedef` today, you can use it with `using`: <https://gcc.godbolt.org/z/j8xaqcMTo>. Not sure what you have in mind when you mention templates, there were indeed some oddities around them in dependent contexts, but this patch wouldn't address those I don't think so it's possible they got sorted out. Could you please clarify?
> I could force it to be double prefixed, but this really still should be a type level attribute, since it maps 1-to-1 with the LLVM vector type. I'd greatly prefer not to arbitrarily restrict it though, since it would be a major outlier.
I think you misunderstand, possibly because of my wording. I am not asking you to double prefix, I am saying you should not make this a C++ attribute, and leave it exclusively as is is today i.e. do not change it's spelling from GNU to Clang, which was called out in the initial design (confusingly tied to OCL, but different kettle of fish). It is perfectly fine and desirable for this to only be available as `__attribute__((ext_vector_type))`
https://github.com/llvm/llvm-project/pull/130177
More information about the cfe-commits
mailing list