================
@@ -3155,6 +3155,88 @@ mlir::LogicalResult 
CIRToLLVMCmpOpLowering::matchAndRewrite(
   return cmpOp.emitError() << "unsupported type for CmpOp: " << type;
 }
 
+mlir::LogicalResult CIRToLLVMCmpThreeWayOpLowering::matchAndRewrite(
+    cir::CmpThreeWayOp op, OpAdaptor adaptor,
+    mlir::ConversionPatternRewriter &rewriter) const {
+  mlir::Location loc = op.getLoc();
+  auto info = op.getInfo();
+  mlir::Type resultTy = getTypeConverter()->convertType(op.getType());
+  mlir::Value lhs = adaptor.getLhs();
+  mlir::Value rhs = adaptor.getRhs();
+  mlir::Type operandTy = lhs.getType();
+
+  mlir::Value ltValue, eqValue, gtValue, unorderedValue;
+  if (auto strongInfo = mlir::dyn_cast<cir::CmpThreeWayStrongInfoAttr>(info)) {
+    ltValue = mlir::LLVM::ConstantOp::create(
+        rewriter, loc, resultTy,
+        rewriter.getI64IntegerAttr(strongInfo.getLt()));
+    eqValue = mlir::LLVM::ConstantOp::create(
+        rewriter, loc, resultTy,
+        rewriter.getI64IntegerAttr(strongInfo.getEq()));
+    gtValue = mlir::LLVM::ConstantOp::create(
+        rewriter, loc, resultTy,
+        rewriter.getI64IntegerAttr(strongInfo.getGt()));
+  } else if (auto partialInfo =
+                 mlir::dyn_cast<cir::CmpThreeWayPartialInfoAttr>(info)) {
+    ltValue = mlir::LLVM::ConstantOp::create(
+        rewriter, loc, resultTy,
+        rewriter.getI64IntegerAttr(partialInfo.getLt()));
+    eqValue = mlir::LLVM::ConstantOp::create(
+        rewriter, loc, resultTy,
+        rewriter.getI64IntegerAttr(partialInfo.getEq()));
+    gtValue = mlir::LLVM::ConstantOp::create(
+        rewriter, loc, resultTy,
+        rewriter.getI64IntegerAttr(partialInfo.getGt()));
+    unorderedValue = mlir::LLVM::ConstantOp::create(
+        rewriter, loc, resultTy,
+        rewriter.getI64IntegerAttr(partialInfo.getUnordered()));
+  } else {
+    return op.emitError("unsupported comparison info attribute");
----------------
ZakyHermawan wrote:

Can we give more information for the error message ?
like what comparison info attribute is supported ? or what comparison info 
attribute is this ?

https://github.com/llvm/llvm-project/pull/186294
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to