mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Add VU MinMax test.
This commit is contained in:
parent
30fd233015
commit
c5846ea263
7 changed files with 71 additions and 0 deletions
|
@ -21,6 +21,7 @@ add_executable(VuTest
|
|||
FlagsTest2.cpp
|
||||
FlagsTest3.cpp
|
||||
Main.cpp
|
||||
MinMaxTest.cpp
|
||||
StallTest.cpp
|
||||
StallTest2.cpp
|
||||
TestVm.cpp
|
||||
|
@ -31,6 +32,7 @@ add_executable(VuTest
|
|||
FlagsTest.h
|
||||
FlagsTest2.h
|
||||
FlagsTest3.h
|
||||
MinMaxTest.h
|
||||
StallTest.h
|
||||
StallTest2.h
|
||||
Test.h
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "FlagsTest.h"
|
||||
#include "FlagsTest2.h"
|
||||
#include "FlagsTest3.h"
|
||||
#include "MinMaxTest.h"
|
||||
#include "StallTest.h"
|
||||
#include "StallTest2.h"
|
||||
#include "TriAceTest.h"
|
||||
|
@ -18,6 +19,7 @@ static const TestFactoryFunction s_factories[] =
|
|||
[]() { return new CFlagsTest(); },
|
||||
[]() { return new CFlagsTest2(); },
|
||||
[]() { return new CFlagsTest3(); },
|
||||
[]() { return new CMinMaxTest(); },
|
||||
[]() { return new CStallTest(); },
|
||||
[]() { return new CStallTest2(); },
|
||||
[]() { return new CTriAceTest(); },
|
||||
|
|
45
tools/VuTest/MinMaxTest.cpp
Normal file
45
tools/VuTest/MinMaxTest.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include "MinMaxTest.h"
|
||||
#include "VuAssembler.h"
|
||||
|
||||
void CMinMaxTest::Execute(CTestVm& virtualMachine)
|
||||
{
|
||||
virtualMachine.Reset();
|
||||
|
||||
auto microMem = reinterpret_cast<uint32*>(virtualMachine.m_microMem);
|
||||
|
||||
//Inspired by Dynasty Warriors 5
|
||||
//Will use MINI on a vector, W contains alpha value as byte
|
||||
//Which is a denormal if we interpret is as a float
|
||||
//The denormal number should not be flushed to zero
|
||||
|
||||
CVuAssembler assembler(microMem);
|
||||
|
||||
assembler.Write(
|
||||
CVuAssembler::Upper::MINI(CVuAssembler::DEST_XYZW, CVuAssembler::VF1, CVuAssembler::VF2, CVuAssembler::VF3),
|
||||
CVuAssembler::Lower::NOP());
|
||||
|
||||
assembler.Write(
|
||||
CVuAssembler::Upper::NOP() | CVuAssembler::Upper::E_BIT,
|
||||
CVuAssembler::Lower::NOP());
|
||||
|
||||
assembler.Write(
|
||||
CVuAssembler::Upper::NOP(),
|
||||
CVuAssembler::Lower::NOP());
|
||||
|
||||
virtualMachine.m_cpu.m_State.nCOP2[2].nV0 = Float::_1;
|
||||
virtualMachine.m_cpu.m_State.nCOP2[2].nV1 = Float::_256;
|
||||
virtualMachine.m_cpu.m_State.nCOP2[2].nV2 = Float::_64;
|
||||
virtualMachine.m_cpu.m_State.nCOP2[2].nV3 = 0x80;
|
||||
|
||||
virtualMachine.m_cpu.m_State.nCOP2[3].nV0 = Float::_8;
|
||||
virtualMachine.m_cpu.m_State.nCOP2[3].nV1 = Float::_8;
|
||||
virtualMachine.m_cpu.m_State.nCOP2[3].nV2 = Float::_8;
|
||||
virtualMachine.m_cpu.m_State.nCOP2[3].nV3 = Float::_8;
|
||||
|
||||
virtualMachine.ExecuteTest(0);
|
||||
|
||||
TEST_VERIFY(virtualMachine.m_cpu.m_State.nCOP2[1].nV0 == Float::_1);
|
||||
TEST_VERIFY(virtualMachine.m_cpu.m_State.nCOP2[1].nV1 == Float::_8);
|
||||
TEST_VERIFY(virtualMachine.m_cpu.m_State.nCOP2[1].nV2 == Float::_8);
|
||||
TEST_VERIFY(virtualMachine.m_cpu.m_State.nCOP2[1].nV3 == 0x80);
|
||||
}
|
9
tools/VuTest/MinMaxTest.h
Normal file
9
tools/VuTest/MinMaxTest.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "Test.h"
|
||||
|
||||
class CMinMaxTest : public CTest
|
||||
{
|
||||
public:
|
||||
void Execute(CTestVm&) override;
|
||||
};
|
|
@ -22,5 +22,7 @@ public:
|
|||
_2 = 0x40000000,
|
||||
_4 = 0x40800000,
|
||||
_8 = 0x41000000,
|
||||
_64 = 0x42800000,
|
||||
_256 = 0x43800000,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -114,6 +114,16 @@ uint32 CVuAssembler::Upper::MULAbc(DEST dest, VF_REGISTER fs, VF_REGISTER ft, BR
|
|||
return result;
|
||||
}
|
||||
|
||||
uint32 CVuAssembler::Upper::MINI(DEST dest, VF_REGISTER fd, VF_REGISTER fs, VF_REGISTER ft)
|
||||
{
|
||||
uint32 result = 0x0000002F;
|
||||
result |= (fd << 6);
|
||||
result |= (fs << 11);
|
||||
result |= (ft << 16);
|
||||
result |= (dest << 21);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32 CVuAssembler::Upper::NOP()
|
||||
{
|
||||
return 0x000002FF;
|
||||
|
|
|
@ -121,6 +121,7 @@ public:
|
|||
static uint32 MULi(DEST, VF_REGISTER, VF_REGISTER);
|
||||
static uint32 MULq(DEST, VF_REGISTER, VF_REGISTER);
|
||||
static uint32 MULAbc(DEST, VF_REGISTER, VF_REGISTER, BROADCAST);
|
||||
static uint32 MINI(DEST, VF_REGISTER, VF_REGISTER, VF_REGISTER);
|
||||
static uint32 NOP();
|
||||
static uint32 OPMULA(VF_REGISTER, VF_REGISTER);
|
||||
static uint32 OPMSUB(VF_REGISTER, VF_REGISTER, VF_REGISTER);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue