[LangRef][VP] Document vp.gather and vp.scatter intrinsics

This patch fleshes out the missing documentation for the final two VP
intrinsics introduced in D99355: `llvm.vp.gather` and `llvm.vp.scatter`.
It does so mostly by deferring to the `llvm.masked.gather` and
`llvm.masked.scatter` intrinsics, respectively.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D112997
This commit is contained in:
Fraser Cormack 2021-11-01 16:41:46 +00:00
parent 6981e5ec91
commit 3a11fb572c
1 changed files with 110 additions and 0 deletions

View File

@ -19713,6 +19713,116 @@ Examples:
call void @llvm.masked.store.v8i8.p0v8i8(<8 x i8> %val, <8 x i8>* %ptr, i32 8, <8 x i1> %mask)
.. _int_vp_gather:
'``llvm.vp.gather``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Syntax:
"""""""
This is an overloaded intrinsic.
::
declare <4 x double> @llvm.vp.gather.v4f64.v4p0f64(<4 x double*> %ptrs, <4 x i1> %mask, i32 %evl)
declare <vscale x 2 x i8> @llvm.vp.gather.nxv2i8.nxv2p0i8(<vscale x 2 x i8*> %ptrs, <vscale x 2 x i1> %mask, i32 %evl)
declare <2 x float> @llvm.vp.gather.v2f32.v2p2f32(<2 x float addrspace(2)*> %ptrs, <2 x i1> %mask, i32 %evl)
declare <vscale x 4 x i32> @llvm.vp.gather.nxv4i32.nxv4p4i32(<vscale x 4 x i32 addrspace(4)*> %ptrs, <vscale x 4 x i1> %mask, i32 %evl)
Overview:
"""""""""
The '``llvm.vp.gather.*``' intrinsic is the vector length predicated version of
the :ref:`llvm.masked.gather <int_mgather>` intrinsic.
Arguments:
""""""""""
The first operand is a vector of pointers which holds all memory addresses to
read. The second operand is a vector of boolean values with the same number of
elements as the return type. The third is the explicit vector length of the
operation. The return type and underlying type of the vector of pointers are
the same vector types.
Semantics:
""""""""""
The '``llvm.vp.gather``' intrinsic reads multiple scalar values from memory in
the same way as the '``llvm.masked.gather``' intrinsic, where the mask is taken
from the combination of the '``mask``' and '``evl``' operands in the usual VP
way. Of the '``llvm.masked.gather``' operands not set by '``llvm.vp.gather``':
the '``passthru``' operand is implicitly ``undef``; the '``alignment``' operand
is taken as the ABI alignment of the source addresses as specified by the
:ref:`datalayout string<langref_datalayout>`.
Examples:
"""""""""
.. code-block:: text
%r = call void @llvm.vp.scatter.v8i8.v8p0i8(<8 x i8> %val, <8 x i8*> %ptrs, <8 x i1> %mask, i32 %evl)
;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
;; Note that since the alignment is ultimately up to the data layout
;; string, 8 is used as an example.
%also.r = call void @llvm.masked.scatter.v8i8.v8p0i8(<8 x i8> %val, <8 x i8*> %ptrs, i32 8, <8 x i1> %mask, <8 x i8> undef)
.. _int_vp_scatter:
'``llvm.vp.scatter``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Syntax:
"""""""
This is an overloaded intrinsic.
::
declare void @llvm.vp.scatter.v4f64.v4p0f64(<4 x double> %val, <4 x double*> %ptrs, <4 x i1> %mask, i32 %evl)
declare void @llvm.vp.scatter.nxv2i8.nxv2p0i8(<vscale x 2 x i8> %val, <vscale x 2 x i8*> %ptrs, <vscale x 2 x i1> %mask, i32 %evl)
declare void @llvm.vp.scatter.v2f32.v2p2f32(<2 x float> %val, <2 x float addrspace(2)*> %ptrs, <2 x i1> %mask, i32 %evl)
declare void @llvm.vp.scatter.nxv4i32.nxv4p4i32(<vscale x 4 x i32> %val, <vscale x 4 x i32 addrspace(4)*> %ptrs, <vscale x 4 x i1> %mask, i32 %evl)
Overview:
"""""""""
The '``llvm.vp.scatter.*``' intrinsic is the vector length predicated version of
the :ref:`llvm.masked.scatter <int_mscatter>` intrinsic.
Arguments:
""""""""""
The first operand is a vector value to be written to memory. The second operand
is a vector of pointers, pointing to where the value elements should be stored.
The third operand is a vector of boolean values with the same number of
elements as the return type. The fourth is the explicit vector length of the
operation.
Semantics:
""""""""""
The '``llvm.vp.scatter``' intrinsic writes multiple scalar values to memory in
the same way as the '``llvm.masked.scatter``' intrinsic, where the mask is
taken from the combination of the '``mask``' and '``evl``' operands in the
usual VP way. The '``alignment``' operand of the '``llvm.masked.scatter``'
intrinsic is not set by '``llvm.vp.scatter``': it is taken as the ABI alignment
of the destination addresses as specified by the :ref:`datalayout
string<langref_datalayout>`.
Examples:
"""""""""
.. code-block:: text
call void @llvm.vp.scatter.v8i8.v8p0i8(<8 x i8> %val, <8 x i8*> %ptrs, <8 x i1> %mask, i32 %evl)
;; For all lanes below %evl, the call above is lane-wise equivalent to the call below.
;; Note that since the alignment is ultimately up to the data layout
;; string, 8 is used as an example.
call void @llvm.masked.scatter.v8i8.v8p0i8(<8 x i8> %val, <8 x i8*> %ptrs, i32 8, <8 x i1> %mask)
.. _int_mload_mstore:
Masked Vector Load and Store Intrinsics