[clang] [AMDGPU][clang] provide device implementation for __builtin_logb and … (PR #129347)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 28 18:22:24 PST 2025
================
@@ -259,6 +259,26 @@ Value *readX18AsPtr(CodeGenFunction &CGF) {
return CGF.Builder.CreateIntToPtr(X18, CGF.Int8PtrTy);
}
+llvm::Constant *CodeGenModule::getDeviceLibFunction(const FunctionDecl *FD,
+ unsigned BuiltinID) {
+ GlobalDecl D(FD);
+ llvm::SmallString<64> Name;
+ if (getTarget().getTriple().isAMDGCN()) {
+ switch (BuiltinID) {
+ default: return nullptr;
+ case Builtin::BIlogb:
+ case Builtin::BI__builtin_logb:
+ Name = "__ocml_logb_f64";
----------------
jhuber6 wrote:
I don't think the solution is to start hard-coding DeivceRTL names in the compiler. Coincidentally I actually created an RFC about these kinds of problems just a few minutes ago https://discourse.llvm.org/t/rfc-lto-handling-math-libcalls-with-lto/84884.
https://github.com/llvm/llvm-project/pull/129347
More information about the cfe-commits
mailing list