MLIR 22.0.0git
APFloatWrappers.cpp File Reference
#include "llvm/ADT/APFloat.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)

Functions

MLIR_APFLOAT_WRAPPERS_EXPORT void printApFloat (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 40 of file APFloatWrappers.cpp.

◆ APFLOAT_BINARY_OP_ROUNDING_MODE

#define APFLOAT_BINARY_OP_ROUNDING_MODE ( OP,
ROUNDING_MODE )
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, ROUNDING_MODE); \
return lhs.bitcastToAPInt().getZExtValue(); \
}

Binary operations with rounding mode.

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

◆ MLIR_APFLOAT_WRAPPERS_EXPORT

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

Definition at line 36 of file APFloatWrappers.cpp.

Referenced by printApFloat().

Function Documentation

◆ printApFloat()

MLIR_APFLOAT_WRAPPERS_EXPORT void printApFloat ( int32_t semantics,
uint64_t a )

Definition at line 81 of file APFloatWrappers.cpp.

References MLIR_APFLOAT_WRAPPERS_EXPORT.