Author: Harshit Date: 2026-11-27T09:04:00Z New Revision: 9fd613e3e725f7fde3f0556b292a81e8c42390c8
URL: https://github.com/llvm/llvm-project/commit/9fd613e3e725f7fde3f0556b292a81e8c42390c8 DIFF: https://github.com/llvm/llvm-project/commit/9fd613e3e725f7fde3f0556b292a81e8c42390c8.diff LOG: [CIR][AMDGPU] Add support for __builtin_amdgcn_log_clampf (#244000) Adds CIRGen support for `__builtin_amdgcn_log_clampf`, also adds CIR and LLVM IR test coverage in `clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip`. Part of #241525 Signed-off-by: Harshit Jha <[email protected]> Co-authored-by: Ayokunle Amodu <[email protected]> Added: Modified: clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip Removed: ################################################################################ diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp index feecc6af9cf214..5310c86768f3c7 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 e5511a5154d2e8..afaede9ef44aae 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
