[clang] [CIR][NVPTX] Add support for NVVM half type builtins (PR #221859)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 7 18:23:09 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clangir
Author: Ayokunle Amodu (ayokunle321)
<details>
<summary>Changes</summary>
Adds codegen for the following NVVM half type builtins:
- `__nvvm_ex2_approx_{f16,f16x2}`
- `__nvvm_fmin{_ftz,}{_nan,}{_xorsign_abs,}_{f16,f16x2}`
- `__nvvm_fmax{_ftz,}{_nan,}{_xorsign_abs,}_{f16,f16x2}`
- `__nvvm_fma_rn{_ftz,}{_relu,_sat,}_{f16,f16x2}`
- `__nvvm_fma_rn_oob{_relu,}_{f16,bf16,f16x2,bf16x2}`
These are lowered to the corresponding llvm.nvvm.* intrinsics.
This diverges a bit from OG, as no half-type helper is needed here. OG routes these through `MakeHalfType`, which coerces each argument to the intrinsic's declared parameter type, appends the intrinsic's defaulted arguments, and
asserts that no argument is an integer constant expression. None of that is needed for the builtins in this patch as each already agrees with its intrinsic on operand and result types, and none has defaulted parameters. The existing
`emitUnaryNVVMIntrinsic` and `emitBuiltinWithOneOverloadedType<N>` helpers are therefore sufficient.
More generally, nothing `MakeHalfType` does is half-specific, and its coercion looks unexercises, i.e., the NVVM intrinsics whose builtins carry defaulted arguments are resolved by `Intrinsic::getIntrinsicForClangBuiltin` and handled by the generic intrinsic path before target dispatch, which does its own argument coercion and appends the defaults. The one part of `MakeHalfType` that is load-bearing is its trailing-argument parameter, used by the `_pzo` conversion variants; those are
not added here.
Assisted by Claude.
---
Patch is 46.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/221859.diff
3 Files Affected:
- (modified) clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp (+112-218)
- (added) clang/test/CIR/CodeGenCUDA/builtins-nvvm-fma-oob.cu (+94)
- (added) clang/test/CIR/CodeGenCUDA/builtins-nvvm-half.cu (+391)
``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp
index 8b33d85d49fe1..9bf5660100c14 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp
@@ -517,16 +517,6 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, const CallExpr *expr) {
getContext().BuiltinInfo.getName(builtinId));
return mlir::Value{};
// The following builtins require half type support
- case NVPTX::BI__nvvm_ex2_approx_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
- case NVPTX::BI__nvvm_ex2_approx_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
case NVPTX::BI__nvvm_ff2f16x2_rn:
cgm.errorNYI(expr->getSourceRange(),
std::string("unimplemented NVPTX builtin call: ") +
@@ -548,265 +538,167 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, const CallExpr *expr) {
getContext().BuiltinInfo.getName(builtinId));
return mlir::Value{};
case NVPTX::BI__nvvm_fma_rn_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.f16")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_ftz_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.ftz.f16")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_ftz_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.ftz.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_ftz_relu_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.ftz.relu.f16")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_ftz_relu_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr,
+ "nvvm.fma.rn.ftz.relu.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_ftz_sat_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.ftz.sat.f16")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_ftz_sat_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr,
+ "nvvm.fma.rn.ftz.sat.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_relu_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.relu.f16")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_relu_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.relu.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_sat_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.sat.f16")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_sat_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.sat.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_oob_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
case NVPTX::BI__nvvm_fma_rn_oob_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
case NVPTX::BI__nvvm_fma_rn_oob_bf16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
case NVPTX::BI__nvvm_fma_rn_oob_bf16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.oob")
+ .getValue();
case NVPTX::BI__nvvm_fma_rn_oob_relu_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
case NVPTX::BI__nvvm_fma_rn_oob_relu_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
case NVPTX::BI__nvvm_fma_rn_oob_relu_bf16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
case NVPTX::BI__nvvm_fma_rn_oob_relu_bf16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<3>(expr, "nvvm.fma.rn.oob.relu")
+ .getValue();
case NVPTX::BI__nvvm_fmax_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.ftz.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.ftz.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_nan_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.ftz.nan.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_nan_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.ftz.nan.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_nan_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmax.ftz.nan.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_nan_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmax.ftz.nan.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmax.ftz.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_ftz_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmax.ftz.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmax_nan_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.nan.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_nan_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmax.nan.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmax_nan_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmax.nan.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_nan_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmax.nan.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmax_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmax.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmax_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmax.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.ftz.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.ftz.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_nan_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.ftz.nan.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_nan_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.ftz.nan.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_nan_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmin.ftz.nan.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_nan_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmin.ftz.nan.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmin.ftz.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_ftz_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmin.ftz.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_nan_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.nan.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_nan_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr, "nvvm.fmin.nan.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_nan_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmin.nan.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_nan_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(
+ expr, "nvvm.fmin.nan.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fmin_xorsign_abs_f16:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmin.xorsign.abs.f16")
+ .getValue();
case NVPTX::BI__nvvm_fmin_xorsign_abs_f16x2:
- cgm.errorNYI(expr->getSourceRange(),
- std::string("unimplemented NVPTX builtin call: ") +
- getContext().BuiltinInfo.getName(builtinId));
- return mlir::Value{};
+ return emitBuiltinWithOneOverloadedType<2>(expr,
+ "nvvm.fmin.xorsign.abs.f16x2")
+ .getValue();
case NVPTX::BI__nvvm_fabs_f:
case NVPTX::BI__nvvm_abs_bf16:
case NVPTX::BI__nvvm_abs_bf16x2:
@@ -821,6 +713,8 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, const CallExpr *expr) {
return emitUnaryNVVMIntrinsic(*this, expr, "fabs");
case NVPTX::BI__nvvm_ex2_approx_d:
case NVPTX::BI__nvvm_ex2_approx_f:
+ case NVPTX::BI__nvvm_ex2_approx_f16:
+ case NVPTX::BI__nvvm_ex2_approx_f16x2:
return emitUnaryNVVMIntrinsic(*this, expr, "nvvm.ex2.approx");
case NVPTX::BI__nvvm_ex2_approx_ftz_f:
return emitUnaryNVVMIntrinsic(*this, expr, "nvvm.ex2.approx.ftz");
diff --git a/clang/test/CIR/CodeGenCUDA/builtins-nvvm-fma-oob.cu b/clang/test/CIR/CodeGenCUDA/builtins-nvvm-fma-oob.cu
new ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/221859
More information about the cfe-commits
mailing list