[Mlir-commits] [mlir] [MLIR] Implement emulation of static indexing subbyte type vector stores (PR #115922)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Jan 11 00:23:22 PST 2025
================
@@ -292,6 +296,89 @@ emulatedVectorLoad(OpBuilder &rewriter, Location loc, Value base,
newLoad);
}
+/// Selects values from two sources based on a mask, and casts the result to a
+/// new type.
+static Value selectAndCast(OpBuilder &builder, Location loc,
+ VectorType castIntoType, Value mask, Value trueValue,
+ Value falseValue) {
+ Value maskedValue =
+ builder.create<arith::SelectOp>(loc, mask, trueValue, falseValue);
+ return builder.create<vector::BitCastOp>(loc, castIntoType, maskedValue);
+}
+
+/// Emits `memref.generic_atomic_rmw` op to store a subbyte-sized value to a
+/// byte in memory, with a mask. The `valueToStore` is a vector of subbyte-sized
+/// elements, with size of 8 bits, and the mask is used to select which elements
+/// to store.
+///
+/// Inputs:
+/// linearizedMemref = |2|2|2|2| : <4xi2> (<1xi8>)
+/// linearizedIndex = 2
----------------
lialan wrote:
yes, you are correct! :-)
updated `storeIdx` as suggested.
https://github.com/llvm/llvm-project/pull/115922
More information about the Mlir-commits
mailing list