[clang] [CIR] Implement AddOp for ComplexType (PR #147578)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 10 09:03:43 PDT 2025


================
@@ -2521,6 +2521,32 @@ def ComplexImagOp : CIR_Op<"complex.imag", [Pure]> {
   let hasFolder = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// ComplexAddOp
+//===----------------------------------------------------------------------===//
+
+def ComplexAddOp : CIR_Op<"complex.add", [Pure, SameOperandsAndResultType]> {
+  let summary = "Complex addition";
+  let description = [{
+    The `cir.complex.add` operation takes two complex numbers and returns
+    their sum.
+
+    Example:
+
+    ```mlir
+    %2 = cir.complex.add %0, %1 -> !cir.complex<!cir.float>
+    ```
+  }];
+
+  let arguments = (ins CIR_ComplexType:$lhs, CIR_ComplexType:$rhs);
----------------
AmrDeveloper wrote:

Yes, i think we should do that

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


More information about the cfe-commits mailing list