Moving alloy/ into xenia/cpu/ to start simplifying things.

This commit is contained in:
Ben Vanik
2015-03-24 07:46:18 -07:00
parent 59395318f3
commit 29912f44c0
519 changed files with 2246 additions and 2296 deletions

View File

@@ -0,0 +1,71 @@
/**
******************************************************************************
* 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 "third_party/xbyak/xbyak/xbyak_bin2hex.h"
#include "xenia/cpu/test/util.h"
using namespace xe::cpu::hir;
using namespace xe::cpu::runtime;
using namespace xe::cpu::test;
using xe::cpu::frontend::ppc::PPCContext;
using namespace poly;
TEST_CASE("VECTOR_ROTATE_LEFT_I8", "[instr]") {
TestFunction test([](HIRBuilder& b) {
StoreVR(b, 3, b.VectorRotateLeft(LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(B00000001);
ctx->v[5] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(B00000001, B00000010, B00000100, B00001000,
B00010000, B00100000, B01000000, B10000000,
B00000001, B00000010, B00000100, B00001000,
B00010000, B00100000, B01000000, B10000000));
});
}
TEST_CASE("VECTOR_ROTATE_LEFT_I16", "[instr]") {
TestFunction test([](HIRBuilder& b) {
StoreVR(b, 3, b.VectorRotateLeft(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x0001, 0x0001, 0x0001, 0x0001, 0x1000, 0x1000,
0x1000, 0x1000);
ctx->v[5] = vec128s(0, 1, 2, 3, 14, 15, 16, 17);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x0001, 0x0002, 0x0004, 0x0008, 0x0400,
0x0800, 0x1000, 0x2000));
});
}
TEST_CASE("VECTOR_ROTATE_LEFT_I32", "[instr]") {
TestFunction test([](HIRBuilder& b) {
StoreVR(b, 3, b.VectorRotateLeft(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x00000001, 0x00000001, 0x80000000, 0x80000000);
ctx->v[5] = vec128i(0, 1, 1, 2);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000001, 0x00000002, 0x00000001, 0x00000002));
});
}