[PATCH] D47680: [Docs] Add the missing documentation for expandload and compressstore intrinsics

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 2 17:00:26 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: RKSimon, delena, hfinkel, spatel.

These intrinsics have been avaible in llvm for a few years and are implemented by the X86 target for AVX512. But it looks like they were never documented.

We may also be missing scalarization support on targets that don't support them. And I think we probably handle them incorrectly in type legalization.


https://reviews.llvm.org/D47680

Files:
  docs/LangRef.rst


Index: docs/LangRef.rst
===================================================================
--- docs/LangRef.rst
+++ docs/LangRef.rst
@@ -12922,6 +12922,37 @@
        %loadlal = load <16 x float>, <16 x float>* %ptr, align 4
        %res = select <16 x i1> %mask, <16 x float> %loadlal, <16 x float> %passthru
 
+.. _int_mexpandload:
+
+'``llvm.masked.expandload.*``' Intrinsics
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+This is an overloaded intrinsic. The loaded data is a vector of any integer, floating-point or pointer data type.
+
+::
+
+      declare <16 x float>  @llvm.masked.expandload.v16f32(float* <ptr>, <16 x i1> <mask>, <16 x float> <passthru>)
+      declare <2 x double>  @llvm.masked.expandload.v2f64(double* <ptr>, <2 x i1>  <mask>, <2 x double> <passthru>)
+
+Overview:
+"""""""""
+
+Reads contiguous values from memory to sparse elements in the result vector selected by the provided mask. The masked-off lanes in the result vector are taken from the corresponding lanes of the '``passthru``' operand.
+
+
+Arguments:
+""""""""""
+
+The first operand is the base pointer for the load. The second operand, mask, is a vector of boolean values with the same number of elements as the return type. The fourth is a pass-through value that is used to fill the masked-off lanes of the result. The return type and the type of the '``passthru``' operand are the same vector types. The pointer type is the element type of the vector.
+
+
+Semantics:
+""""""""""
+
+The '``llvm.masked.expandload``' intrinsic is designed for conditional expansion of vector elements from memory in a single IR operation. It is useful for targets that support expanding vector masked loads. Other targets may support this intrinsic differently, for example by lowering it into a sequence of branches that guard scalar load operations.
+
 .. _int_mstore:
 
 '``llvm.masked.store.*``' Intrinsics
@@ -12966,6 +12997,35 @@
        %res = select <16 x i1> %mask, <16 x float> %value, <16 x float> %oldval
        store <16 x float> %res, <16 x float>* %ptr, align 4
 
+.. _int_mcompressstore:
+
+'``llvm.masked.compressstore.*``' Intrinsics
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+This is an overloaded intrinsic. The data stored in memory is a vector of any integer, floating-point or pointer data type.
+
+::
+
+       declare void @llvm.masked.compressstore.v8i32(<8  x i32> <value>, i32* <ptr>, <8  x i1> <mask>)
+       declare void @llvm.masked.compressstore.v16f32(<16 x float> <value>, float* <ptr>, <16 x i1> <mask>)
+
+Overview:
+"""""""""
+
+Writes contiguous memory according by compressing source elements according to the provided mask. The mask holds a bit for each vector lane. If the mask bit is not set that element will not be written to memory.
+
+Arguments:
+""""""""""
+
+The first operand is the vector value to be written to memory. The second operand is the base pointer for the store, its type is the element type of the value operand. The third operand, mask, is a vector of boolean values. The types of the mask and the value operand must have the same number of vector elements.
+
+
+Semantics:
+""""""""""
+
+The '``llvm.masked.compressstore``' intrinsics is designed for conditional writing of selected vector elements in a single IR operation. It is useful for targets that support vector masked compressed store. Other targets may support this intrinsic differently, for example by lowering it into a sequence of branches that guard scalar store operations.
 
 Masked Vector Gather and Scatter Intrinsics
 -------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47680.149621.patch
Type: text/x-patch
Size: 3619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180603/31dc7904/attachment.bin>


More information about the llvm-commits mailing list