aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-12-25 17:35:41 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-06 20:13:06 +0000
commitcb14a3fe5122c879eae1fb480ed7ce82a699ddb6 (patch)
treeb983a613c35ece61d561b5a9ef9cd66419f6c7fb /contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
parent3d68ee6cbdb244de9fab1df8a2525d2fa592571e (diff)
parent99aabd70801bd4bc72c4942747f6d62c675112f5 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp b/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
index 91d8c31fa062..f90fca9d937f 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
@@ -12,6 +12,7 @@
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/ADT/EquivalenceClasses.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopIterator.h"
@@ -20,6 +21,7 @@
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Value.h"
@@ -1477,6 +1479,32 @@ void VFABI::getVectorVariantNames(
}
}
+FunctionType *VFABI::createFunctionType(const VFInfo &Info,
+ const FunctionType *ScalarFTy) {
+ // Create vector parameter types
+ SmallVector<Type *, 8> VecTypes;
+ ElementCount VF = Info.Shape.VF;
+ int ScalarParamIndex = 0;
+ for (auto VFParam : Info.Shape.Parameters) {
+ if (VFParam.ParamKind == VFParamKind::GlobalPredicate) {
+ VectorType *MaskTy =
+ VectorType::get(Type::getInt1Ty(ScalarFTy->getContext()), VF);
+ VecTypes.push_back(MaskTy);
+ continue;
+ }
+
+ Type *OperandTy = ScalarFTy->getParamType(ScalarParamIndex++);
+ if (VFParam.ParamKind == VFParamKind::Vector)
+ OperandTy = VectorType::get(OperandTy, VF);
+ VecTypes.push_back(OperandTy);
+ }
+
+ auto *RetTy = ScalarFTy->getReturnType();
+ if (!RetTy->isVoidTy())
+ RetTy = VectorType::get(RetTy, VF);
+ return FunctionType::get(RetTy, VecTypes, false);
+}
+
bool VFShape::hasValidParameterList() const {
for (unsigned Pos = 0, NumParams = Parameters.size(); Pos < NumParams;
++Pos) {