[clang] [CIR] Upstream DivOp for ComplexType (PR #153796)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 16 09:03:18 PDT 2025


================
@@ -858,6 +853,21 @@ mlir::Value ComplexExprEmitter::emitBinMul(const BinOpInfo &op) {
   return builder.createComplexCreate(op.loc, newReal, newImag);
 }
 
+mlir::Value ComplexExprEmitter::emitBinDiv(const BinOpInfo &op) {
+  assert(!cir::MissingFeatures::fastMathFlags());
+  assert(!cir::MissingFeatures::cgFPOptionsRAII());
+
+  if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
+      mlir::isa<cir::ComplexType>(op.rhs.getType())) {
+    cir::ComplexRangeKind rangeKind =
+        getComplexRangeAttr(op.fpFeatures.getComplexRange());
+    return builder.create<cir::ComplexDivOp>(op.loc, op.lhs, op.rhs, rangeKind);
+  }
+
+  cgf.cgm.errorNYI("ComplexExprEmitter::emitBinMu between Complex & Scalar");
----------------
xlauko wrote:

```suggestion
  cgf.cgm.errorNYI("ComplexExprEmitter::emitBinDiv between Complex & Scalar");
```

https://github.com/llvm/llvm-project/pull/153796


More information about the cfe-commits mailing list