================
@@ -568,6 +568,128 @@ mlir::LogicalResult
CIRToLLVMGlobalOpLowering::matchAndRewrite(
return mlir::success();
}
+mlir::LogicalResult CIRToLLVMUnaryOpLowering::matchAndRewrite(
+ cir::UnaryOp op, OpAdaptor adaptor,
+ mlir::ConversionPatternRewriter &rewriter) const {
+ assert(op.getType() == op.getInput().getType() &&
+ "Unary operation's operand type and result type are different");
+ mlir::Type type = op.getType();
+ mlir::Type elementType = type;
+ bool isVector = false;
+ assert(!cir::MissingFeatures::vectorType());
+ mlir::Type llvmType = getTypeConverter()->convertType(type);
+ mlir::Location loc = op.getLoc();
+
+ auto createIntConstant = [&](int64_t value) -> mlir::Value {
----------------
andykaylor wrote:
On second thought, after looking more at the incubator code, I'm not so sure
this is worth having a wrapper. There are a lot of small variations that look
the same but aren't. Even in this function in the incubator my change to use
these lambdas isn't quite right for all cases. I'm going to put this back
closer to the way it was in the incubator. It's very slightly longer, but
probably less error prone.
https://github.com/llvm/llvm-project/pull/131369
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits