[clang] [CIR] Upstream CreateOp for ComplexType with folder (PR #143192)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 7 03:58:31 PDT 2025
================
@@ -2226,4 +2226,36 @@ def VecTernaryOp : CIR_Op<"vec.ternary",
let hasVerifier = 1;
}
+//===----------------------------------------------------------------------===//
+// ComplexCreateOp
+//===----------------------------------------------------------------------===//
+
+def ComplexCreateOp : CIR_Op<"complex.create", [Pure, SameTypeOperands]> {
+ let summary = "Create a complex value from its real and imaginary parts";
+ let description = [{
+ The `cir.complex.create` operation takes two operands that represent the
+ real and imaginary part of a complex number, and yields the complex number.
+
+ ```mlir
+ %0 = cir.const #cir.fp<1.000000e+00> : !cir.double
+ %1 = cir.const #cir.fp<2.000000e+00> : !cir.double
+ %2 = cir.complex.create %0, %1 : !cir.complex<!cir.double>
----------------
xlauko wrote:
this does not match assemblyFormat
```suggestion
%2 = cir.complex.create %0, %1 : !cir.double -> !cir.complex<!cir.double>
```
https://github.com/llvm/llvm-project/pull/143192
More information about the cfe-commits
mailing list