llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-amdgpu @llvm/pr-subscribers-clangir Author: Mallarapu Ujwal (ujwal-224) <details> <summary>Changes</summary> Part of #<!-- -->241525 Implements CIRGen support for `__builtin_amdgcn_frexp_expf`, lowering it to the `amdgcn.frexp.exp` LLVM intrinsic with the `int` return type, and adds CIR + LLVM IR test coverage in `clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip`. --- Full diff: https://github.com/llvm/llvm-project/pull/242167.diff 2 Files Affected: - (modified) clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp (+4-1) - (modified) clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip (+8) ``````````diff diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp index 6b87177b80bfd..647ebfb7dd9aa 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinAMDGPU.cpp @@ -636,8 +636,11 @@ CIRGenFunction::emitAMDGPUBuiltinExpr(unsigned builtinId, return emitBuiltinWithOneOverloadedType<1>(expr, "amdgcn.frexp.mant") .getValue(); } - case AMDGPU::BI__builtin_amdgcn_frexp_exp: case AMDGPU::BI__builtin_amdgcn_frexp_expf: + return emitBuiltinWithOneOverloadedType<1>(expr, "amdgcn.frexp.exp", + convertType(expr->getType())) + .getValue(); + case AMDGPU::BI__builtin_amdgcn_frexp_exp: case AMDGPU::BI__builtin_amdgcn_frexp_exph: { cgm.errorNYI(expr->getSourceRange(), std::string("unimplemented AMDGPU builtin call: ") + diff --git a/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip b/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip index 180f632b5050b..419709bf9e908 100644 --- a/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip +++ b/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip @@ -268,6 +268,14 @@ __device__ void test_frexp_mant_f64(double* out, double a) { *out = __builtin_amdgcn_frexp_mant(a); } +// CIR-LABEL: @_Z18test_frexp_exp_f32Pif +// CIR: cir.call_llvm_intrinsic "amdgcn.frexp.exp" {{.*}} : (!cir.float) -> !s32i +// LLVM: define{{.*}} void @_Z18test_frexp_exp_f32Pif +// LLVM: call{{.*}} i32 @llvm.amdgcn.frexp.exp.i32.f32(float %{{.*}}) +__device__ void test_frexp_exp_f32(int* out, float a) { + *out = __builtin_amdgcn_frexp_expf(a); +} + // CIR-LABEL: @_Z14test_fract_f32Pff // CIR: cir.call_llvm_intrinsic "amdgcn.fract" {{.*}} : (!cir.float) -> !cir.float // LLVM: define{{.*}} void @_Z14test_fract_f32Pff `````````` </details> https://github.com/llvm/llvm-project/pull/242167 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
