diff options
| author | j4ck.fr0st <j4ck.fr0st@gmail.com> | 2010-04-09 19:28:18 +0000 |
|---|---|---|
| committer | j4ck.fr0st <j4ck.fr0st@gmail.com> | 2010-04-09 19:28:18 +0000 |
| commit | ab76cbf2fcf31b059edf10c220800150313ddf18 (patch) | |
| tree | 272a82d9382989b1b35067b2517c4a9ed4ae80ca /Source/UnitTests/DSPJitTester.cpp | |
| parent | 57a3c878158d56565e42164a2c23e01d07050dd3 (diff) | |
set eol-style native
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5307 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/UnitTests/DSPJitTester.cpp')
| -rw-r--r-- | Source/UnitTests/DSPJitTester.cpp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/Source/UnitTests/DSPJitTester.cpp b/Source/UnitTests/DSPJitTester.cpp index aa13aa6d6d..4be7ccf50b 100644 --- a/Source/UnitTests/DSPJitTester.cpp +++ b/Source/UnitTests/DSPJitTester.cpp @@ -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(); }
\ No newline at end of file |
