[clang] [llvm] [NVPTX] Cleanup and document nvvm.fabs intrinsics, adding f16 support (PR #135644)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 15 14:24:14 PDT 2025
================
@@ -309,6 +309,60 @@ space casted to this space), 1 is returned, otherwise 0 is returned.
Arithmetic Intrinsics
---------------------
+'``llvm.nvvm.fabs.*``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+.. code-block:: llvm
+
+ declare float @llvm.nvvm.fabs.f32(float %a)
+ declare double @llvm.nvvm.fabs.f64(double %a)
+ declare half @llvm.nvvm.fabs.f16(half %a)
+ declare <2 x half> @llvm.nvvm.fabs.v2f16(<2 x half> %a)
+ declare bfloat @llvm.nvvm.fabs.bf16(bfloat %a)
+ declare <2 x bfloat> @llvm.nvvm.fabs.v2bf16(<2 x bfloat> %a)
+
+Overview:
+"""""""""
+
+The '``llvm.nvvm.fabs.*``' intrinsics return the absolute value of the operand.
+
+Semantics:
+""""""""""
+
+Unlike, '``llvm.fabs.*``', these intrinsics do not perfectly preserve NaN
+values. Instead, a NaN input yeilds an unspecified NaN output. The exception to
+this rule is the double precision variant, for which NaN is preserved.
----------------
AlexMaclean wrote:
Yea, this is a good point. I've updated the docs to remove the exception. A NaN will now always yield an unspecified NaN output.
https://github.com/llvm/llvm-project/pull/135644
More information about the llvm-commits
mailing list