|
| 1 | +//===- DivisionConverter.h - Complex division conversion ------*- C++ -*-===// |
| 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 | +#ifndef MLIR_CONVERSION_COMPLEXCOMMON_DIVISIONCONVERTER_H |
| 10 | +#define MLIR_CONVERSION_COMPLEXCOMMON_DIVISIONCONVERTER_H |
| 11 | + |
| 12 | +#include "mlir/Conversion/LLVMCommon/ConversionTarget.h" |
| 13 | +#include "mlir/Dialect/Arith/IR/Arith.h" |
| 14 | +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" |
| 15 | + |
| 16 | +namespace mlir { |
| 17 | +namespace complex { |
| 18 | +/// convert a complex division to the LLVM dialect using algebraic method |
| 19 | +void convertDivToLLVMUsingAlgebraic(ConversionPatternRewriter &rewriter, |
| 20 | + Location loc, Value lhsRe, Value lhsIm, |
| 21 | + Value rhsRe, Value rhsIm, |
| 22 | + LLVM::FastmathFlagsAttr fmf, |
| 23 | + Value *resultRe, Value *resultIm); |
| 24 | + |
| 25 | +/// convert a complex division to the arith/math dialects using algebraic method |
| 26 | +void convertDivToStandardUsingAlgebraic(ConversionPatternRewriter &rewriter, |
| 27 | + Location loc, Value lhsRe, Value lhsIm, |
| 28 | + Value rhsRe, Value rhsIm, |
| 29 | + arith::FastMathFlagsAttr fmf, |
| 30 | + Value *resultRe, Value *resultIm); |
| 31 | + |
| 32 | +/// convert a complex division to the LLVM dialect using Smith's method |
| 33 | +void convertDivToLLVMUsingRangeReduction(ConversionPatternRewriter &rewriter, |
| 34 | + Location loc, Value lhsRe, Value lhsIm, |
| 35 | + Value rhsRe, Value rhsIm, |
| 36 | + LLVM::FastmathFlagsAttr fmf, |
| 37 | + Value *resultRe, Value *resultIm); |
| 38 | + |
| 39 | +/// convert a complex division to the arith/math dialects using Smith's method |
| 40 | +void convertDivToStandardUsingRangeReduction( |
| 41 | + ConversionPatternRewriter &rewriter, Location loc, Value lhsRe, Value lhsIm, |
| 42 | + Value rhsRe, Value rhsIm, arith::FastMathFlagsAttr fmf, Value *resultRe, |
| 43 | + Value *resultIm); |
| 44 | + |
| 45 | +} // namespace complex |
| 46 | +} // namespace mlir |
| 47 | + |
| 48 | +#endif // MLIR_CONVERSION_COMPLEXCOMMON_DIVISIONCONVERTER_H |
0 commit comments