MLIR 22.0.0git
APFloatWrappers.cpp File Reference
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"

Go to the source code of this file.

Macros

#define MLIR_APFLOAT_WRAPPERS_EXPORT   __attribute__((visibility("default")))
#define APFLOAT_BINARY_OP(OP)
 Binary operations without rounding mode.
#define APFLOAT_BINARY_OP_ROUNDING_MODE(OP, ROUNDING_MODE)
 Binary operations with rounding mode.
#define BIN_OPS_WITH_ROUNDING(X)
#define APFLOAT_MIN_MAX_OP(OP)
 Min/max operations.

Functions

MLIR_APFLOAT_WRAPPERS_EXPORT void printApFloat (int32_t semantics, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_convert (int32_t inSemantics, int32_t outSemantics, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_convert_to_int (int32_t semantics, int32_t resultWidth, bool isUnsigned, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_convert_from_int (int32_t semantics, int32_t inputWidth, bool isUnsigned, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT int8_t _mlir_apfloat_compare (int32_t semantics, uint64_t a, uint64_t b)
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_neg (int32_t semantics, uint64_t a)

Macro Definition Documentation

◆ APFLOAT_BINARY_OP

#define APFLOAT_BINARY_OP ( OP)
Value:
MLIR_APFLOAT_WRAPPERS_EXPORT int64_t _mlir_apfloat_##OP( \
int32_t semantics, uint64_t a, uint64_t b) { \
const llvm::fltSemantics &sem = llvm::APFloatBase::EnumToSemantics( \
static_cast<llvm::APFloatBase::Semantics>(semantics)); \
unsigned bitWidth = llvm::APFloatBase::semanticsSizeInBits(sem); \
llvm::APFloat lhs(sem, llvm::APInt(bitWidth, a)); \
llvm::APFloat rhs(sem, llvm::APInt(bitWidth, b)); \
lhs.OP(rhs); \
return lhs.bitcastToAPInt().getZExtValue(); \
}
#define MLIR_APFLOAT_WRAPPERS_EXPORT
lhs
b
Return true if permutation is a valid permutation of the outer_dims_perm (case OuterOrInnerPerm::Oute...

Binary operations without rounding mode.

Definition at line 41 of file APFloatWrappers.cpp.

◆ APFLOAT_BINARY_OP_ROUNDING_MODE

#define APFLOAT_BINARY_OP_ROUNDING_MODE ( OP,
ROUNDING_MODE )
Value:
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_##OP( \
int32_t semantics, uint64_t a, uint64_t b) { \
const llvm::fltSemantics &sem = llvm::APFloatBase::EnumToSemantics( \
static_cast<llvm::APFloatBase::Semantics>(semantics)); \
unsigned bitWidth = llvm::APFloatBase::semanticsSizeInBits(sem); \
llvm::APFloat lhs(sem, llvm::APInt(bitWidth, a)); \
llvm::APFloat rhs(sem, llvm::APInt(bitWidth, b)); \
lhs.OP(rhs, ROUNDING_MODE); \
return lhs.bitcastToAPInt().getZExtValue(); \
}

Binary operations with rounding mode.

Definition at line 54 of file APFloatWrappers.cpp.

◆ APFLOAT_MIN_MAX_OP

#define APFLOAT_MIN_MAX_OP ( OP)
Value:
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_##OP( \
int32_t semantics, uint64_t a, uint64_t b) { \
const llvm::fltSemantics &sem = llvm::APFloatBase::EnumToSemantics( \
static_cast<llvm::APFloatBase::Semantics>(semantics)); \
unsigned bitWidth = llvm::APFloatBase::semanticsSizeInBits(sem); \
llvm::APFloat lhs(sem, llvm::APInt(bitWidth, a)); \
llvm::APFloat rhs(sem, llvm::APInt(bitWidth, b)); \
llvm::APFloat result = llvm::OP(lhs, rhs); \
return result.bitcastToAPInt().getZExtValue(); \
}

Min/max operations.

Definition at line 156 of file APFloatWrappers.cpp.

◆ BIN_OPS_WITH_ROUNDING

#define BIN_OPS_WITH_ROUNDING ( X)
Value:
X(add, llvm::RoundingMode::NearestTiesToEven) \
X(subtract, llvm::RoundingMode::NearestTiesToEven) \
X(multiply, llvm::RoundingMode::NearestTiesToEven) \
X(divide, llvm::RoundingMode::NearestTiesToEven)
#define add(a, b)

Definition at line 68 of file APFloatWrappers.cpp.

◆ MLIR_APFLOAT_WRAPPERS_EXPORT

#define MLIR_APFLOAT_WRAPPERS_EXPORT   __attribute__((visibility("default")))

Function Documentation

◆ _mlir_apfloat_compare()

MLIR_APFLOAT_WRAPPERS_EXPORT int8_t _mlir_apfloat_compare ( int32_t semantics,
uint64_t a,
uint64_t b )

Definition at line 135 of file APFloatWrappers.cpp.

References b, and MLIR_APFLOAT_WRAPPERS_EXPORT.

◆ _mlir_apfloat_convert()

MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_convert ( int32_t inSemantics,
int32_t outSemantics,
uint64_t a )

Definition at line 92 of file APFloatWrappers.cpp.

References result.

◆ _mlir_apfloat_convert_from_int()

MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_convert_from_int ( int32_t semantics,
int32_t inputWidth,
bool isUnsigned,
uint64_t a )

Definition at line 123 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT, and result.

◆ _mlir_apfloat_convert_to_int()

MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_convert_to_int ( int32_t semantics,
int32_t resultWidth,
bool isUnsigned,
uint64_t a )

Definition at line 106 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT, and result.

◆ _mlir_apfloat_neg()

MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_neg ( int32_t semantics,
uint64_t a )

Definition at line 146 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.

◆ printApFloat()

MLIR_APFLOAT_WRAPPERS_EXPORT void printApFloat ( int32_t semantics,
uint64_t a )

Definition at line 82 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.