1 //===- ComplexOps.cpp - MLIR Complex Operations ---------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir/Dialect/Complex/IR/Complex.h"
10 
11 using namespace mlir;
12 using namespace mlir::complex;
13 
14 //===----------------------------------------------------------------------===//
15 // TableGen'd op method definitions
16 //===----------------------------------------------------------------------===//
17 
18 #define GET_OP_CLASSES
19 #include "mlir/Dialect/Complex/IR/ComplexOps.cpp.inc"
20 
21 OpFoldResult ReOp::fold(ArrayRef<Attribute> operands) {
22   ArrayAttr arrayAttr = operands[0].dyn_cast<ArrayAttr>();
23   return arrayAttr[0];
24 }
25 
26 OpFoldResult ImOp::fold(ArrayRef<Attribute> operands) {
27   ArrayAttr arrayAttr = operands[0].dyn_cast<ArrayAttr>();
28   return arrayAttr[1];
29 }
30