From 96007049d29ba3d93564b71aa7a113c5036a4913 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 23 Aug 2014 17:09:19 -0700 Subject: [PATCH] Starting tests. This is going to take some time. --- src/alloy/vec128.h | 28 ++ tools/alloy-test/alloy-test.cc | 56 +-- tools/alloy-test/alloy-test.gypi | 4 +- tools/alloy-test/test_add.cc | 550 +++++++++++++++++++++++ tools/alloy-test/{test_util.h => util.h} | 39 +- 5 files changed, 627 insertions(+), 50 deletions(-) create mode 100644 tools/alloy-test/test_add.cc rename tools/alloy-test/{test_util.h => util.h} (84%) diff --git a/src/alloy/vec128.h b/src/alloy/vec128.h index c5b7bc81f..a77a5aa79 100644 --- a/src/alloy/vec128.h +++ b/src/alloy/vec128.h @@ -58,6 +58,34 @@ static inline vec128_t vec128f(float x, float y, float z, float w) { v.f4[3] = w; return v; } +static inline vec128_t vec128s(uint16_t src) { + vec128_t v; + for (auto i = 0; i < 8; ++i) { + v.s8[i] = src; + } + return v; +} +static inline vec128_t vec128s(uint16_t x0, uint16_t x1, uint16_t y0, + uint16_t y1, uint16_t z0, uint16_t z1, + uint16_t w0, uint16_t w1) { + vec128_t v; + v.s8[0] = x0; + v.s8[1] = x1; + v.s8[2] = y0; + v.s8[3] = y1; + v.s8[4] = z0; + v.s8[5] = z1; + v.s8[6] = w0; + v.s8[7] = w1; + return v; +} +static inline vec128_t vec128b(uint8_t src) { + vec128_t v; + for (auto i = 0; i < 16; ++i) { + v.b16[i] = src; + } + return v; +} static inline vec128_t vec128b(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t y0, uint8_t y1, uint8_t y2, uint8_t y3, uint8_t z0, uint8_t z1, uint8_t z2, uint8_t z3, diff --git a/tools/alloy-test/alloy-test.cc b/tools/alloy-test/alloy-test.cc index 295f8a1bf..4c530cf16 100644 --- a/tools/alloy-test/alloy-test.cc +++ b/tools/alloy-test/alloy-test.cc @@ -10,44 +10,32 @@ #define CATCH_CONFIG_RUNNER #include -#include +#include + +namespace alloy { +namespace test { -using namespace alloy; -using namespace alloy::hir; -using namespace alloy::runtime; using alloy::frontend::ppc::PPCContext; +using alloy::runtime::Runtime; -Value* LoadGPR(hir::HIRBuilder& b, int reg) { - return b.LoadContext(offsetof(PPCContext, r) + reg * 8, INT64_TYPE); +int main(std::vector& args) { + std::vector narrow_args; + auto narrow_argv = new char* [args.size()]; + for (size_t i = 0; i < args.size(); ++i) { + auto narrow_arg = poly::to_string(args[i]); + narrow_argv[i] = const_cast(narrow_arg.data()); + narrow_args.push_back(std::move(narrow_arg)); + } + int ret = Catch::Session().run(int(args.size()), narrow_argv); + if (ret) { + if (poly::debugging::IsDebuggerAttached()) { + poly::debugging::Break(); + } + } + return ret; } -void StoreGPR(hir::HIRBuilder& b, int reg, Value* value) { - b.StoreContext(offsetof(PPCContext, r) + reg * 8, value); -} - -TEST_CASE("ADD", "[instr]") { - alloy::test::TestFunction test([](hir::HIRBuilder& b) { - auto v = b.Add(LoadGPR(b, 4), LoadGPR(b, 5)); - StoreGPR(b, 3, v); - b.Return(); - }); - - test.Run([](PPCContext* ctx) { - ctx->r[4] = 10; - ctx->r[5] = 25; - }, - [](PPCContext* ctx) { - auto result = ctx->r[3]; - REQUIRE(result == 0x23); - }); - test.Run([](PPCContext* ctx) { - ctx->r[4] = 10; - ctx->r[5] = 25; - }, - [](PPCContext* ctx) { - auto result = ctx->r[3]; - REQUIRE(result == 0x24); - }); -} +} // namespace test +} // namespace alloy DEFINE_ENTRY_POINT(L"alloy-test", L"?", alloy::test::main); diff --git a/tools/alloy-test/alloy-test.gypi b/tools/alloy-test/alloy-test.gypi index 36de70cd8..122f5b430 100644 --- a/tools/alloy-test/alloy-test.gypi +++ b/tools/alloy-test/alloy-test.gypi @@ -22,7 +22,9 @@ 'sources': [ 'alloy-test.cc', - 'test_util.h', + 'test_add.cc', + 'test_vector_add.cc', + 'util.h', ], }, ], diff --git a/tools/alloy-test/test_add.cc b/tools/alloy-test/test_add.cc new file mode 100644 index 000000000..6805cbfc6 --- /dev/null +++ b/tools/alloy-test/test_add.cc @@ -0,0 +1,550 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2014 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +using namespace alloy; +using namespace alloy::hir; +using namespace alloy::runtime; +using namespace alloy::test; +using alloy::frontend::ppc::PPCContext; + +TEST_CASE("ADD_I8", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + StoreGPR(b, 3, b.ZeroExtend(b.Add(b.Truncate(LoadGPR(b, 4), INT8_TYPE), + b.Truncate(LoadGPR(b, 5), INT8_TYPE)), + INT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 10; + ctx->r[5] = 25; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0x23); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = -10; + ctx->r[5] = -5; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == -15); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT8_MIN; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == INT8_MIN); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT8_MAX; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == UINT8_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT8_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == INT8_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT8_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0); + }); +} + +TEST_CASE("ADD_I8_CARRY", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + auto v = b.Add(b.Truncate(LoadGPR(b, 4), INT8_TYPE), + b.Truncate(LoadGPR(b, 5), INT8_TYPE), ARITHMETIC_SET_CARRY); + StoreGPR(b, 3, b.ZeroExtend(b.DidCarry(v), INT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT8_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT8_MAX; + ctx->r[5] = UINT8_MAX; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT8_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); +} + +TEST_CASE("ADD_I16", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + StoreGPR(b, 3, b.ZeroExtend(b.Add(b.Truncate(LoadGPR(b, 4), INT16_TYPE), + b.Truncate(LoadGPR(b, 5), INT16_TYPE)), + INT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 10; + ctx->r[5] = 25; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0x23); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = -10; + ctx->r[5] = -5; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == -15); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT16_MIN; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == INT16_MIN); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT16_MAX; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == UINT16_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT16_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == INT16_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT16_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0); + }); +} + +TEST_CASE("ADD_I16_CARRY", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + auto v = b.Add(b.Truncate(LoadGPR(b, 4), INT16_TYPE), + b.Truncate(LoadGPR(b, 5), INT16_TYPE), ARITHMETIC_SET_CARRY); + StoreGPR(b, 3, b.ZeroExtend(b.DidCarry(v), INT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT16_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT16_MAX; + ctx->r[5] = UINT16_MAX; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT16_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); +} + +TEST_CASE("ADD_I32", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + StoreGPR(b, 3, b.ZeroExtend(b.Add(b.Truncate(LoadGPR(b, 4), INT32_TYPE), + b.Truncate(LoadGPR(b, 5), INT32_TYPE)), + INT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 10; + ctx->r[5] = 25; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0x23); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = -10; + ctx->r[5] = -5; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == -15); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT32_MIN; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == INT32_MIN); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT32_MAX; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == UINT32_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT32_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == INT32_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT32_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = static_cast(ctx->r[3]); + REQUIRE(result == 0); + }); +} + +TEST_CASE("ADD_I32_CARRY", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + auto v = b.Add(b.Truncate(LoadGPR(b, 4), INT32_TYPE), + b.Truncate(LoadGPR(b, 5), INT32_TYPE), ARITHMETIC_SET_CARRY); + StoreGPR(b, 3, b.ZeroExtend(b.DidCarry(v), INT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT32_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT32_MAX; + ctx->r[5] = UINT32_MAX; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT32_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); +} + +TEST_CASE("ADD_I64", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + StoreGPR(b, 3, b.Add(LoadGPR(b, 4), LoadGPR(b, 5))); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 10; + ctx->r[5] = 25; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 0x23); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = -10; + ctx->r[5] = -5; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == -15); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT64_MIN; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == INT64_MIN); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT64_MAX; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == UINT64_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT64_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == INT64_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT64_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 0); + }); +} + +TEST_CASE("ADD_I64_CARRY", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + auto v = b.Add(b.Truncate(LoadGPR(b, 4), INT64_TYPE), + b.Truncate(LoadGPR(b, 5), INT64_TYPE), ARITHMETIC_SET_CARRY); + StoreGPR(b, 3, b.ZeroExtend(b.DidCarry(v), INT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = 0; + ctx->r[5] = 0; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 0); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT64_MAX; + ctx->r[5] = 1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = UINT64_MAX; + ctx->r[5] = UINT64_MAX; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); + test.Run([](PPCContext* ctx) { + ctx->r[4] = INT64_MIN; + ctx->r[5] = -1; + }, + [](PPCContext* ctx) { + auto result = ctx->r[3]; + REQUIRE(result == 1); + }); +} + +TEST_CASE("ADD_F32", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + StoreFPR(b, 3, b.Convert(b.Add(b.Convert(LoadFPR(b, 4), FLOAT32_TYPE), + b.Convert(LoadFPR(b, 5), FLOAT32_TYPE)), + FLOAT64_TYPE)); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = 0.0; + ctx->f[5] = 0.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == 0.0); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = 5.0; + ctx->f[5] = 7.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == 12.0); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = FLT_MAX / 2.0; + ctx->f[5] = FLT_MAX / 2.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == FLT_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = -100.0; + ctx->f[5] = -150.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == -250.0); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = FLT_MIN; + ctx->f[5] = 0.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == FLT_MIN); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = FLT_MAX; + ctx->f[5] = 0.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == FLT_MAX); + }); +} + +TEST_CASE("ADD_F64", "[instr]") { + TestFunction test([](hir::HIRBuilder& b) { + StoreFPR(b, 3, b.Add(LoadFPR(b, 4), LoadFPR(b, 5))); + b.Return(); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = 0.0; + ctx->f[5] = 0.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == 0.0); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = 5.0; + ctx->f[5] = 7.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == 12.0); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = DBL_MAX / 2.0; + ctx->f[5] = DBL_MAX / 2.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == DBL_MAX); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = -100.0; + ctx->f[5] = -150.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == -250.0); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = DBL_MIN; + ctx->f[5] = 0.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == DBL_MIN); + }); + test.Run([](PPCContext* ctx) { + ctx->f[4] = DBL_MAX; + ctx->f[5] = 0.0; + }, + [](PPCContext* ctx) { + auto result = ctx->f[3]; + REQUIRE(result == DBL_MAX); + }); +} diff --git a/tools/alloy-test/test_util.h b/tools/alloy-test/util.h similarity index 84% rename from tools/alloy-test/test_util.h rename to tools/alloy-test/util.h index c2406a925..175140f37 100644 --- a/tools/alloy-test/test_util.h +++ b/tools/alloy-test/util.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef ALLOY_TEST_TEST_UTIL_H_ -#define ALLOY_TEST_TEST_UTIL_H_ +#ifndef ALLOY_TEST_UTIL_H_ +#define ALLOY_TEST_UTIL_H_ #include #include @@ -28,18 +28,6 @@ namespace test { using alloy::frontend::ppc::PPCContext; using alloy::runtime::Runtime; -int main(std::vector& args) { - std::vector narrow_args; - auto narrow_argv = new char* [args.size()]; - for (size_t i = 0; i < args.size(); ++i) { - auto narrow_arg = poly::to_string(args[i]); - narrow_argv[i] = const_cast(narrow_arg.data()); - narrow_args.push_back(std::move(narrow_arg)); - } - int ret = Catch::Session().run(int(args.size()), narrow_argv); - return ret; -} - class ThreadState : public alloy::runtime::ThreadState { public: ThreadState(Runtime* runtime, uint32_t thread_id, uint64_t stack_address, @@ -159,7 +147,28 @@ class TestFunction { std::vector> runtimes; }; +inline hir::Value* LoadGPR(hir::HIRBuilder& b, int reg) { + return b.LoadContext(offsetof(PPCContext, r) + reg * 8, hir::INT64_TYPE); +} +inline void StoreGPR(hir::HIRBuilder& b, int reg, hir::Value* value) { + b.StoreContext(offsetof(PPCContext, r) + reg * 8, value); +} + +inline hir::Value* LoadFPR(hir::HIRBuilder& b, int reg) { + return b.LoadContext(offsetof(PPCContext, f) + reg * 8, hir::FLOAT64_TYPE); +} +inline void StoreFPR(hir::HIRBuilder& b, int reg, hir::Value* value) { + b.StoreContext(offsetof(PPCContext, f) + reg * 8, value); +} + +inline hir::Value* LoadVR(hir::HIRBuilder& b, int reg) { + return b.LoadContext(offsetof(PPCContext, v) + reg * 16, hir::VEC128_TYPE); +} +inline void StoreVR(hir::HIRBuilder& b, int reg, hir::Value* value) { + b.StoreContext(offsetof(PPCContext, v) + reg * 16, value); +} + } // namespace test } // namespace alloy -#endif // ALLOY_TEST_TEST_UTIL_H_ +#endif // ALLOY_TEST_UTIL_H_