set eol-style native

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5307 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
j4ck.fr0st 2010-04-09 19:28:18 +00:00
parent 57a3c87815
commit ab76cbf2fc
4 changed files with 236 additions and 236 deletions

View file

@ -1,35 +1,35 @@
# -*- python -*-
Import('env')
files = [
"assemble.cpp",
"disassemble.cpp",
"DSPAccelerator.cpp",
"DSPBreakpoints.cpp",
"DSPIntCCUtil.cpp",
"DSPIntExtOps.cpp",
"DSPHWInterface.cpp",
"DSPMemoryMap.cpp",
"DSPStacks.cpp",
"DSPAnalyzer.cpp",
"DspIntArithmetic.cpp",
"DspIntBranch.cpp",
"DspIntLoadStore.cpp",
"DspIntMisc.cpp",
"DspIntMultiplier.cpp",
"DSPEmitter.cpp",
"DSPCodeUtil.cpp",
"LabelMap.cpp",
"DSPInterpreter.cpp",
"DSPCore.cpp",
"DSPTables.cpp",
"Jit/DSPJitExtOps.cpp",
"Jit/DSPJitUtil.cpp",
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
acenv.StaticLibrary(env['local_libs'] + 'dspcore', files, LIBS = [ 'common'] )
# -*- python -*-
Import('env')
files = [
"assemble.cpp",
"disassemble.cpp",
"DSPAccelerator.cpp",
"DSPBreakpoints.cpp",
"DSPIntCCUtil.cpp",
"DSPIntExtOps.cpp",
"DSPHWInterface.cpp",
"DSPMemoryMap.cpp",
"DSPStacks.cpp",
"DSPAnalyzer.cpp",
"DspIntArithmetic.cpp",
"DspIntBranch.cpp",
"DspIntLoadStore.cpp",
"DspIntMisc.cpp",
"DspIntMultiplier.cpp",
"DSPEmitter.cpp",
"DSPCodeUtil.cpp",
"LabelMap.cpp",
"DSPInterpreter.cpp",
"DSPCore.cpp",
"DSPTables.cpp",
"Jit/DSPJitExtOps.cpp",
"Jit/DSPJitUtil.cpp",
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
acenv.StaticLibrary(env['local_libs'] + 'dspcore', files, LIBS = [ 'common'] )

View file

@ -1,84 +1,84 @@
#include "DSPJitTester.h"
void nx_dr()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x04);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void nx_ir()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x08);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void nx_nr()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x0c);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void AudioJitTests()
{
DSPJitTester::Initialize();
nx_ir();
nx_dr();
//nx_nr();
}
//required to be able to link against DSPCore
void DSPHost_UpdateDebugger() { }
unsigned int DSPHost_CodeLoaded(unsigned const char*, int) { return 0; }
void DSPHost_InterruptRequest() { }
bool DSPHost_OnThread() { return false; }
void DSPHost_WriteHostMemory(unsigned char, unsigned int) { }
#include "DSPJitTester.h"
void nx_dr()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x04);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void nx_ir()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x08);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void nx_nr()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x0c);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void AudioJitTests()
{
DSPJitTester::Initialize();
nx_ir();
nx_dr();
//nx_nr();
}
//required to be able to link against DSPCore
void DSPHost_UpdateDebugger() { }
unsigned int DSPHost_CodeLoaded(unsigned const char*, int) { return 0; }
void DSPHost_InterruptRequest() { }
bool DSPHost_OnThread() { return false; }
void DSPHost_WriteHostMemory(unsigned char, unsigned int) { }
unsigned char DSPHost_ReadHostMemory(unsigned int) { return 0; }

View file

@ -1,71 +1,71 @@
#include "DSPJitTester.h"
bool DSPJitTester::Test(SDSP dsp_settings)
{
if (be_verbose)
printf("Running %s: ", instruction_name);
last_int_dsp = RunInterpreter(dsp_settings);
last_jit_dsp = RunJit(dsp_settings);
run_count++;
bool success = AreEqual(last_int_dsp, last_jit_dsp);
if (!success)
fail_count++;
return success;
}
SDSP DSPJitTester::RunInterpreter(SDSP dsp_settings)
{
ResetInterpreter();
memcpy(&g_dsp, &dsp_settings, sizeof(SDSP));
ExecuteInstruction(instruction);
return g_dsp;
}
SDSP DSPJitTester::RunJit(SDSP dsp_settings)
{
ResetJit();
memcpy(&g_dsp, &dsp_settings, sizeof(SDSP));
const u8* code = jit.GetCodePtr();
jit.WriteCallInterpreter(instruction);
jit.RET();
((void(*)())code)();
return g_dsp;
}
void DSPJitTester::ResetInterpreter()
{
for (int i=0; i < WRITEBACKLOGSIZE; i++)
writeBackLogIdx[i] = -1;
}
void DSPJitTester::ResetJit()
{
jit.ClearCodeSpace();
}
bool DSPJitTester::AreEqual(SDSP& int_dsp, SDSP& jit_dsp)
{
bool equal = true;
for (int i = 0; i < 32; i++)
{
if (int_dsp.r[i] != jit_dsp.r[i])
{
if (equal && be_verbose)
printf("failed\n");
equal = false;
if (be_verbose)
printf("\t%s: int = 0x%04x, jit = 0x%04x\n", regnames[i].name, int_dsp.r[i], jit_dsp.r[i]);
}
}
if (equal && be_verbose)
printf("passed\n");
return equal;
}
void DSPJitTester::Report()
{
printf("%s (0x%04x): Ran %d times, Failed %d times.\n", instruction_name, instruction, run_count, fail_count);
}
void DSPJitTester::Initialize()
{
//init int
InitInstructionTable();
#include "DSPJitTester.h"
bool DSPJitTester::Test(SDSP dsp_settings)
{
if (be_verbose)
printf("Running %s: ", instruction_name);
last_int_dsp = RunInterpreter(dsp_settings);
last_jit_dsp = RunJit(dsp_settings);
run_count++;
bool success = AreEqual(last_int_dsp, last_jit_dsp);
if (!success)
fail_count++;
return success;
}
SDSP DSPJitTester::RunInterpreter(SDSP dsp_settings)
{
ResetInterpreter();
memcpy(&g_dsp, &dsp_settings, sizeof(SDSP));
ExecuteInstruction(instruction);
return g_dsp;
}
SDSP DSPJitTester::RunJit(SDSP dsp_settings)
{
ResetJit();
memcpy(&g_dsp, &dsp_settings, sizeof(SDSP));
const u8* code = jit.GetCodePtr();
jit.WriteCallInterpreter(instruction);
jit.RET();
((void(*)())code)();
return g_dsp;
}
void DSPJitTester::ResetInterpreter()
{
for (int i=0; i < WRITEBACKLOGSIZE; i++)
writeBackLogIdx[i] = -1;
}
void DSPJitTester::ResetJit()
{
jit.ClearCodeSpace();
}
bool DSPJitTester::AreEqual(SDSP& int_dsp, SDSP& jit_dsp)
{
bool equal = true;
for (int i = 0; i < 32; i++)
{
if (int_dsp.r[i] != jit_dsp.r[i])
{
if (equal && be_verbose)
printf("failed\n");
equal = false;
if (be_verbose)
printf("\t%s: int = 0x%04x, jit = 0x%04x\n", regnames[i].name, int_dsp.r[i], jit_dsp.r[i]);
}
}
if (equal && be_verbose)
printf("passed\n");
return equal;
}
void DSPJitTester::Report()
{
printf("%s (0x%04x): Ran %d times, Failed %d times.\n", instruction_name, instruction, run_count, fail_count);
}
void DSPJitTester::Initialize()
{
//init int
InitInstructionTable();
}

View file

@ -1,49 +1,49 @@
#ifndef __DSP_JIT_TESTER_
#define __DSP_JIT_TESTER_
#include "DSPCore.h"
#include "DSPInterpreter.h"
//#include "DSPIntExtOps.h"
//
//#include "x64Emitter.h"
class DSPJitTester
{
UDSPInstruction instruction;
const DSPOPCTemplate *opcode_template;
DSPEmitter jit;
SDSP last_int_dsp;
SDSP last_jit_dsp;
bool be_verbose;
int run_count;
int fail_count;
char instruction_name[16];
bool AreEqual(SDSP&, SDSP&);
public:
DSPJitTester(u16 opcode, u16 opcode_ext, bool verbose = false)
: be_verbose(verbose), run_count(0), fail_count(0)
{
instruction = opcode << 9 | opcode_ext;
opcode_template = GetOpTemplate(instruction);
sprintf(instruction_name, "%s", opcode_template->name);
if (opcode_template->extended)
sprintf(&instruction_name[strlen(instruction_name)], "'%s",
extOpTable[instruction & (((instruction >> 12) == 0x3) ? 0x7F : 0xFF)]->name);
}
bool Test(SDSP);
SDSP RunInterpreter(SDSP);
SDSP RunJit(SDSP);
void ResetInterpreter();
void ResetJit();
inline SDSP GetLastInterpreterDSP() { return last_int_dsp; }
inline SDSP GetLastJitDSP() { return last_jit_dsp; }
inline int GetRunCount() { return run_count; }
inline int GetFailCount() { return fail_count; }
inline const char* GetInstructionName() { return instruction_name; }
void Report();
static void Initialize();
};
#ifndef __DSP_JIT_TESTER_
#define __DSP_JIT_TESTER_
#include "DSPCore.h"
#include "DSPInterpreter.h"
//#include "DSPIntExtOps.h"
//
//#include "x64Emitter.h"
class DSPJitTester
{
UDSPInstruction instruction;
const DSPOPCTemplate *opcode_template;
DSPEmitter jit;
SDSP last_int_dsp;
SDSP last_jit_dsp;
bool be_verbose;
int run_count;
int fail_count;
char instruction_name[16];
bool AreEqual(SDSP&, SDSP&);
public:
DSPJitTester(u16 opcode, u16 opcode_ext, bool verbose = false)
: be_verbose(verbose), run_count(0), fail_count(0)
{
instruction = opcode << 9 | opcode_ext;
opcode_template = GetOpTemplate(instruction);
sprintf(instruction_name, "%s", opcode_template->name);
if (opcode_template->extended)
sprintf(&instruction_name[strlen(instruction_name)], "'%s",
extOpTable[instruction & (((instruction >> 12) == 0x3) ? 0x7F : 0xFF)]->name);
}
bool Test(SDSP);
SDSP RunInterpreter(SDSP);
SDSP RunJit(SDSP);
void ResetInterpreter();
void ResetJit();
inline SDSP GetLastInterpreterDSP() { return last_int_dsp; }
inline SDSP GetLastJitDSP() { return last_jit_dsp; }
inline int GetRunCount() { return run_count; }
inline int GetFailCount() { return fail_count; }
inline const char* GetInstructionName() { return instruction_name; }
void Report();
static void Initialize();
};
#endif