[clang] [CIR] Support strict floating-point in Complex Add & Sub (PR #224851)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 15:54:51 PDT 2026


================
@@ -326,6 +326,24 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
     return cir::ComplexImagOp::create(*this, loc, resultType, operand);
   }
 
+  mlir::Value createComplexAdd(mlir::Location loc, mlir::Value lhs,
+                               mlir::Value rhs) {
+    cir::FenvAttr fenv;
+    if (isAnyFloatingPointType(
+            mlir::cast<cir::ComplexType>(lhs.getType()).getElementType()))
+      fenv = getConstrainedFPAttr();
+    return cir::ComplexAddOp::create(*this, loc, lhs, rhs, fenv);
----------------
andykaylor wrote:

I'd much rather have a separate ComplexFAddOp. I don't see the value of combining integer and floating-point operations.

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


More information about the cfe-commits mailing list