[llvm] [AMDGPU] Add half vector support for table-driven libcall optimzation (PR #178638)
Steffen Larsen via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 29 07:18:06 PST 2026
================
@@ -743,6 +743,38 @@ bool AMDGPULibCalls::fold(CallInst *CI) {
return false;
}
+static Constant *
+_Z4coshdgetConstantFloatVectorForArgType(LLVMContext &Ctx,
+ AMDGPULibFunc::EType ArgType,
+ ArrayRef<double> Values, Type *Ty) {
+ switch (ArgType) {
+ case AMDGPULibFunc::F16: {
+ SmallVector<uint16_t, 0> HalfIntValues;
+ for (double D : Values) {
+ APFloat APF16 = APFloat(D);
+ [[maybe_unused]] bool Unused;
+ APF16.convert(llvm::APFloat::IEEEhalf(),
+ llvm::RoundingMode::NearestTiesToEven, &Unused);
+ uint16_t APF16Int = APF16.bitcastToAPInt().getZExtValue();
+ HalfIntValues.push_back(APF16Int);
+ }
+ ArrayRef<uint16_t> Tmp(HalfIntValues);
+ return ConstantDataVector::getFP(Ty->getScalarType(), Tmp);
+ }
+ case AMDGPULibFunc::F32: {
+ SmallVector<float, 0> FValues;
----------------
steffenlarsen wrote:
I didn't pay it no mind, but you are absolutely right. I took the liberty of adding a reservation as well.
https://github.com/llvm/llvm-project/pull/178638
More information about the llvm-commits
mailing list