[clang] [HLSL][longvec][Tablegen] Use templates to define Vector api's larger than 4 (PR #216143)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 14 12:10:50 PDT 2026


================
@@ -329,6 +329,14 @@ static void emitVectorOverload(const OverloadContext &Ctx, StringRef ElemType,
   });
 }
 
+/// Emit a dependent-size vector template overload for the given element type.
+static void emitLongVectorOverload(const OverloadContext &Ctx,
+                                   StringRef ElemType) {
+  emitOverload(Ctx, ElemType, [](StringRef ET) {
+    return ("vector<__detail::enable_if_t<(N > 4), " + ET + ">, N>").str();
----------------
bogner wrote:

I can't find the text right now, but I believe the TC57 wording is intended to be that the limit is implementation defined. DXC happens to choose 1024 but I don't think we need to follow suit here - from an implementation strategy perspective we're capable of legalizing whatever size until we run out of memory.

Omitting the upper limit in the template makes sense to me.

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


More information about the cfe-commits mailing list