[Mlir-commits] [mlir] 7d76da5 - [mlir][Complex] Add a convenience getValue() method.

Adrian Kuegel llvmlistbot at llvm.org
Fri Jul 29 06:35:51 PDT 2022


Author: Adrian Kuegel
Date: 2022-07-29T15:35:39+02:00
New Revision: 7d76da539fca28c6e2b920d760223fc39b15d21a

URL: https://github.com/llvm/llvm-project/commit/7d76da539fca28c6e2b920d760223fc39b15d21a
DIFF: https://github.com/llvm/llvm-project/commit/7d76da539fca28c6e2b920d760223fc39b15d21a.diff

LOG: [mlir][Complex] Add a convenience getValue() method.

This method returns the value as std::complex<APFloat>

Differential Revision: https://reviews.llvm.org/D130770

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td b/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td
index ab6074eccb53..afae94c41ad8 100644
--- a/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td
+++ b/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td
@@ -53,6 +53,12 @@ def Complex_NumberAttr : Complex_Attr<"Number", "number"> {
     }]>
   ];
 
+  let extraClassDeclaration = [{
+    std::complex<APFloat> getValue() {
+      return std::complex<APFloat>(getReal(), getImag());
+    }
+  }];
+
   let genVerifyDecl = 1;
   let hasCustomAssemblyFormat = 1;
   let skipDefaultBuilders = 1;


        


More information about the Mlir-commits mailing list