[clang] [CIR] Implement AddOp for ComplexType (PR #147578)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 9 00:08:57 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>
----------------
xlauko wrote:
We had discussion about return type assembly format this monday.
And I would like to unify return types to represented as `-> return_type`.
Though maybe in case the type applies to entire operation, like in this case, `:` form is better and can be nice distinguisher?
https://github.com/llvm/llvm-project/pull/147578
More information about the cfe-commits
mailing list