More work on gentest, fix a VFPU bug it found comparing to real PSP!

This commit is contained in:
Henrik Rydgard 2012-11-11 16:46:25 +01:00
parent f2cb1b66bc
commit 9aa0beff3e
5 changed files with 22 additions and 15 deletions

2
.gitignore vendored
View File

@ -30,3 +30,5 @@ Windows/x64
Windows/ipch
Memstick
android/ui_atlas.zim
__testoutput.txt
__testerror.txt

View File

@ -323,13 +323,14 @@ namespace MIPSInt
void Int_Viim(u32 op)
{
int vt = _VT;
int imm = op&0xFFFF;
s32 imm = (s16)(op&0xFFFF);
u16 uimm16 = (op&0xFFFF);
//V(vt) = (float)imm;
int type = (op >> 23) & 7;
if (type == 6)
V(vt) = (float)imm;
else if (type == 7)
V(vt) = Float16ToFloat32((u16)imm);
V(vt) = Float16ToFloat32((u16)uimm16);
else
_dbg_assert_msg_(CPU,0,"Trying to interpret instruction that can't be interpreted");
@ -1040,7 +1041,7 @@ namespace MIPSInt
static const float constants[32] =
{
0,
std::numeric_limits<float>::infinity(), // or max() ?? pspautotests seem to indicate inf
std::numeric_limits<float>::max(), // or max() ?? pspautotests seem to indicate inf
sqrtf(2.0f),
sqrtf(0.5f),
2.0f/sqrtf((float)M_PI),

View File

@ -37,6 +37,10 @@ def gen_test(test):
prx_path = TEST_ROOT + test + ".prx"
expected_path = TEST_ROOT + test + ".expected"
if not os.path.exists(prx_path):
print "You must compile the test into a PRX first (" + prx_path + ")"
return
# First, write a command file for PSPSH
f = open("cmdfile.txt", "w")
@ -50,7 +54,7 @@ def gen_test(test):
if os.path.exists(OUTFILE):
# Should check for size as well...
shutil.move(OUTFILE, expected_path)
shutil.copyfile(OUTFILE, expected_path)
print "Expected file written: " + expected_path
else:
print "ERROR: No " + OUTFILE + " was written, can't write .expected"

@ -1 +1 @@
Subproject commit 31c46f50c5175f480dd93c61e3dc738fe179b760
Subproject commit 696aad4df5ff0e4cd26dd46b705ca1c2fe57ccfd

20
test.py
View File

@ -105,9 +105,12 @@ def run_tests(test_list, args):
for test in test_list:
# Try prx first
expected_filename = TEST_ROOT + test + ".expected"
elf_filename = TEST_ROOT + test + ".prx"
print elf_filename
if not os.path.exists(elf_filename):
print "WARNING: no prx, trying elf"
elf_filename = TEST_ROOT + test + ".elf"
if not os.path.exists(elf_filename):
@ -138,12 +141,9 @@ def run_tests(test_list, args):
for i in range(0, min(len(output_lines), len(expected_lines))):
if output_lines[i] != expected_lines[i]:
#print "First different line (output vs expected):"
#print output_lines[i]
#print " --- expected: ---"
#print expected_lines[i]
print "%i < %s" % (i, output_lines[i])
print "%i > %s" % (i, expected_lines[i])
different = True
break
if len(output_lines) != len(expected_lines):
print "*** Different number of lines!"
@ -153,11 +153,11 @@ def run_tests(test_list, args):
print " " + test + " - passed!"
tests_passed.append(test)
else:
print "============== output from failed " + test + " :"
print output
print "============== expected output:"
print expected_output
print "==============================="
#print "============== output from failed " + test + " :"
#print output
#print "============== expected output:"
#print expected_output
#print "==============================="
tests_failed.append(test)
print "%i tests passed, %i tests failed." % (