#include "llvm/IR/ConstantFPRange.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Operator.h"
#include "gtest/gtest.h"
usingnamespacellvm;
namespace {
class ConstantFPRangeTest : public ::testing::Test { … };
const fltSemantics &ConstantFPRangeTest::Sem = …;
ConstantFPRange ConstantFPRangeTest::Full = …;
ConstantFPRange ConstantFPRangeTest::Empty = …;
ConstantFPRange ConstantFPRangeTest::Finite = …;
ConstantFPRange ConstantFPRangeTest::One = …;
ConstantFPRange ConstantFPRangeTest::PosZero = …;
ConstantFPRange ConstantFPRangeTest::NegZero = …;
ConstantFPRange ConstantFPRangeTest::Zero = …;
ConstantFPRange ConstantFPRangeTest::Denormal = …;
ConstantFPRange ConstantFPRangeTest::PosInf = …;
ConstantFPRange ConstantFPRangeTest::NegInf = …;
ConstantFPRange ConstantFPRangeTest::NaN = …;
ConstantFPRange ConstantFPRangeTest::SNaN = …;
ConstantFPRange ConstantFPRangeTest::QNaN = …;
ConstantFPRange ConstantFPRangeTest::Some = …;
ConstantFPRange ConstantFPRangeTest::SomePos = …;
ConstantFPRange ConstantFPRangeTest::SomeNeg = …;
static void strictNext(APFloat &V) { … }
template <typename Fn>
static void EnumerateConstantFPRangesImpl(Fn TestFn, bool Exhaustive,
bool MayBeQNaN, bool MayBeSNaN) { … }
template <typename Fn>
static void EnumerateConstantFPRanges(Fn TestFn, bool Exhaustive) { … }
template <typename Fn>
static void EnumerateTwoInterestingConstantFPRanges(Fn TestFn,
bool Exhaustive) { … }
template <typename Fn>
static void EnumerateValuesInConstantFPRange(const ConstantFPRange &CR,
Fn TestFn) { … }
template <typename Fn>
static bool AnyOfValueInConstantFPRange(const ConstantFPRange &CR, Fn TestFn) { … }
TEST_F(ConstantFPRangeTest, Basics) { … }
TEST_F(ConstantFPRangeTest, Equality) { … }
TEST_F(ConstantFPRangeTest, SingleElement) { … }
TEST_F(ConstantFPRangeTest, ExhaustivelyEnumerate) { … }
TEST_F(ConstantFPRangeTest, Enumerate) { … }
TEST_F(ConstantFPRangeTest, IntersectWith) { … }
TEST_F(ConstantFPRangeTest, UnionWith) { … }
TEST_F(ConstantFPRangeTest, FPClassify) { … }
TEST_F(ConstantFPRangeTest, Print) { … }
#ifdef GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST_F(ConstantFPRangeTest, NonCanonicalEmptySet) {
EXPECT_DEATH((void)(ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(0.0))),
"Non-canonical form");
}
TEST_F(ConstantFPRangeTest, MismatchedSemantics) {
EXPECT_DEATH((void)(ConstantFPRange::getNonNaN(APFloat(0.0), APFloat(1.0f))),
"Should only use the same semantics");
EXPECT_DEATH((void)(One.contains(APFloat(1.0f))),
"Should only use the same semantics");
ConstantFPRange OneF32 = ConstantFPRange(APFloat(1.0f));
EXPECT_DEATH((void)(One.contains(OneF32)),
"Should only use the same semantics");
EXPECT_DEATH((void)(One.intersectWith(OneF32)),
"Should only use the same semantics");
EXPECT_DEATH((void)(One.unionWith(OneF32)),
"Should only use the same semantics");
}
#endif
#endif
TEST_F(ConstantFPRangeTest, makeAllowedFCmpRegion) { … }
}