[llvm-branch-commits] [clang] [CIR] Upstream ComplexImagPtrOp for ComplexType (PR #144236)
Henrich Lauko via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jul 11 07:29:14 PDT 2025
================
@@ -2385,4 +2385,62 @@ def ComplexCreateOp : CIR_Op<"complex.create", [Pure, SameTypeOperands]> {
let hasFolder = 1;
}
+//===----------------------------------------------------------------------===//
+// ComplexRealPtrOp
+//===----------------------------------------------------------------------===//
+
+def ComplexRealPtrOp : CIR_Op<"complex.real_ptr", [Pure]> {
+ let summary = "Derive a pointer to the real part of a complex value";
+ let description = [{
+ `cir.complex.real_ptr` operation takes a pointer operand that points to a
+ complex value of type `!cir.complex` and yields a pointer to the real part
+ of the operand.
+
+ Example:
+
+ ```mlir
+ %1 = cir.complex.real_ptr %0 : !cir.ptr<!cir.complex<!cir.double>> -> !cir.ptr<!cir.double>
+ ```
+ }];
+
+ let results = (outs CIR_PtrToIntOrFloatType:$result);
+ let arguments = (ins CIR_PtrToComplexType:$operand);
+
+ let assemblyFormat = [{
+ $operand `:`
+ qualified(type($operand)) `->` qualified(type($result)) attr-dict
+ }];
+
+ let hasVerifier = 1;
+}
+
+//===----------------------------------------------------------------------===//
+// ComplexImagPtrOp
+//===----------------------------------------------------------------------===//
+
+def ComplexImagPtrOp : CIR_Op<"complex.imag_ptr", [Pure]> {
+ let summary = "Derive a pointer to the imaginary part of a complex value";
+ let description = [{
+ `cir.complex.imag_ptr` operation takes a pointer operand that points to a
+ complex value of type `!cir.complex` and yields a pointer to the imaginary
+ part of the operand.
+
+ Example:
+
+ ```mlir
+ %1 = cir.complex.imag_ptr %0 : !cir.ptr<!cir.complex<!cir.double>> -> !cir.ptr<!cir.double>
----------------
xlauko wrote:
fix to 80 cols
https://github.com/llvm/llvm-project/pull/144236
More information about the llvm-branch-commits
mailing list