[llvm] [llvm-c] Create a 128 bit floating point constant from 2 64 bit values (PR #164381)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 29 09:17:46 PDT 2025
================
@@ -1573,6 +1573,14 @@ LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[],
return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Str, SLen)));
}
+LLVMValueRef LLVMConstFP128(LLVMTypeRef Ty, const uint64_t N[2]) {
+ Type *T = unwrap(Ty);
+ assert(T->getPrimitiveSizeInBits() == 128 && "Ty size should be 128");
+ APInt AI(128, ArrayRef<uint64_t>(N, 2));
----------------
nikic wrote:
Rather than hardcoding 128 here, we can use the size of the float (e.g. via getScalarSizeInBits). The corresponding size of the array would be `divideCeil(SizeInBits, 64)`. Then this would work for all sizes of floats.
https://github.com/llvm/llvm-project/pull/164381
More information about the llvm-commits
mailing list