diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -19713,6 +19713,116 @@ 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 @llvm.vp.gather.nxv2i8.nxv2p0i8( %ptrs, %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 @llvm.vp.gather.nxv4i32.nxv4p4i32( %ptrs, %mask, i32 %evl) + +Overview: +""""""""" + +The '``llvm.vp.gather.*``' intrinsic is the vector length predicated version of +the :ref:`llvm.masked.gather ` 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`. + +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( %val, %ptrs, %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( %val, %ptrs, %mask, i32 %evl) + +Overview: +""""""""" + +The '``llvm.vp.scatter.*``' intrinsic is the vector length predicated version of +the :ref:`llvm.masked.scatter ` 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`. + +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