[Mlir-commits] [mlir] [MLIR] Implement emulation of static indexing subbyte type vector stores (PR #115922)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Jan 10 06:57:07 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);
+}
----------------
banach-space wrote:

[nit]s
```suggestion
/// 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 newType, Value mask, Value trueValue,
                           Value falseValue) {
  Value selectedValue =
      builder.create<arith::SelectOp>(loc, mask, trueValue, falseValue);
  return builder.create<vector::BitCastOp>(loc, newType, maskedValue);
}
```

https://github.com/llvm/llvm-project/pull/115922


More information about the Mlir-commits mailing list