================
@@ -68,6 +68,45 @@ static mlir::Value emitVectorFCmp(CIRGenBuilderTy &builder,
return bitCast;
}
+// Convert the mask from an integer type to a vector of i1.
+static mlir::Value getMaskVecValue(CIRGenFunction &cgf, const CallExpr *expr,
+ mlir::Value mask, unsigned numElems) {
+ auto &builder = cgf.getBuilder();
+
+ cir::VectorType maskTy =
+ cir::VectorType::get(cgf.getBuilder().getSIntNTy(1),
+ 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<mlir::Attribute, 4> indices;
+ mlir::Type i32Ty = builder.getI32Type();
+ for (auto i : llvm::seq<unsigned>(0, numElems))
+ indices.push_back(cir::IntAttr::get(i32Ty, i));
+ maskVec = builder.createVecShuffle(cgf.getLoc(expr->getExprLoc()), maskVec,
+ maskVec, indices);
+ }
+ return maskVec;
+}
+
+static mlir::Value emitX86MaskLogic(CIRGenFunction &cgf, const CallExpr *expr,
+ cir::BinOpKind opc,
+ SmallVectorImpl<mlir::Value> &ops,
+ bool InvertLHS = false) {
+ CIRGenBuilderTy &builder = cgf.getBuilder();
+ unsigned numElts = cast<cir::IntType>(ops[0].getType()).getWidth();
+ mlir::Value LHS = getMaskVecValue(cgf, expr, ops[0], numElts);
----------------
HendrikHuebner wrote:
```suggestion
mlir::Value lhs = getMaskVecValue(cgf, expr, ops[0], numElts);
```
always start variable names with lowercase letters (even acronyms)
https://github.com/llvm/llvm-project/pull/169185
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits