MLIR 22.0.0git
ArithToAPFloat.cpp File Reference

Go to the source code of this file.

Classes

struct  BinaryArithOpToAPFloatConversion< OpTy >
 Rewrite a binary arithmetic operation to an APFloat function call. More...
struct  FpToFpConversion< OpTy >
struct  FpToIntConversion< OpTy >
struct  IntToFpConversion< OpTy >
struct  CmpFOpToAPFloatConversion
struct  NegFOpToAPFloatConversion

Namespaces

namespace  mlir
 Include the generated interface declarations.

Macros

#define GEN_PASS_DEF_ARITHTOAPFLOATCONVERSIONPASS

Functions

static FailureOr< FuncOp > lookupOrCreateBinaryFn (OpBuilder &b, SymbolOpInterface symTable, StringRef name, SymbolTableCollection *symbolTables=nullptr)
 Helper function to look up or create the symbol for a runtime library function for a binary arithmetic operation.
template<typename Fn, typename... Values>
static Value forEachScalarValue (RewriterBase &rewriter, Location loc, Value operand1, Value operand2, Type resultType, Fn fn)
 Given two operands of vector type and vector result type (with the same shape), call the given function for each pair of scalar operands and package the result into a vector.
static LogicalResult checkPreconditions (RewriterBase &rewriter, Operation *op)
 Check preconditions for the conversion:

Macro Definition Documentation

◆ GEN_PASS_DEF_ARITHTOAPFLOATCONVERSIONPASS

#define GEN_PASS_DEF_ARITHTOAPFLOATCONVERSIONPASS

Definition at line 22 of file ArithToAPFloat.cpp.

Function Documentation

◆ checkPreconditions()

◆ forEachScalarValue()

template<typename Fn, typename... Values>
Value forEachScalarValue ( RewriterBase & rewriter,
Location loc,
Value operand1,
Value operand2,
Type resultType,
Fn fn )
static

Given two operands of vector type and vector result type (with the same shape), call the given function for each pair of scalar operands and package the result into a vector.

If the given operands and result type are not vectors, call the function directly. The second operand is optional.

Definition at line 54 of file ArithToAPFloat.cpp.

References mlir::Value::getType(), and result.

Referenced by BinaryArithOpToAPFloatConversion< OpTy >::matchAndRewrite(), CmpFOpToAPFloatConversion::matchAndRewrite(), FpToFpConversion< OpTy >::matchAndRewrite(), FpToIntConversion< OpTy >::matchAndRewrite(), IntToFpConversion< OpTy >::matchAndRewrite(), and NegFOpToAPFloatConversion::matchAndRewrite().

◆ lookupOrCreateBinaryFn()

FailureOr< FuncOp > lookupOrCreateBinaryFn ( OpBuilder & b,
SymbolOpInterface symTable,
StringRef name,
SymbolTableCollection * symbolTables = nullptr )
static

Helper function to look up or create the symbol for a runtime library function for a binary arithmetic operation.

Parameter 1: APFloat semantics Parameter 2: Left-hand side operand Parameter 3: Right-hand side operand

This function will return a failure if the function is found but has an unexpected signature.

Definition at line 40 of file ArithToAPFloat.cpp.

References b, and mlir::func::lookupOrCreateFnDecl().

Referenced by BinaryArithOpToAPFloatConversion< OpTy >::matchAndRewrite().