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

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 9 07:33:59 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>
----------------
bcardosolopes wrote:

> like in this case, : form is better and can be nice distinguisher?

+1 here

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


More information about the cfe-commits mailing list