[clang] [llvm] [NVPTX] Cleanup and document nvvm.fabs intrinsics, adding f16 support (PR #135644)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 15:19:04 PDT 2025


================
@@ -1034,6 +1034,10 @@ Value *CodeGenFunction::EmitNVPTXBuiltinExpr(unsigned BuiltinID,
   case NVPTX::BI__nvvm_fmin_xorsign_abs_f16x2:
     return MakeHalfType(Intrinsic::nvvm_fmin_xorsign_abs_f16x2, BuiltinID, E,
                         *this);
+  case NVPTX::BI__nvvm_abs_bf16:
+  case NVPTX::BI__nvvm_abs_bf16x2:
+    return Builder.CreateUnaryIntrinsic(Intrinsic::nvvm_fabs,
----------------
Artem-B wrote:

While we're here, we should probably plumb in `abs` builtin for `f16`, too. Somehow we do not have builtins for them yet.

`neg` could also use exactly the same kind of improvements as this patch applies to abs, but that could be done separately.

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


More information about the llvm-commits mailing list