[llvm-branch-commits] [llvm] RuntimeLibcalls: Describe vector FuncArgTypes by element type and count (PR #237489)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Oct 31 21:01:15 PDT 2026
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/237489
>From ac99979ca09fd5fc40426fedb7b882b949a30a1d Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 30 Oct 2026 22:17:36 -0700
Subject: [PATCH] RuntimeLibcalls: Describe vector FuncArgTypes by element type
and count
Define the vector libcall argument types from an element type and
count. Derive the matching integer and mask vector types from them
instead of spelling each one out.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
---
llvm/include/llvm/IR/RuntimeLibcallsImpl.td | 34 ++++++++++++---------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcallsImpl.td b/llvm/include/llvm/IR/RuntimeLibcallsImpl.td
index 3adeda2c42d399..95a8084ca2814a 100644
--- a/llvm/include/llvm/IR/RuntimeLibcallsImpl.td
+++ b/llvm/include/llvm/IR/RuntimeLibcallsImpl.td
@@ -105,20 +105,26 @@ def V16I32 : FuncArgType;
def NXV2I32 : FuncArgType;
def NXV4I32 : FuncArgType;
-class VectorFuncArgType<FuncArgType intType> : FuncArgType {
- FuncArgType IntType = intType;
- FuncArgType MaskType = ?;
-}
-
-def V2F32 : VectorFuncArgType<V2I32>;
-def V4F32 : VectorFuncArgType<V4I32>;
-def V8F32 : VectorFuncArgType<V8I32>;
-def V16F32 : VectorFuncArgType<V16I32>;
-def NXV4F32 : VectorFuncArgType<NXV4I32> { let MaskType = NXV4I1; }
-def V2F64 : VectorFuncArgType<V2I32>;
-def V4F64 : VectorFuncArgType<V4I32>;
-def V8F64 : VectorFuncArgType<V8I32>;
-def NXV2F64 : VectorFuncArgType<NXV2I32> { let MaskType = NXV2I1; }
+class VectorFuncArgType<FuncArgType elementType, int numElements,
+ bit scalable = false> : FuncArgType {
+ FuncArgType ElementType = elementType;
+ int NumElements = numElements;
+ bit Scalable = scalable;
+
+ defvar Prefix = !if(scalable, "NXV", "V") # numElements;
+ FuncArgType IntType = !cast<FuncArgType>(Prefix # "I32");
+ FuncArgType MaskType = !if(scalable, !cast<FuncArgType>(Prefix # "I1"), ?);
+}
+
+def V2F32 : VectorFuncArgType<Flt, 2>;
+def V4F32 : VectorFuncArgType<Flt, 4>;
+def V8F32 : VectorFuncArgType<Flt, 8>;
+def V16F32 : VectorFuncArgType<Flt, 16>;
+def NXV4F32 : VectorFuncArgType<Flt, 4, scalable = true>;
+def V2F64 : VectorFuncArgType<Dbl, 2>;
+def V4F64 : VectorFuncArgType<Dbl, 4>;
+def V8F64 : VectorFuncArgType<Dbl, 8>;
+def NXV2F64 : VectorFuncArgType<Dbl, 2, scalable = true>;
/// Abstract definition for functionality the compiler may need to
/// emit a call to. Emits the RTLIB::Libcall enum - This enum defines
More information about the llvm-branch-commits
mailing list