[clang] [AMDGPU][clang] provide device implementation for __builtin_logb and … (PR #129347)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 21:46:21 PDT 2025


================
@@ -6011,10 +6011,27 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
   }
   }
 
+  // These will be emitted as Intrinsic later.
+  auto NeedsDeviceOverload = [&](unsigned BuiltinID) {
+    if (getTarget().getTriple().isAMDGCN()) {
+      switch (BuiltinID) {
+      default:
+        return false;
+      case Builtin::BIlogb:
+      case Builtin::BI__builtin_logb:
+      case Builtin::BIscalbn:
+      case Builtin::BI__builtin_scalbn:
+        return true;
+      }
+    }
+    return false;
+  };
----------------
choikwa wrote:

There is `llvm::isLibFuncEmittable(const Module *M, const TargetLibraryInfo *TLI, LibFunc TheLibFunc)` but unsure how to access TLI from CGBuiltin's CodeGenFunction::EmitBuiltinExpr.

https://github.com/llvm/llvm-project/pull/129347


More information about the cfe-commits mailing list