#include "clang/Frontend/FrontendDiagnostic.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
+#include "llvm/IR/FPEnv.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/MDBuilder.h"
// Map the LangOption for rounding mode into
// the corresponding enum in the IR.
-static llvm::ConstrainedFPIntrinsic::RoundingMode ToConstrainedRoundingMD(
+static llvm::fp::RoundingMode ToConstrainedRoundingMD(
LangOptions::FPRoundingModeKind Kind) {
switch (Kind) {
- case LangOptions::FPR_ToNearest:
- return llvm::ConstrainedFPIntrinsic::rmToNearest;
- case LangOptions::FPR_Downward:
- return llvm::ConstrainedFPIntrinsic::rmDownward;
- case LangOptions::FPR_Upward:
- return llvm::ConstrainedFPIntrinsic::rmUpward;
- case LangOptions::FPR_TowardZero:
- return llvm::ConstrainedFPIntrinsic::rmTowardZero;
- case LangOptions::FPR_Dynamic:
- return llvm::ConstrainedFPIntrinsic::rmDynamic;
+ case LangOptions::FPR_ToNearest: return llvm::fp::rmToNearest;
+ case LangOptions::FPR_Downward: return llvm::fp::rmDownward;
+ case LangOptions::FPR_Upward: return llvm::fp::rmUpward;
+ case LangOptions::FPR_TowardZero: return llvm::fp::rmTowardZero;
+ case LangOptions::FPR_Dynamic: return llvm::fp::rmDynamic;
}
llvm_unreachable("Unsupported FP RoundingMode");
}
// Map the LangOption for exception behavior into
// the corresponding enum in the IR.
-static llvm::ConstrainedFPIntrinsic::ExceptionBehavior ToConstrainedExceptMD(
+static llvm::fp::ExceptionBehavior ToConstrainedExceptMD(
LangOptions::FPExceptionModeKind Kind) {
switch (Kind) {
- case LangOptions::FPE_Ignore:
- return llvm::ConstrainedFPIntrinsic::ebIgnore;
- case LangOptions::FPE_MayTrap:
- return llvm::ConstrainedFPIntrinsic::ebMayTrap;
- case LangOptions::FPE_Strict:
- return llvm::ConstrainedFPIntrinsic::ebStrict;
+ case LangOptions::FPE_Ignore: return llvm::fp::ebIgnore;
+ case LangOptions::FPE_MayTrap: return llvm::fp::ebMayTrap;
+ case LangOptions::FPE_Strict: return llvm::fp::ebStrict;
}
llvm_unreachable("Unsupported FP Exception Behavior");
}
auto fpExceptionBehavior = ToConstrainedExceptMD(
getLangOpts().getFPExceptionMode());
- if (fpExceptionBehavior == llvm::ConstrainedFPIntrinsic::ebIgnore &&
- fpRoundingMode == llvm::ConstrainedFPIntrinsic::rmToNearest)
+ if (fpExceptionBehavior == llvm::fp::ebIgnore &&
+ fpRoundingMode == llvm::fp::rmToNearest)
// Constrained intrinsics are not used.
;
else {
--- /dev/null
+//===- FPEnv.h ---- FP Environment ------------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+/// @file
+/// This file contains the declarations of entities that describe floating
+/// point environment and related functions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_IR_FLOATINGPOINT_H
+#define LLVM_IR_FLOATINGPOINT_H
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringRef.h"
+#include <stdint.h>
+
+namespace llvm {
+
+namespace fp {
+
+/// Rounding mode used for floating point operations.
+///
+/// Each of these values correspond to some metadata argument value of a
+/// constrained floating point intrinsic. See the LLVM Language Reference Manual
+/// for details.
+enum RoundingMode : uint8_t {
+ rmDynamic, ///< This corresponds to "fpround.dynamic".
+ rmToNearest, ///< This corresponds to "fpround.tonearest".
+ rmDownward, ///< This corresponds to "fpround.downward".
+ rmUpward, ///< This corresponds to "fpround.upward".
+ rmTowardZero ///< This corresponds to "fpround.tozero".
+};
+
+/// Exception behavior used for floating point operations.
+///
+/// Each of these values correspond to some metadata argument value of a
+/// constrained floating point intrinsic. See the LLVM Language Reference Manual
+/// for details.
+enum ExceptionBehavior : uint8_t {
+ ebIgnore, ///< This corresponds to "fpexcept.ignore".
+ ebMayTrap, ///< This corresponds to "fpexcept.maytrap".
+ ebStrict ///< This corresponds to "fpexcept.strict".
+};
+
+}
+
+/// Returns a valid RoundingMode enumerator when given a string
+/// that is valid as input in constrained intrinsic rounding mode
+/// metadata.
+Optional<fp::RoundingMode> StrToRoundingMode(StringRef);
+
+/// For any RoundingMode enumerator, returns a string valid as input in
+/// constrained intrinsic rounding mode metadata.
+Optional<StringRef> RoundingModeToStr(fp::RoundingMode);
+
+/// Returns a valid ExceptionBehavior enumerator when given a string
+/// valid as input in constrained intrinsic exception behavior metadata.
+Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef);
+
+/// For any ExceptionBehavior enumerator, returns a string valid as
+/// input in constrained intrinsic exception behavior metadata.
+Optional<StringRef> ExceptionBehaviorToStr(fp::ExceptionBehavior);
+
+}
+#endif
FastMathFlags FMF;
bool IsFPConstrained;
- ConstrainedFPIntrinsic::ExceptionBehavior DefaultConstrainedExcept;
- ConstrainedFPIntrinsic::RoundingMode DefaultConstrainedRounding;
+ fp::ExceptionBehavior DefaultConstrainedExcept;
+ fp::RoundingMode DefaultConstrainedRounding;
ArrayRef<OperandBundleDef> DefaultOperandBundles;
IRBuilderBase(LLVMContext &context, MDNode *FPMathTag = nullptr,
ArrayRef<OperandBundleDef> OpBundles = None)
: Context(context), DefaultFPMathTag(FPMathTag), IsFPConstrained(false),
- DefaultConstrainedExcept(ConstrainedFPIntrinsic::ebStrict),
- DefaultConstrainedRounding(ConstrainedFPIntrinsic::rmDynamic),
+ DefaultConstrainedExcept(fp::ebStrict),
+ DefaultConstrainedRounding(fp::rmDynamic),
DefaultOperandBundles(OpBundles) {
ClearInsertionPoint();
}
bool getIsFPConstrained() { return IsFPConstrained; }
/// Set the exception handling to be used with constrained floating point
- void setDefaultConstrainedExcept(
- ConstrainedFPIntrinsic::ExceptionBehavior NewExcept) {
+ void setDefaultConstrainedExcept(fp::ExceptionBehavior NewExcept) {
DefaultConstrainedExcept = NewExcept;
}
/// Set the rounding mode handling to be used with constrained floating point
- void setDefaultConstrainedRounding(
- ConstrainedFPIntrinsic::RoundingMode NewRounding) {
+ void setDefaultConstrainedRounding(fp::RoundingMode NewRounding) {
DefaultConstrainedRounding = NewRounding;
}
/// Get the exception handling used with constrained floating point
- ConstrainedFPIntrinsic::ExceptionBehavior getDefaultConstrainedExcept() {
+ fp::ExceptionBehavior getDefaultConstrainedExcept() {
return DefaultConstrainedExcept;
}
/// Get the rounding mode handling used with constrained floating point
- ConstrainedFPIntrinsic::RoundingMode getDefaultConstrainedRounding() {
+ fp::RoundingMode getDefaultConstrainedRounding() {
return DefaultConstrainedRounding;
}
return (LC && RC) ? Insert(Folder.CreateBinOp(Opc, LC, RC), Name) : nullptr;
}
- Value *getConstrainedFPRounding(
- Optional<ConstrainedFPIntrinsic::RoundingMode> Rounding) {
- ConstrainedFPIntrinsic::RoundingMode UseRounding =
- DefaultConstrainedRounding;
+ Value *getConstrainedFPRounding(Optional<fp::RoundingMode> Rounding) {
+ fp::RoundingMode UseRounding = DefaultConstrainedRounding;
if (Rounding.hasValue())
UseRounding = Rounding.getValue();
- Optional<StringRef> RoundingStr =
- ConstrainedFPIntrinsic::RoundingModeToStr(UseRounding);
+ Optional<StringRef> RoundingStr = RoundingModeToStr(UseRounding);
assert(RoundingStr.hasValue() && "Garbage strict rounding mode!");
auto *RoundingMDS = MDString::get(Context, RoundingStr.getValue());
return MetadataAsValue::get(Context, RoundingMDS);
}
- Value *getConstrainedFPExcept(
- Optional<ConstrainedFPIntrinsic::ExceptionBehavior> Except) {
- ConstrainedFPIntrinsic::ExceptionBehavior UseExcept =
- DefaultConstrainedExcept;
+ Value *getConstrainedFPExcept(Optional<fp::ExceptionBehavior> Except) {
+ fp::ExceptionBehavior UseExcept = DefaultConstrainedExcept;
if (Except.hasValue())
UseExcept = Except.getValue();
- Optional<StringRef> ExceptStr =
- ConstrainedFPIntrinsic::ExceptionBehaviorToStr(UseExcept);
+ Optional<StringRef> ExceptStr = ExceptionBehaviorToStr(UseExcept);
assert(ExceptStr.hasValue() && "Garbage strict exception behavior!");
auto *ExceptMDS = MDString::get(Context, ExceptStr.getValue());
CallInst *CreateConstrainedFPBinOp(
Intrinsic::ID ID, Value *L, Value *R, Instruction *FMFSource = nullptr,
const Twine &Name = "", MDNode *FPMathTag = nullptr,
- Optional<ConstrainedFPIntrinsic::RoundingMode> Rounding = None,
- Optional<ConstrainedFPIntrinsic::ExceptionBehavior> Except = None) {
+ Optional<fp::RoundingMode> Rounding = None,
+ Optional<fp::ExceptionBehavior> Except = None) {
Value *RoundingV = getConstrainedFPRounding(Rounding);
Value *ExceptV = getConstrainedFPExcept(Except);
Intrinsic::ID ID, Value *V, Type *DestTy,
Instruction *FMFSource = nullptr, const Twine &Name = "",
MDNode *FPMathTag = nullptr,
- Optional<ConstrainedFPIntrinsic::RoundingMode> Rounding = None,
- Optional<ConstrainedFPIntrinsic::ExceptionBehavior> Except = None) {
+ Optional<fp::RoundingMode> Rounding = None,
+ Optional<fp::ExceptionBehavior> Except = None) {
Value *ExceptV = getConstrainedFPExcept(Except);
FastMathFlags UseFMF = FMF;
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/FPEnv.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
/// This is the common base class for constrained floating point intrinsics.
class ConstrainedFPIntrinsic : public IntrinsicInst {
public:
- /// Specifies the rounding mode to be assumed. This is only used when
- /// when constrained floating point is enabled. See the LLVM Language
- /// Reference Manual for details.
- enum RoundingMode : uint8_t {
- rmDynamic, ///< This corresponds to "fpround.dynamic".
- rmToNearest, ///< This corresponds to "fpround.tonearest".
- rmDownward, ///< This corresponds to "fpround.downward".
- rmUpward, ///< This corresponds to "fpround.upward".
- rmTowardZero ///< This corresponds to "fpround.tozero".
- };
-
- /// Specifies the required exception behavior. This is only used when
- /// when constrained floating point is used. See the LLVM Language
- /// Reference Manual for details.
- enum ExceptionBehavior : uint8_t {
- ebIgnore, ///< This corresponds to "fpexcept.ignore".
- ebMayTrap, ///< This corresponds to "fpexcept.maytrap".
- ebStrict ///< This corresponds to "fpexcept.strict".
- };
-
bool isUnaryOp() const;
bool isTernaryOp() const;
- Optional<RoundingMode> getRoundingMode() const;
- Optional<ExceptionBehavior> getExceptionBehavior() const;
-
- /// Returns a valid RoundingMode enumerator when given a string
- /// that is valid as input in constrained intrinsic rounding mode
- /// metadata.
- static Optional<RoundingMode> StrToRoundingMode(StringRef);
-
- /// For any RoundingMode enumerator, returns a string valid as input in
- /// constrained intrinsic rounding mode metadata.
- static Optional<StringRef> RoundingModeToStr(RoundingMode);
-
- /// Returns a valid ExceptionBehavior enumerator when given a string
- /// valid as input in constrained intrinsic exception behavior metadata.
- static Optional<ExceptionBehavior> StrToExceptionBehavior(StringRef);
-
- /// For any ExceptionBehavior enumerator, returns a string valid as
- /// input in constrained intrinsic exception behavior metadata.
- static Optional<StringRef> ExceptionBehaviorToStr(ExceptionBehavior);
+ Optional<fp::RoundingMode> getRoundingMode() const;
+ Optional<fp::ExceptionBehavior> getExceptionBehavior() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const IntrinsicInst *I) {
SDVTList VTs = DAG.getVTList(ValueVTs);
SDValue Result = DAG.getNode(Opcode, sdl, VTs, Opers);
- if (FPI.getExceptionBehavior() !=
- ConstrainedFPIntrinsic::ExceptionBehavior::ebIgnore) {
+ if (FPI.getExceptionBehavior() != fp::ExceptionBehavior::ebIgnore) {
SDNodeFlags Flags;
Flags.setFPExcept(true);
Result->setFlags(Flags);
DiagnosticInfo.cpp
DiagnosticPrinter.cpp
Dominators.cpp
+ FPEnv.cpp
Function.cpp
GVMaterializer.cpp
Globals.cpp
--- /dev/null
+//===-- FPEnv.cpp ---- FP Environment -------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+/// @file
+/// This file contains the implementations of entities that describe floating
+/// point environment.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/IR/FPEnv.h"
+
+namespace llvm {
+
+Optional<fp::RoundingMode> StrToRoundingMode(StringRef RoundingArg) {
+ // For dynamic rounding mode, we use round to nearest but we will set the
+ // 'exact' SDNodeFlag so that the value will not be rounded.
+ return StringSwitch<Optional<fp::RoundingMode>>(RoundingArg)
+ .Case("round.dynamic", fp::rmDynamic)
+ .Case("round.tonearest", fp::rmToNearest)
+ .Case("round.downward", fp::rmDownward)
+ .Case("round.upward", fp::rmUpward)
+ .Case("round.towardzero", fp::rmTowardZero)
+ .Default(None);
+}
+
+Optional<StringRef> RoundingModeToStr(fp::RoundingMode UseRounding) {
+ Optional<StringRef> RoundingStr = None;
+ switch (UseRounding) {
+ case fp::rmDynamic:
+ RoundingStr = "round.dynamic";
+ break;
+ case fp::rmToNearest:
+ RoundingStr = "round.tonearest";
+ break;
+ case fp::rmDownward:
+ RoundingStr = "round.downward";
+ break;
+ case fp::rmUpward:
+ RoundingStr = "round.upward";
+ break;
+ case fp::rmTowardZero:
+ RoundingStr = "round.towardzero";
+ break;
+ }
+ return RoundingStr;
+}
+
+Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef ExceptionArg) {
+ return StringSwitch<Optional<fp::ExceptionBehavior>>(ExceptionArg)
+ .Case("fpexcept.ignore", fp::ebIgnore)
+ .Case("fpexcept.maytrap", fp::ebMayTrap)
+ .Case("fpexcept.strict", fp::ebStrict)
+ .Default(None);
+}
+
+Optional<StringRef> ExceptionBehaviorToStr(fp::ExceptionBehavior UseExcept) {
+ Optional<StringRef> ExceptStr = None;
+ switch (UseExcept) {
+ case fp::ebStrict:
+ ExceptStr = "fpexcept.strict";
+ break;
+ case fp::ebIgnore:
+ ExceptStr = "fpexcept.ignore";
+ break;
+ case fp::ebMayTrap:
+ ExceptStr = "fpexcept.maytrap";
+ break;
+ }
+ return ExceptStr;
+}
+
+}
\ No newline at end of file
return ConstantInt::get(Type::getInt64Ty(Context), 1);
}
-Optional<ConstrainedFPIntrinsic::RoundingMode>
-ConstrainedFPIntrinsic::getRoundingMode() const {
+Optional<fp::RoundingMode> ConstrainedFPIntrinsic::getRoundingMode() const {
unsigned NumOperands = getNumArgOperands();
Metadata *MD =
cast<MetadataAsValue>(getArgOperand(NumOperands - 2))->getMetadata();
return StrToRoundingMode(cast<MDString>(MD)->getString());
}
-Optional<ConstrainedFPIntrinsic::RoundingMode>
-ConstrainedFPIntrinsic::StrToRoundingMode(StringRef RoundingArg) {
- // For dynamic rounding mode, we use round to nearest but we will set the
- // 'exact' SDNodeFlag so that the value will not be rounded.
- return StringSwitch<Optional<RoundingMode>>(RoundingArg)
- .Case("round.dynamic", rmDynamic)
- .Case("round.tonearest", rmToNearest)
- .Case("round.downward", rmDownward)
- .Case("round.upward", rmUpward)
- .Case("round.towardzero", rmTowardZero)
- .Default(None);
-}
-
-Optional<StringRef>
-ConstrainedFPIntrinsic::RoundingModeToStr(RoundingMode UseRounding) {
- Optional<StringRef> RoundingStr = None;
- switch (UseRounding) {
- case ConstrainedFPIntrinsic::rmDynamic:
- RoundingStr = "round.dynamic";
- break;
- case ConstrainedFPIntrinsic::rmToNearest:
- RoundingStr = "round.tonearest";
- break;
- case ConstrainedFPIntrinsic::rmDownward:
- RoundingStr = "round.downward";
- break;
- case ConstrainedFPIntrinsic::rmUpward:
- RoundingStr = "round.upward";
- break;
- case ConstrainedFPIntrinsic::rmTowardZero:
- RoundingStr = "round.towardzero";
- break;
- }
- return RoundingStr;
-}
-
-Optional<ConstrainedFPIntrinsic::ExceptionBehavior>
+Optional<fp::ExceptionBehavior>
ConstrainedFPIntrinsic::getExceptionBehavior() const {
unsigned NumOperands = getNumArgOperands();
Metadata *MD =
return StrToExceptionBehavior(cast<MDString>(MD)->getString());
}
-Optional<ConstrainedFPIntrinsic::ExceptionBehavior>
-ConstrainedFPIntrinsic::StrToExceptionBehavior(StringRef ExceptionArg) {
- return StringSwitch<Optional<ExceptionBehavior>>(ExceptionArg)
- .Case("fpexcept.ignore", ebIgnore)
- .Case("fpexcept.maytrap", ebMayTrap)
- .Case("fpexcept.strict", ebStrict)
- .Default(None);
-}
-
-Optional<StringRef>
-ConstrainedFPIntrinsic::ExceptionBehaviorToStr(ExceptionBehavior UseExcept) {
- Optional<StringRef> ExceptStr = None;
- switch (UseExcept) {
- case ConstrainedFPIntrinsic::ebStrict:
- ExceptStr = "fpexcept.strict";
- break;
- case ConstrainedFPIntrinsic::ebIgnore:
- ExceptStr = "fpexcept.ignore";
- break;
- case ConstrainedFPIntrinsic::ebMayTrap:
- ExceptStr = "fpexcept.maytrap";
- break;
- }
- return ExceptStr;
-}
-
bool ConstrainedFPIntrinsic::isUnaryOp() const {
switch (getIntrinsicID()) {
default:
V = Builder.CreateFAdd(V, V);
ASSERT_TRUE(isa<ConstrainedFPIntrinsic>(V));
auto *CII = cast<ConstrainedFPIntrinsic>(V);
- ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebStrict);
- ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDynamic);
+ EXPECT_EQ(fp::ebStrict, CII->getExceptionBehavior());
+ EXPECT_EQ(fp::rmDynamic, CII->getRoundingMode());
- Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebIgnore);
- Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmUpward);
+ Builder.setDefaultConstrainedExcept(fp::ebIgnore);
+ Builder.setDefaultConstrainedRounding(fp::rmUpward);
V = Builder.CreateFAdd(V, V);
CII = cast<ConstrainedFPIntrinsic>(V);
- ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
- ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmUpward);
+ EXPECT_EQ(fp::ebIgnore, CII->getExceptionBehavior());
+ EXPECT_EQ(CII->getRoundingMode(), fp::rmUpward);
- Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebIgnore);
- Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmToNearest);
+ Builder.setDefaultConstrainedExcept(fp::ebIgnore);
+ Builder.setDefaultConstrainedRounding(fp::rmToNearest);
V = Builder.CreateFAdd(V, V);
CII = cast<ConstrainedFPIntrinsic>(V);
- ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
- ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmToNearest);
+ EXPECT_EQ(fp::ebIgnore, CII->getExceptionBehavior());
+ EXPECT_EQ(fp::rmToNearest, CII->getRoundingMode());
- Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebMayTrap);
- Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmDownward);
+ Builder.setDefaultConstrainedExcept(fp::ebMayTrap);
+ Builder.setDefaultConstrainedRounding(fp::rmDownward);
V = Builder.CreateFAdd(V, V);
CII = cast<ConstrainedFPIntrinsic>(V);
- ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebMayTrap);
- ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDownward);
+ EXPECT_EQ(fp::ebMayTrap, CII->getExceptionBehavior());
+ EXPECT_EQ(fp::rmDownward, CII->getRoundingMode());
- Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebStrict);
- Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmTowardZero);
+ Builder.setDefaultConstrainedExcept(fp::ebStrict);
+ Builder.setDefaultConstrainedRounding(fp::rmTowardZero);
V = Builder.CreateFAdd(V, V);
CII = cast<ConstrainedFPIntrinsic>(V);
- ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebStrict);
- ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmTowardZero);
+ EXPECT_EQ(fp::ebStrict, CII->getExceptionBehavior());
+ EXPECT_EQ(fp::rmTowardZero, CII->getRoundingMode());
- Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebIgnore);
- Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmDynamic);
+ Builder.setDefaultConstrainedExcept(fp::ebIgnore);
+ Builder.setDefaultConstrainedRounding(fp::rmDynamic);
V = Builder.CreateFAdd(V, V);
CII = cast<ConstrainedFPIntrinsic>(V);
- ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
- ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDynamic);
+ EXPECT_EQ(fp::ebIgnore, CII->getExceptionBehavior());
+ EXPECT_EQ(fp::rmDynamic, CII->getRoundingMode());
// Now override the defaults.
Call = Builder.CreateConstrainedFPBinOp(
Intrinsic::experimental_constrained_fadd, V, V, nullptr, "", nullptr,
- ConstrainedFPIntrinsic::rmDownward, ConstrainedFPIntrinsic::ebMayTrap);
+ fp::rmDownward, fp::ebMayTrap);
CII = cast<ConstrainedFPIntrinsic>(Call);
EXPECT_EQ(CII->getIntrinsicID(), Intrinsic::experimental_constrained_fadd);
- ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebMayTrap);
- ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDownward);
+ EXPECT_EQ(fp::ebMayTrap, CII->getExceptionBehavior());
+ EXPECT_EQ(fp::rmDownward, CII->getRoundingMode());
Builder.CreateRetVoid();
EXPECT_FALSE(verifyModule(*M));