https://github.com/blenbot updated https://github.com/llvm/llvm-project/pull/244000
>From 8281b1ef58a7b0355721c64f5e882b5bb31f7366 Mon Sep 17 00:00:00 2001 From: Harshit Jha <[email protected]> Date: Wed, 18 Nov 2026 20:42:42 +0000 Subject: [PATCH] Add support for __builtin_amdgcn_log_clampf Signed-off-by: Harshit Jha <[email protected]> --- clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp | 6 ++---- clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip | 8 ++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp index 1654f36851d15..b5a98cf92c289 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp @@ -626,10 +626,8 @@ CIRGenFunction::emitAMDGPUBuiltinExpr(unsigned builtinId, return emitBuiltinWithOneOverloadedType<1>(expr, "amdgcn.exp2").getValue(); } case AMDGPU::BI__builtin_amdgcn_log_clampf: { - cgm.errorNYI(expr->getSourceRange(), - std::string("unimplemented AMDGPU builtin call: ") + - getContext().BuiltinInfo.getName(builtinId)); - return mlir::Value{}; + return emitBuiltinWithOneOverloadedType<1>(expr, "amdgcn.log.clamp") + .getValue(); } case AMDGPU::BI__builtin_amdgcn_ldexp: case AMDGPU::BI__builtin_amdgcn_ldexpf: diff --git a/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip b/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip index 83b2f955fd8c6..73095a0545d2f 100644 --- a/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip +++ b/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip @@ -252,6 +252,14 @@ __device__ void test_log_f32(float* out, float a) { *out = __builtin_amdgcn_logf(a); } +// CIR-LABEL: @_Z18test_log_clamp_f32Pff +// CIR: cir.call_llvm_intrinsic "amdgcn.log.clamp" {{.*}} : (!cir.float) -> !cir.float +// LLVM: define{{.*}} void @_Z18test_log_clamp_f32Pff +// LLVM: call{{.*}} float @llvm.amdgcn.log.clamp.f32(float %{{.*}}) +__device__ void test_log_clamp_f32(float* out, float a) { + *out = __builtin_amdgcn_log_clampf(a); +} + // CIR-LABEL: @_Z19test_frexp_mant_f32Pff // CIR: cir.call_llvm_intrinsic "amdgcn.frexp.mant" {{.*}} : (!cir.float) -> !cir.float // LLVM: define{{.*}} void @_Z19test_frexp_mant_f32Pff _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
