MLIR 22.0.0git
APFloatWrappers.cpp File Reference
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/Support/Debug.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)
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_abs (int32_t semantics, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isfinite (int32_t semantics, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isinfinite (int32_t semantics, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isnormal (int32_t semantics, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isnan (int32_t semantics, uint64_t a)
MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_fused_multiply_add (int32_t semantics, uint64_t operand, uint64_t multiplicand, uint64_t addend)

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 42 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 55 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 220 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 69 of file APFloatWrappers.cpp.

◆ MLIR_APFLOAT_WRAPPERS_EXPORT

Function Documentation

◆ _mlir_apfloat_abs()

MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_abs ( int32_t semantics,
uint64_t a )

Definition at line 157 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.

◆ _mlir_apfloat_compare()

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

Definition at line 136 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 93 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 124 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 107 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT, and result.

◆ _mlir_apfloat_fused_multiply_add()

MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_fused_multiply_add ( int32_t semantics,
uint64_t operand,
uint64_t multiplicand,
uint64_t addend )

Definition at line 203 of file APFloatWrappers.cpp.

◆ _mlir_apfloat_isfinite()

MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isfinite ( int32_t semantics,
uint64_t a )

Definition at line 166 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.

◆ _mlir_apfloat_isinfinite()

MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isinfinite ( int32_t semantics,
uint64_t a )

Definition at line 175 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.

◆ _mlir_apfloat_isnan()

MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isnan ( int32_t semantics,
uint64_t a )

Definition at line 193 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.

◆ _mlir_apfloat_isnormal()

MLIR_APFLOAT_WRAPPERS_EXPORT bool _mlir_apfloat_isnormal ( int32_t semantics,
uint64_t a )

Definition at line 184 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.

◆ _mlir_apfloat_neg()

MLIR_APFLOAT_WRAPPERS_EXPORT uint64_t _mlir_apfloat_neg ( int32_t semantics,
uint64_t a )

Definition at line 147 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 83 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.