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 Windows/ipch
Memstick Memstick
android/ui_atlas.zim android/ui_atlas.zim
__testoutput.txt
__testerror.txt

View File

@ -323,13 +323,14 @@ namespace MIPSInt
void Int_Viim(u32 op) void Int_Viim(u32 op)
{ {
int vt = _VT; int vt = _VT;
int imm = op&0xFFFF; s32 imm = (s16)(op&0xFFFF);
u16 uimm16 = (op&0xFFFF);
//V(vt) = (float)imm; //V(vt) = (float)imm;
int type = (op >> 23) & 7; int type = (op >> 23) & 7;
if (type == 6) if (type == 6)
V(vt) = (float)imm; V(vt) = (float)imm;
else if (type == 7) else if (type == 7)
V(vt) = Float16ToFloat32((u16)imm); V(vt) = Float16ToFloat32((u16)uimm16);
else else
_dbg_assert_msg_(CPU,0,"Trying to interpret instruction that can't be interpreted"); _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] = static const float constants[32] =
{ {
0, 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(2.0f),
sqrtf(0.5f), sqrtf(0.5f),
2.0f/sqrtf((float)M_PI), 2.0f/sqrtf((float)M_PI),

View File

@ -37,6 +37,10 @@ def gen_test(test):
prx_path = TEST_ROOT + test + ".prx" prx_path = TEST_ROOT + test + ".prx"
expected_path = TEST_ROOT + test + ".expected" 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 # First, write a command file for PSPSH
f = open("cmdfile.txt", "w") f = open("cmdfile.txt", "w")
@ -50,7 +54,7 @@ def gen_test(test):
if os.path.exists(OUTFILE): if os.path.exists(OUTFILE):
# Should check for size as well... # Should check for size as well...
shutil.move(OUTFILE, expected_path) shutil.copyfile(OUTFILE, expected_path)
print "Expected file written: " + expected_path print "Expected file written: " + expected_path
else: else:
print "ERROR: No " + OUTFILE + " was written, can't write .expected" 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: for test in test_list:
# Try prx first # Try prx first
expected_filename = TEST_ROOT + test + ".expected" expected_filename = TEST_ROOT + test + ".expected"
elf_filename = TEST_ROOT + test + ".prx" elf_filename = TEST_ROOT + test + ".prx"
print elf_filename
if not os.path.exists(elf_filename): if not os.path.exists(elf_filename):
print "WARNING: no prx, trying elf"
elf_filename = TEST_ROOT + test + ".elf" elf_filename = TEST_ROOT + test + ".elf"
if not os.path.exists(elf_filename): 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))): for i in range(0, min(len(output_lines), len(expected_lines))):
if output_lines[i] != expected_lines[i]: if output_lines[i] != expected_lines[i]:
#print "First different line (output vs expected):" print "%i < %s" % (i, output_lines[i])
#print output_lines[i] print "%i > %s" % (i, expected_lines[i])
#print " --- expected: ---"
#print expected_lines[i]
different = True different = True
break
if len(output_lines) != len(expected_lines): if len(output_lines) != len(expected_lines):
print "*** Different number of lines!" print "*** Different number of lines!"
@ -153,11 +153,11 @@ def run_tests(test_list, args):
print " " + test + " - passed!" print " " + test + " - passed!"
tests_passed.append(test) tests_passed.append(test)
else: else:
print "============== output from failed " + test + " :" #print "============== output from failed " + test + " :"
print output #print output
print "============== expected output:" #print "============== expected output:"
print expected_output #print expected_output
print "===============================" #print "==============================="
tests_failed.append(test) tests_failed.append(test)
print "%i tests passed, %i tests failed." % ( print "%i tests passed, %i tests failed." % (