mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add a simple way to test the X64 emitter. Update native.
This commit is contained in:
parent
d46c9c2f74
commit
34054b4f41
5 changed files with 49 additions and 1 deletions
2
native
2
native
|
@ -1 +1 @@
|
|||
Subproject commit 1150598ce463c99fbb08ba4177a7937692fe9bc0
|
||||
Subproject commit 2b6ed975e28de79d7dc34f225238eae631199afc
|
43
unittest/TestX64Emitter.cpp
Normal file
43
unittest/TestX64Emitter.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include "Common/X64Emitter.h"
|
||||
#include "Core/MIPS/x86/RegCacheFPU.h"
|
||||
#include "Core/MIPS/x86/Jit.h"
|
||||
#include "Core/MIPS/JitCommon/JitState.h"
|
||||
#include "Core/MIPS/JitCommon/JitCommon.h"
|
||||
#include "Core/MIPS/MIPSVFPUUtils.h"
|
||||
#include "ext/disarm.h"
|
||||
|
||||
#include "UnitTest.h"
|
||||
|
||||
static const u8 *prevStart = NULL;
|
||||
|
||||
bool CheckLast(Gen::XEmitter &emit, const char *comp) {
|
||||
auto vec = DisassembleX86(prevStart, emit.GetCodePtr() - prevStart);
|
||||
EXPECT_EQ_STR(vec[0], std::string(comp));
|
||||
return true;
|
||||
}
|
||||
|
||||
void PrintLast(Gen::XEmitter &emit) {
|
||||
for (const u8 *p = prevStart; p < emit.GetCodePtr(); p++) {
|
||||
printf("%02x ", *p);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
bool TestX64Emitter() {
|
||||
using namespace Gen;
|
||||
|
||||
u32 code[512];
|
||||
XEmitter emitter((u8 *)code);
|
||||
|
||||
prevStart = emitter.GetCodePtr();
|
||||
emitter.VADDSD(XMM0, XMM1, R(XMM7));
|
||||
RET(CheckLast(emitter, "vaddsd xmm0, xmm1, xmm7"));
|
||||
|
||||
prevStart = emitter.GetCodePtr();
|
||||
emitter.VMULSD(XMM0, XMM1, R(XMM7));
|
||||
RET(CheckLast(emitter, "vmulsd xmm0, xmm1, xmm7"));
|
||||
|
||||
// Just for checking.
|
||||
PrintLast(emitter);
|
||||
return true;
|
||||
}
|
|
@ -344,11 +344,14 @@ struct TestItem {
|
|||
#define TEST_ITEM(name) { #name, &Test ##name, }
|
||||
|
||||
bool TestArmEmitter();
|
||||
bool TestX64Emitter();
|
||||
|
||||
|
||||
TestItem availableTests[] = {
|
||||
TEST_ITEM(Asin),
|
||||
TEST_ITEM(SinCos),
|
||||
TEST_ITEM(ArmEmitter),
|
||||
TEST_ITEM(X64Emitter),
|
||||
TEST_ITEM(VFPUSinCos),
|
||||
TEST_ITEM(MathUtil),
|
||||
TEST_ITEM(Parsers),
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
<ClCompile Include="JitHarness.cpp" />
|
||||
<ClCompile Include="UnitTest.cpp" />
|
||||
<ClCompile Include="TestArmEmitter.cpp" />
|
||||
<ClCompile Include="TestX64Emitter.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.vcxproj">
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<ClCompile Include="..\native\ext\glew\glew.c" />
|
||||
<ClCompile Include="JitHarness.cpp" />
|
||||
<ClCompile Include="TestArmEmitter.cpp" />
|
||||
<ClCompile Include="TestX64Emitter.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="JitHarness.h" />
|
||||
|
|
Loading…
Add table
Reference in a new issue