30 #include <gtest/gtest.h> 32 #include <type_traits> 54 0, 1, 2, 3, 4, 5, 6, 7
57 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0
105 return tc->
ints[position++];
109 template <
typename Arg>
111 typename
std::enable_if<std::is_floating_point<Arg>::value>
::type>
116 return tc->
floats[position++];
130 template <
typename Ret>
132 typename
std::enable_if<std::is_floating_point<Ret>::value>
::type>
143 template <
typename Arg>
146 template <
typename Ret>
166 return tc->
ints[position.first++];
170 template <
typename Arg>
172 typename
std::enable_if<std::is_floating_point<Arg>::value>
::type>
177 return tc->
floats[position.second++];
191 template <
typename Ret>
193 typename
std::enable_if<std::is_floating_point<Ret>::value>
::type>
209 return tc->
ints[position.pos++];
284 EXPECT_EQ(tc.intResult, tc.DefaultIntResult);
285 EXPECT_EQ(tc.floatResult, tc.DefaultFloatResult);
299 EXPECT_EQ(tc.intResult, tc.DefaultIntResult);
300 EXPECT_EQ(tc.floatResult, tc.DefaultFloatResult);
307 invokeSimcall<TestABI_TcInit>(&tc,
testTcInit);
315 int ret = invokeSimcall<TestABI_1D>(&tc,
testIntRet);
318 EXPECT_EQ(tc.floatResult, tc.DefaultFloatResult);
322 float ret = invokeSimcall<TestABI_1D>(&tc,
testFloatRet);
324 EXPECT_EQ(tc.intResult, tc.DefaultIntResult);
331 EXPECT_EQ(tc.intResult, tc.DefaultIntResult);
338 int ret = invokeSimcall<TestABI_2D>(&tc,
testIntRet);
341 EXPECT_EQ(tc.floatResult, tc.DefaultFloatResult);
345 float ret = invokeSimcall<TestABI_2D>(&tc,
testFloatRet);
347 EXPECT_EQ(tc.intResult, tc.DefaultIntResult);
354 EXPECT_EQ(tc.intResult, tc.DefaultIntResult);
363 EXPECT_EQ(dump,
"test(0, 11, 2, 13, ...)");
std::string dumpSimcall(std::string name, ThreadContext *tc, std::function< Ret(ThreadContext *, Args...)> target=std::function< Ret(ThreadContext *, Args...)>())
void testTcInit(ThreadContext *tc, int a)
const float FloatRetValue
static const double floats[]
void test2DVoid(ThreadContext *tc, int a, float b, int c, double d, GuestABI::VarArgs< int, float, double > varargs)
static void store(ThreadContext *tc, const Ret &ret)
static const double DefaultFloatResult
Overload hash function for BasicBlockRange type.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
static const int DefaultIntResult
static void store(ThreadContext *tc, const int &ret)
TEST(GuestABI, ABI_1D_args)
#define EXPECT_TRUE(expr)
A macro which verifies that expr evaluates to true.
void testRetRegVoid(ThreadContext *tc, int a)
Position(const ThreadContext *tc)
void testIntVoid(ThreadContext *tc, int a, float b, int c, double d, GuestABI::VarArgs< int, float, double > varargs)
static void store(ThreadContext *tc, const Ret &ret)
static void store(ThreadContext *tc, const Ret &ret)
#define EXPECT_FALSE(expr)
A macro which verifies that expr evaluates to false.
static void allocate(ThreadContext *tc, TestABI_RetReg::Position &position)
const double DoubleRetValue
int testRetRegInt(ThreadContext *tc, int a)
float testFloatRet(ThreadContext *tc)
void dump()
Dump all statistics data to the registered outputs.
static void store(ThreadContext *tc, const int &ret)
double testDoubleRet(ThreadContext *tc)
int testIntRet(ThreadContext *tc)
#define EXPECT_EQ(lhs, rhs)
A macro which verifies that lhs and rhs are equal to each other.