[VP] llvm.vp.fneg intrinsic and LangRef

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D119262
This commit is contained in:
Craig Topper 2022-02-09 07:54:07 -08:00
parent 62a775f1ea
commit 60745fb16f
4 changed files with 66 additions and 6 deletions

View File

@ -18599,7 +18599,7 @@ operation.
Semantics:
""""""""""
The '``llvm.vp.fadd``' intrinsic performs floating-point addition (:ref:`add <i_fadd>`)
The '``llvm.vp.fadd``' intrinsic performs floating-point addition (:ref:`fadd <i_fadd>`)
of the first and second vector operand on each enabled lane. The result on
disabled lanes is undefined. The operation is performed in the default
floating-point environment.
@ -18648,7 +18648,7 @@ operation.
Semantics:
""""""""""
The '``llvm.vp.fsub``' intrinsic performs floating-point subtraction (:ref:`add <i_fsub>`)
The '``llvm.vp.fsub``' intrinsic performs floating-point subtraction (:ref:`fsub <i_fsub>`)
of the first and second vector operand on each enabled lane. The result on
disabled lanes is undefined. The operation is performed in the default
floating-point environment.
@ -18697,7 +18697,7 @@ operation.
Semantics:
""""""""""
The '``llvm.vp.fmul``' intrinsic performs floating-point multiplication (:ref:`add <i_fmul>`)
The '``llvm.vp.fmul``' intrinsic performs floating-point multiplication (:ref:`fmul <i_fmul>`)
of the first and second vector operand on each enabled lane. The result on
disabled lanes is undefined. The operation is performed in the default
floating-point environment.
@ -18746,7 +18746,7 @@ operation.
Semantics:
""""""""""
The '``llvm.vp.fdiv``' intrinsic performs floating-point division (:ref:`add <i_fdiv>`)
The '``llvm.vp.fdiv``' intrinsic performs floating-point division (:ref:`fdiv <i_fdiv>`)
of the first and second vector operand on each enabled lane. The result on
disabled lanes is undefined. The operation is performed in the default
floating-point environment.
@ -18795,7 +18795,7 @@ operation.
Semantics:
""""""""""
The '``llvm.vp.frem``' intrinsic performs floating-point remainder (:ref:`add <i_frem>`)
The '``llvm.vp.frem``' intrinsic performs floating-point remainder (:ref:`frem <i_frem>`)
of the first and second vector operand on each enabled lane. The result on
disabled lanes is undefined. The operation is performed in the default
floating-point environment.
@ -18812,6 +18812,54 @@ Examples:
%also.r = select <4 x i1> %mask, <4 x float> %t, <4 x float> undef
.. _int_vp_fneg:
'``llvm.vp.fneg.*``' Intrinsics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Syntax:
"""""""
This is an overloaded intrinsic.
::
declare <16 x float> @llvm.vp.fneg.v16f32 (<16 x float> <op>, <16 x i1> <mask>, i32 <vector_length>)
declare <vscale x 4 x float> @llvm.vp.fneg.nxv4f32 (<vscale x 4 x float> <op>, <vscale x 4 x i1> <mask>, i32 <vector_length>)
declare <256 x double> @llvm.vp.fneg.v256f64 (<256 x double> <op>, <256 x i1> <mask>, i32 <vector_length>)
Overview:
"""""""""
Predicated floating-point negation of a vector of floating-point values.
Arguments:
""""""""""
The first operand and the result have the same vector of floating-point type.
The second operand is the vector mask and has the same number of elements as the
result vector type. The third operand is the explicit vector length of the
operation.
Semantics:
""""""""""
The '``llvm.vp.fneg``' intrinsic performs floating-point negation (:ref:`fneg <i_fneg>`)
of the first vector operand on each enabled lane. The result on disabled lanes
is undefined.
Examples:
"""""""""
.. code-block:: llvm
%r = call <4 x float> @llvm.vp.fneg.v4f32(<4 x float> %a, <4 x i1> %mask, i32 %evl)
;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
%t = fneg <4 x float> %a
%also.r = select <4 x i1> %mask, <4 x float> %t, <4 x float> undef
.. _int_vp_fma:
'``llvm.vp.fma.*``' Intrinsics

View File

@ -1505,6 +1505,11 @@ let IntrProperties =
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
llvm_i32_ty]>;
def int_vp_fneg : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
[ LLVMMatchType<0>,
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
llvm_i32_ty]>;
def int_vp_fma : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
[ LLVMMatchType<0>,
LLVMMatchType<0>,

View File

@ -211,6 +211,11 @@ HELPER_REGISTER_BINARY_FP_VP(frem, VP_FREM, FRem)
#undef HELPER_REGISTER_BINARY_FP_VP
// llvm.vp.fneg(x,mask,vlen)
BEGIN_REGISTER_VP(vp_fneg, 1, 2, VP_FNEG, -1)
VP_PROPERTY_FUNCTIONAL_OPC(FNeg)
END_REGISTER_VP(vp_fneg, VP_FNEG)
// llvm.vp.fma(x,y,z,mask,vlen)
BEGIN_REGISTER_VP(vp_fma, 3, 4, VP_FMA, -1)
VP_PROPERTY_CONSTRAINEDFP(1, 1, experimental_constrained_fma)

View File

@ -51,8 +51,10 @@ protected:
Str << " declare <8 x float> @llvm.vp." << BinaryFPOpcode
<< ".v8f32(<8 x float>, <8 x float>, <8 x i1>, i32) ";
Str << " declare <8 x float> @llvm.vp.fneg.v8f32(<8 x float>, <8 x i1>, "
"i32)";
Str << " declare <8 x float> @llvm.vp.fma.v8f32(<8 x float>, <8 x float>, "
"<8 x float>, <8 x i1>, i32) ";
"<8 x float>, <8 x i1>, i32) ";
Str << " declare void @llvm.vp.store.v8i32.p0v8i32(<8 x i32>, <8 x i32>*, "
"<8 x i1>, i32) ";