Reorganized unit tests

This commit is contained in:
Alexandro Sánchez Bach 2015-10-24 21:39:03 +01:00
parent a5773e08c6
commit 0d0d81b7d9
19 changed files with 270 additions and 291 deletions

View file

@ -9,11 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "externals\zlib\zlib
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{04EA3EAD-EA25-4335-8AB4-743FD64EA58E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "tests\unit\unit.vcxproj", "{B1FF30F1-16CC-43E9-A896-CE8D54312F62}"
ProjectSection(ProjectDependencies) = postProject
{D646D01B-1B44-4C1F-8308-4EDA00D55609} = {D646D01B-1B44-4C1F-8308-4EDA00D55609}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wrappers", "wrappers", "{23F66B7C-9BC8-409B-8135-3C3AC7423527}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windows", "windows", "{61FB041F-37E1-428A-B735-345A24C94CA1}"
@ -61,6 +56,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "nucleus\core\core.v
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memory", "nucleus\memory\memory.vcxproj", "{96B95468-3FE2-4D9D-9D4F-B5B996C872C6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_cpu", "tests\cpu\test_cpu.vcxproj", "{B1FF30F1-16CC-43E9-A896-CE8D54312F62}"
ProjectSection(ProjectDependencies) = postProject
{D646D01B-1B44-4C1F-8308-4EDA00D55609} = {D646D01B-1B44-4C1F-8308-4EDA00D55609}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -71,10 +71,6 @@ Global
{F761046E-6C38-4428-A5F1-38391A37BB34}.Debug|x64.Build.0 = Debug|x64
{F761046E-6C38-4428-A5F1-38391A37BB34}.Release|x64.ActiveCfg = Release|x64
{F761046E-6C38-4428-A5F1-38391A37BB34}.Release|x64.Build.0 = Release|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Debug|x64.ActiveCfg = Debug|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Debug|x64.Build.0 = Debug|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Release|x64.ActiveCfg = Release|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Release|x64.Build.0 = Release|x64
{D355BE01-81EB-4204-97CF-1C273C287E9F}.Debug|x64.ActiveCfg = Debug|x64
{D355BE01-81EB-4204-97CF-1C273C287E9F}.Debug|x64.Build.0 = Debug|x64
{D355BE01-81EB-4204-97CF-1C273C287E9F}.Release|x64.ActiveCfg = Release|x64
@ -127,13 +123,16 @@ Global
{96B95468-3FE2-4D9D-9D4F-B5B996C872C6}.Debug|x64.Build.0 = Debug|x64
{96B95468-3FE2-4D9D-9D4F-B5B996C872C6}.Release|x64.ActiveCfg = Release|x64
{96B95468-3FE2-4D9D-9D4F-B5B996C872C6}.Release|x64.Build.0 = Release|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Debug|x64.ActiveCfg = Debug|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Debug|x64.Build.0 = Debug|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Release|x64.ActiveCfg = Release|x64
{B1FF30F1-16CC-43E9-A896-CE8D54312F62}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F761046E-6C38-4428-A5F1-38391A37BB34} = {697C8FFB-2D7C-418D-A387-054747206AC2}
{B1FF30F1-16CC-43E9-A896-CE8D54312F62} = {04EA3EAD-EA25-4335-8AB4-743FD64EA58E}
{61FB041F-37E1-428A-B735-345A24C94CA1} = {23F66B7C-9BC8-409B-8135-3C3AC7423527}
{D355BE01-81EB-4204-97CF-1C273C287E9F} = {A7460D25-D247-4280-A724-C612EF91F823}
{C5DDBB9E-692C-49F0-988F-7A3442D4DD9B} = {61FB041F-37E1-428A-B735-345A24C94CA1}
@ -148,5 +147,6 @@ Global
{3F169D7D-3E50-448A-88A2-35FF7A6BD004} = {A7460D25-D247-4280-A724-C612EF91F823}
{C3E1D12D-C2D8-419E-B50D-87109376430E} = {A7460D25-D247-4280-A724-C612EF91F823}
{96B95468-3FE2-4D9D-9D4F-B5B996C872C6} = {A7460D25-D247-4280-A724-C612EF91F823}
{B1FF30F1-16CC-43E9-A896-CE8D54312F62} = {04EA3EAD-EA25-4335-8AB4-743FD64EA58E}
EndGlobalSection
EndGlobal

View file

@ -129,7 +129,7 @@ Value* Recompiler::getVR(int index) {
}
Value* Recompiler::getCR(int index) {
const U32 offset = offsetof(PPUState, cr);
const U32 offset = offsetof(PPUState, cr.field[index]);
// TODO: Use volatility information?
@ -228,7 +228,7 @@ void Recompiler::setVR(int index, Value* value) {
}
void Recompiler::setCR(int index, Value* value) {
const U32 offset = offsetof(PPUState, cr[index]);
const U32 offset = offsetof(PPUState, cr.field[index]);
if (value->type != TYPE_I32 && value->type != TYPE_I8) {
logger.error(LOG_CPU, "Wrong value type for CR register");

View file

@ -6,7 +6,7 @@
#pragma once
#include "nucleus/macro.h"
#include "tests/unit/common.h"
#include "tests/common.h"
// Set a lambda with auto arguments
#define TEST_INSTRUCTION(...) \

View file

@ -3,7 +3,7 @@
* Released under GPL v2 license. Read LICENSE for more details.
*/
#include "tests/unit/cpu/test_ppu.h"
#include "tests/cpu/test_ppc.h"
/**
* PPC64 Instructions:

View file

@ -3,7 +3,7 @@
* Released under GPL v2 license. Read LICENSE for more details.
*/
#include "tests/unit/cpu/test_ppu.h"
#include "tests/cpu/test_ppc.h"
/**
* PPC64 Instructions:

View file

@ -3,7 +3,7 @@
* Released under GPL v2 license. Read LICENSE for more details.
*/
#include "tests/unit/cpu/test_ppu.h"
#include "tests/cpu/test_ppc.h"
/**
* PPC64 Instructions:

View file

@ -3,7 +3,7 @@
* Released under GPL v2 license. Read LICENSE for more details.
*/
#include "tests/unit/cpu/test_ppu.h"
#include "tests/cpu/test_ppc.h"
/**
* PPC64 Instructions:
@ -17,10 +17,10 @@ void PPCTestRunner::addx() {
state.r[2] = R2;
run(add(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -35,10 +35,10 @@ void PPCTestRunner::addx() {
state.r[2] = R2;
run(add_(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -57,10 +57,10 @@ void PPCTestRunner::addcx() {
state.xer.ca = oldCA;
run(addc(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -78,10 +78,10 @@ void PPCTestRunner::addcx() {
state.xer.ca = oldCA;
run(addc_(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -101,10 +101,10 @@ void PPCTestRunner::addex() {
state.xer.ca = oldCA;
run(adde(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -122,10 +122,10 @@ void PPCTestRunner::addex() {
state.xer.ca = oldCA;
run(adde_(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -143,10 +143,10 @@ void PPCTestRunner::addi() {
state.r[RAIndex] = RA;
run(addi(r2, RAIndex, SIMM));
expect(state.r[2] == RD);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -167,10 +167,10 @@ void PPCTestRunner::addic() {
state.r[1] = R1;
run(addic(r2, r1, SIMM));
expect(state.r[2] == R2);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == CA);
@ -188,10 +188,10 @@ void PPCTestRunner::addic_() {
state.r[1] = R1;
run(addic_(r2, r1, SIMM));
expect(state.r[2] == R2);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == CA);
@ -210,10 +210,10 @@ void PPCTestRunner::addis() {
state.r[RAIndex] = RA;
run(addis(r2, RAIndex, SIMM));
expect(state.r[2] == RD);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -238,10 +238,10 @@ void PPCTestRunner::addzex() {
state.xer.ca = oldCA;
run(addze(r2, r1));
expect(state.r[2] == RD);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -260,10 +260,10 @@ void PPCTestRunner::addzex() {
state.xer.ca = oldCA;
run(addze_(r2, r1));
expect(state.r[2] == RD);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -284,10 +284,10 @@ void PPCTestRunner::andx() {
state.r[2] = R2;
run(and_(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -302,10 +302,10 @@ void PPCTestRunner::andx() {
state.r[2] = R2;
run(and__(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -323,10 +323,10 @@ void PPCTestRunner::andcx() {
state.r[2] = R2;
run(andc(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -341,10 +341,10 @@ void PPCTestRunner::andcx() {
state.r[2] = R2;
run(andc_(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -361,10 +361,10 @@ void PPCTestRunner::andi_() {
state.r[1] = R1;
run(andi_(r2, r1, UIMM));
expect(state.r[2] == R2);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -380,10 +380,10 @@ void PPCTestRunner::andis_() {
state.r[1] = R1;
run(andis_(r2, r1, UIMM));
expect(state.r[2] == R2);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -432,10 +432,10 @@ void PPCTestRunner::extsbx() {
state.r[1] = RS;
run(extsb(r2, r1));
expect(state.r[2] == RA);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -449,10 +449,10 @@ void PPCTestRunner::extsbx() {
state.r[1] = RS;
run(extsb_(r2, r1));
expect(state.r[2] == RA);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -469,10 +469,10 @@ void PPCTestRunner::extshx() {
state.r[1] = RS;
run(extsh(r2, r1));
expect(state.r[2] == RA);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -486,10 +486,10 @@ void PPCTestRunner::extshx() {
state.r[1] = RS;
run(extsh_(r2, r1));
expect(state.r[2] == RA);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -506,10 +506,10 @@ void PPCTestRunner::extswx() {
state.r[1] = RS;
run(extsw(r2, r1));
expect(state.r[2] == RA);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -523,10 +523,10 @@ void PPCTestRunner::extswx() {
state.r[1] = RS;
run(extsw_(r2, r1));
expect(state.r[2] == RA);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -565,10 +565,10 @@ void PPCTestRunner::nandx() {
state.r[2] = RB;
run(nand(r3, r1, r2));
expect(state.r[3] == RA);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -584,10 +584,10 @@ void PPCTestRunner::nandx() {
state.r[2] = RB;
run(nand_(r3, r1, r2));
expect(state.r[3] == RA);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -604,10 +604,10 @@ void PPCTestRunner::negx() {
state.r[1] = RA;
run(neg(r2, r1));
expect(state.r[2] == RD);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -622,10 +622,10 @@ void PPCTestRunner::negx() {
state.r[1] = RA;
run(neg_(r2, r1));
expect(state.r[2] == RD);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -643,10 +643,10 @@ void PPCTestRunner::norx() {
state.r[2] = RB;
run(nor(r3, r1, r2));
expect(state.r[3] == RA);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -662,10 +662,10 @@ void PPCTestRunner::norx() {
state.r[2] = RB;
run(nor_(r3, r1, r2));
expect(state.r[3] == RA);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -683,10 +683,10 @@ void PPCTestRunner::orx() {
state.r[2] = R2;
run(or_(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -701,10 +701,10 @@ void PPCTestRunner::orx() {
state.r[2] = R2;
run(or__(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -722,10 +722,10 @@ void PPCTestRunner::orcx() {
state.r[2] = R2;
run(orc(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -740,10 +740,10 @@ void PPCTestRunner::orcx() {
state.r[2] = R2;
run(orc_(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -760,10 +760,10 @@ void PPCTestRunner::ori() {
state.r[1] = R1;
run(ori(r2, r1, UIMM));
expect(state.r[2] == R2);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -779,10 +779,10 @@ void PPCTestRunner::oris() {
state.r[1] = R1;
run(oris(r2, r1, UIMM));
expect(state.r[2] == R2);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -847,10 +847,10 @@ void PPCTestRunner::subfx() {
state.r[2] = R2;
run(subf(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -865,10 +865,10 @@ void PPCTestRunner::subfx() {
state.r[2] = R2;
run(subf_(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -887,10 +887,10 @@ void PPCTestRunner::subfcx() {
state.xer.ca = oldCA;
run(subfc(r3, r1, r2));
expect(state.r[3] == RD);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -908,10 +908,10 @@ void PPCTestRunner::subfcx() {
state.xer.ca = oldCA;
run(subfc_(r3, r1, r2));
expect(state.r[3] == RD);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -931,10 +931,10 @@ void PPCTestRunner::subfex() {
state.xer.ca = oldCA;
run(adde(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -952,10 +952,10 @@ void PPCTestRunner::subfex() {
state.xer.ca = oldCA;
run(subfe_(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -973,10 +973,10 @@ void PPCTestRunner::subfic() {
state.r[1] = R1;
run(subfic(r2, r1, SIMM));
expect(state.r[2] == R2);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == CA);
@ -998,10 +998,10 @@ void PPCTestRunner::subfzex() {
state.xer.ca = oldCA;
run(addze(r2, r1));
expect(state.r[2] == RD);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -1020,10 +1020,10 @@ void PPCTestRunner::subfzex() {
state.xer.ca = oldCA;
run(addze_(r2, r1));
expect(state.r[2] == RD);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(state.xer.ca == newCA);
@ -1044,10 +1044,10 @@ void PPCTestRunner::xorx() {
state.r[2] = R2;
run(xor_(r3, r1, r2));
expect(state.r[3] == R3);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -1062,10 +1062,10 @@ void PPCTestRunner::xorx() {
state.r[2] = R2;
run(xor__(r3, r1, r2));
expect(state.r[3] == R3);
expect(state.cr[0].lt == LT);
expect(state.cr[0].gt == GT);
expect(state.cr[0].eq == EQ);
expect(state.cr[0].so == SO);
expect(state.cr.field[0].lt == LT);
expect(state.cr.field[0].gt == GT);
expect(state.cr.field[0].eq == EQ);
expect(state.cr.field[0].so == SO);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -1082,10 +1082,10 @@ void PPCTestRunner::xori() {
state.r[1] = R1;
run(xori(r2, r1, UIMM));
expect(state.r[2] == R2);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);
@ -1101,10 +1101,10 @@ void PPCTestRunner::xoris() {
state.r[1] = R1;
run(xoris(r2, r1, UIMM));
expect(state.r[2] == R2);
expect(!state.cr[0].lt);
expect(!state.cr[0].gt);
expect(!state.cr[0].eq);
expect(!state.cr[0].so);
expect(!state.cr.field[0].lt);
expect(!state.cr.field[0].gt);
expect(!state.cr.field[0].eq);
expect(!state.cr.field[0].so);
expect(!state.xer.so);
expect(!state.xer.ov);
expect(!state.xer.ca);

View file

@ -3,7 +3,7 @@
* Released under GPL v2 license. Read LICENSE for more details.
*/
#include "tests/unit/cpu/test_ppu.h"
#include "tests/cpu/test_ppc.h"
/**
* PPC64 Instructions:

View file

@ -3,7 +3,7 @@
* Released under GPL v2 license. Read LICENSE for more details.
*/
#include "tests/unit/cpu/test_ppu.h"
#include "tests/cpu/test_ppc.h"
/**
* PPC64 Vector/SIMD Instructions (aka AltiVec):

View file

@ -11,29 +11,26 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="cpu\ppc\ppc_branch.cpp" />
<ClCompile Include="cpu\ppc\ppc_control.cpp" />
<ClCompile Include="cpu\ppc\ppc_float.cpp" />
<ClCompile Include="cpu\ppc\ppc_integer.cpp" />
<ClCompile Include="cpu\ppc\ppc_memory.cpp" />
<ClCompile Include="cpu\ppc\ppc_vector.cpp" />
<ClCompile Include="cpu\test_ir.cpp" />
<ClCompile Include="cpu\test_ppu.cpp" />
<ClCompile Include="cpu\test_spu.cpp" />
<ClCompile Include="test_common.cpp" />
<ClCompile Include="ppc\ppc_branch.cpp" />
<ClCompile Include="ppc\ppc_control.cpp" />
<ClCompile Include="ppc\ppc_float.cpp" />
<ClCompile Include="ppc\ppc_integer.cpp" />
<ClCompile Include="ppc\ppc_memory.cpp" />
<ClCompile Include="ppc\ppc_vector.cpp" />
<ClCompile Include="test_ir.cpp" />
<ClCompile Include="test_ppc.cpp" />
<ClCompile Include="test_spu.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="common.h" />
<ClInclude Include="cpu\common.h" />
<ClInclude Include="cpu\test_ppu.h" />
<ClInclude Include="test_ppc.h" />
</ItemGroup>
<ItemGroup>
<None Include="cpu\test_ppu.inl" />
<None Include="test_ppc.inl" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B1FF30F1-16CC-43E9-A896-CE8D54312F62}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>unit</RootNamespace>
<RootNamespace>test_cpu</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="ppc">
<UniqueIdentifier>{8e9abc21-40db-4caf-bb82-156cfa3b8f52}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="test_spu.cpp" />
<ClCompile Include="test_ir.cpp" />
<ClCompile Include="test_ppc.cpp" />
<ClCompile Include="ppc\ppc_memory.cpp">
<Filter>ppc</Filter>
</ClCompile>
<ClCompile Include="ppc\ppc_vector.cpp">
<Filter>ppc</Filter>
</ClCompile>
<ClCompile Include="ppc\ppc_branch.cpp">
<Filter>ppc</Filter>
</ClCompile>
<ClCompile Include="ppc\ppc_control.cpp">
<Filter>ppc</Filter>
</ClCompile>
<ClCompile Include="ppc\ppc_float.cpp">
<Filter>ppc</Filter>
</ClCompile>
<ClCompile Include="ppc\ppc_integer.cpp">
<Filter>ppc</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="test_ppc.h" />
</ItemGroup>
<ItemGroup>
<None Include="test_ppc.inl" />
</ItemGroup>
</Project>

View file

@ -38,7 +38,7 @@ public:
Compiler* compiler = new x86::X86Compiler();
compiler->addPass(std::make_unique<passes::RegisterAllocationPass>(compiler->targetInfo));
compiler->compile(module);
auto result = function->call(3,4);
Assert::IsTrue(result == 28);
//auto result = function->call(3,4);
//Assert::IsTrue(result == 28);
}
};

View file

@ -7,7 +7,7 @@
#include "CppUnitTest.h"
// Testing dependencies
#include "test_ppu.h"
#include "test_ppc.h"
#define TEST_METHOD_INSTRUCTION(method) \
TEST_METHOD_CATEGORY(method, L"PowerPC Tests") { test.##method##(); }
@ -17,6 +17,6 @@ TEST_CLASS(PPCTests) {
public:
#define INSTRUCTION(name) TEST_METHOD_INSTRUCTION(name)
#include "test_ppu.inl"
#include "test_ppc.inl"
#undef INSTRUCTION
};

View file

@ -7,7 +7,7 @@
#include "CppUnitTest.h"
// Nucleus testing dependencies
#include "tests/unit/cpu/common.h"
#include "tests/cpu/common.h"
// Target
#include "nucleus/cpu/backend/x86/x86_compiler.h"
@ -88,6 +88,6 @@ protected:
public:
#define INSTRUCTION(name) void name()
#include "test_ppu.inl"
#include "test_ppc.inl"
#undef INSTRUCTION
};

View file

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="test_common.cpp" />
<ClCompile Include="cpu\test_ppu.cpp">
<Filter>cpu</Filter>
</ClCompile>
<ClCompile Include="cpu\test_spu.cpp">
<Filter>cpu</Filter>
</ClCompile>
<ClCompile Include="cpu\test_ir.cpp">
<Filter>cpu</Filter>
</ClCompile>
<ClCompile Include="cpu\ppc\ppc_integer.cpp">
<Filter>cpu\ppc</Filter>
</ClCompile>
<ClCompile Include="cpu\ppc\ppc_control.cpp">
<Filter>cpu\ppc</Filter>
</ClCompile>
<ClCompile Include="cpu\ppc\ppc_float.cpp">
<Filter>cpu\ppc</Filter>
</ClCompile>
<ClCompile Include="cpu\ppc\ppc_memory.cpp">
<Filter>cpu\ppc</Filter>
</ClCompile>
<ClCompile Include="cpu\ppc\ppc_vector.cpp">
<Filter>cpu\ppc</Filter>
</ClCompile>
<ClCompile Include="cpu\ppc\ppc_branch.cpp">
<Filter>cpu\ppc</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="cpu">
<UniqueIdentifier>{91fce7c8-19c8-4cdf-b9e6-3c5d1b246427}</UniqueIdentifier>
</Filter>
<Filter Include="cpu\ppc">
<UniqueIdentifier>{4cca3aae-2e37-43a3-8a99-2ae016e700f9}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="cpu\common.h">
<Filter>cpu</Filter>
</ClInclude>
<ClInclude Include="cpu\test_ppu.h">
<Filter>cpu</Filter>
</ClInclude>
<ClInclude Include="common.h" />
</ItemGroup>
<ItemGroup>
<None Include="cpu\test_ppu.inl">
<Filter>cpu</Filter>
</None>
</ItemGroup>
</Project>