Reapply https://github.com/llvm/llvm-project/pull/171221 - Fix builder by linking `MLIRTransformUtils`. Also move headers to `mlir/Conversion/ArithAndMathToAPFloat`.
23 lines
914 B
C++
23 lines
914 B
C++
//===- Utils.cpp - Utils for APFloat Conversion ---------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "Utils.h"
|
|
|
|
#include "mlir/Dialect/Arith/IR/Arith.h"
|
|
#include "mlir/IR/Builders.h"
|
|
#include "mlir/IR/BuiltinTypeInterfaces.h"
|
|
#include "mlir/IR/Location.h"
|
|
#include "mlir/IR/Value.h"
|
|
|
|
mlir::Value mlir::getAPFloatSemanticsValue(OpBuilder &b, Location loc,
|
|
FloatType floatTy) {
|
|
int32_t sem = llvm::APFloatBase::SemanticsToEnum(floatTy.getFloatSemantics());
|
|
return arith::ConstantOp::create(b, loc, b.getI32Type(),
|
|
b.getIntegerAttr(b.getI32Type(), sem));
|
|
}
|