================
@@ -45,6 +46,93 @@
using namespace cir;
using namespace llvm;
+
+static std::string getLLVMIntrinsicNameForType(mlir::Type llvmTy) {
+ std::string s;
+ {
+ llvm::raw_string_ostream os(s);
+ os << llvmTy;
+ }
+ return s;
+}
+
+// Actual lowering
+mlir::LogicalResult CIRToLLVMSqrtOpLowering::matchAndRewrite(
+ cir::SqrtOp op, typename cir::SqrtOp::Adaptor adaptor,
+ mlir::ConversionPatternRewriter &rewriter) const {
+
+ mlir::Location loc = op.getLoc();
+ mlir::MLIRContext *ctx = rewriter.getContext();
+
+ mlir::Type cirResTy = op.getResult().getType();
+ mlir::Type llvmResTy = getTypeConverter()->convertType(cirResTy);
+ if (!llvmResTy)
+ return op.emitOpError(
+ "expected LLVM dialect result type for cir.sqrt lowering");
+
+ Value operand = adaptor.getInput();
+ Value llvmOperand = operand;
+ if (operand.getType() != llvmResTy) {
----------------
andykaylor wrote:
You don't need braces here.
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
https://github.com/llvm/llvm-project/pull/169310
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits