diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -15079,6 +15079,173 @@ that is used by the conditional branch controlling the loop. +Element-wise Reduction Intrinsics +--------------------------------- + +Element-wise reductions between two arguments can be expressed using the +following intrinsics. Each one takes two operands as an input and applies its +respective operation to the arguments element-wise, returning result of the +same type as the argument type. + + +'``llvm.smax.*``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +This is an overloaded intrinsic. You can use ``@llvm.smax`` on any +integer bit width, or any vector of integer elements. + +:: + + declare i32 @llvm.smax.i32(i32 %a, i32 %b) + declare <4 x i32> @llvm.smax.v4i32(<4 x i32> %a, <4 x i32> %b) + +Overview: +""""""""" + +The '``llvm.smax.*``' intrinsics do a signed integer ``MAX`` +element-wise reduction between the arguments. +The return type matches the type of the arguments. + +Arguments: +"""""""""" + +The arguments (``%a`` and ``%b``) may be of any integer type, or a vector with +integer element type. The return type must match the arguments type. +``%a`` and ``%b`` are the two values that will undergo element-wise reduction. + + +'``llvm.smin.*``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +This is an overloaded intrinsic. You can use ``@llvm.smin`` on any +integer bit width, or any vector of integer elements. + +:: + + declare i32 @llvm.smin.i32(i32 %a, i32 %b) + declare <4 x i32> @llvm.smin.v4i32(<4 x i32> %a, <4 x i32> %b) + +Overview: +""""""""" + +The '``llvm.smin.*``' intrinsics do a signed integer ``MIN`` +element-wise reduction between the arguments. +The return type matches the type of the arguments. + +Arguments: +"""""""""" + +The arguments (``%a`` and ``%b``) may be of any integer type, or a vector with +integer element type. The return type must match the arguments type. +``%a`` and ``%b`` are the two values that will undergo element-wise reduction. + + +'``llvm.umax.*``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +This is an overloaded intrinsic. You can use ``@llvm.umax`` on any +integer bit width, or any vector of integer elements. + +:: + + declare i32 @llvm.umax.i32(i32 %a, i32 %b) + declare <4 x i32> @llvm.umax.v4i32(<4 x i32> %a, <4 x i32> %b) + +Overview: +""""""""" + +The '``llvm.umax.*``' intrinsics do a unsigned integer ``MAX`` +element-wise reduction between the arguments. +The return type matches the type of the arguments. + +Arguments: +"""""""""" + +The arguments (``%a`` and ``%b``) may be of any integer type, or a vector with +integer element type. The return type must match the arguments type. +``%a`` and ``%b`` are the two values that will undergo element-wise reduction. + + +'``llvm.umin.*``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +This is an overloaded intrinsic. You can use ``@llvm.umin`` on any +integer bit width, or any vector of integer elements. + +:: + + declare i32 @llvm.umin.i32(i32 %a, i32 %b) + declare <4 x i32> @llvm.umin.v4i32(<4 x i32> %a, <4 x i32> %b) + +Overview: +""""""""" + +The '``llvm.umin.*``' intrinsics do a unsigned integer ``MIN`` +element-wise reduction between the arguments. +The return type matches the type of the arguments. + +Arguments: +"""""""""" + +The arguments (``%a`` and ``%b``) may be of any integer type, or a vector with +integer element type. The return type must match the arguments type. +``%a`` and ``%b`` are the two values that will undergo element-wise reduction. + + +'``llvm.abs.*``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +This is an overloaded intrinsic. You can use ``llvm.abs`` on any +integer bit width, or any vector of integer elements. + +:: + + declare i32 @llvm.abs.i32(i32 , i1 ) + declare <4 x i32> @llvm.abs.v4i32(<4 x i32> , i1 ) + +Overview: +""""""""" + +The '``llvm.abs``' family of intrinsic functions returns absolute value +of an argument. + +Arguments: +"""""""""" + +The first argument is the value for which the absolute value is to be returned. +This argument may be of any integer type, or a vector with integer element type. +The return type must match the first argument type. + +The second argument must be a constant and is a flag to indicate whether the +result value of the '``llvm.abs``' intrinsic is a a +:ref:`poison value `if the argument is statically or dynamically +an ``INT_MIN`` value. + +Semantics: +"""""""""" + +The '``llvm.abs``' intrinsic negates the argument, or each element of +the argument if it is negative. If the argument is ``INT_MIN``, then the result +is also ``INT_MIN`` if ``is_int_min_poison == 0`` and ``poison`` otherwise. + +.. _int_overflow: + + Experimental Vector Reduction Intrinsics ----------------------------------------