================
@@ -68,6 +68,27 @@ static mlir::Value emitVectorFCmp(CIRGenBuilderTy &builder,
return bitCast;
}
+static mlir::Value getMaskVecValue(CIRGenFunction &cgf, const CallExpr *expr,
+ mlir::Value mask, unsigned numElems) {
+
+ CIRGenBuilderTy &builder = cgf.getBuilder();
+ auto maskTy = cir::VectorType::get(
+ builder.getBoolTy(), cast<cir::IntType>(mask.getType()).getWidth());
+ mlir::Value maskVec = builder.createBitcast(mask, maskTy);
+
+ // If we have less than 8 elements, then the starting mask was an i8 and
+ // we need to extract down to the right number of elements.
+ if (numElems < 8) {
+ SmallVector<int64_t, 4> indices;
+ for (auto i : llvm::seq<unsigned>(0, numElems))
+ indices.push_back(i);
----------------
andykaylor wrote:
```suggestion
SmallVector<mlir::Attribute, 4> indices;
mlir::Type i32Ty = getSInt32Ty();
for (auto i : llvm::seq<unsigned>(0, numElems))
indices.push_back(cir::IntAttr::get(i32Ty, i);
```
If we don't do this here, `createVecShuffle` will loop through the vector again
to do this.
https://github.com/llvm/llvm-project/pull/168591
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits