Add some soft-float lirasm tests and automate testing of alternate configurations for ARM. [Bug 573998] [r=stejohns]

--HG--
extra : convert_revision : 491cac5771d8051c50ed3a5b304500400d9d8f0b
This commit is contained in:
Jacob Bramley 2010-06-28 09:37:41 +01:00
parent 3af66d7d8e
commit 61d3b0e262
11 changed files with 95 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=0 ft=C:
* vim: set ts=8 sw=4 et tw=0 ft=c:
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1

View File

@ -2263,7 +2263,13 @@ processCmdLine(int argc, char **argv, CmdLineOptions& opts)
avmplus::AvmCore::config.i386_use_cmov = avmplus::AvmCore::config.i386_sse2 = i386_sse;
avmplus::AvmCore::config.i386_fixed_esp = true;
#elif defined NANOJIT_ARM
// Note that we don't check for sensible configurations here!
// Warn about untested configurations.
if ( ((arm_arch == 5) && (arm_vfp)) || ((arm_arch >= 6) && (!arm_vfp)) ) {
char const * vfp_string = (arm_vfp) ? ("VFP") : ("no VFP");
cerr << "Warning: This configuration (ARMv" << arm_arch << ", " << vfp_string << ") " <<
"is not regularly tested." << endl;
}
avmplus::AvmCore::config.arm_arch = arm_arch;
avmplus::AvmCore::config.arm_vfp = arm_vfp;
avmplus::AvmCore::config.soft_float = !arm_vfp;

View File

@ -6,34 +6,75 @@ LIRASM=$1
TESTS_DIR=`dirname "$0"`/tests
for infile in "$TESTS_DIR"/*.in
do
outfile=`echo $infile | sed 's/\.in/\.out/'`
if [ ! -e "$outfile" ]
function runtest {
local infile=$1
local options=${2-}
# Catch a request for the random tests.
if [[ $infile == --random* ]]
then
local outfile=$TESTS_DIR/random.out
else
local outfile=`echo $infile | sed 's/\.in/\.out/'`
fi
if [[ ! -e "$outfile" ]]
then
echo "$0: error: no out file $outfile"
exit 1
fi
# Treat "random.in" and "random-opt.in" specially.
if [ `basename $infile` = "random.in" ]
if $LIRASM $options --execute $infile | tr -d '\r' > testoutput.txt && cmp -s testoutput.txt $outfile
then
infile="--random 1000000"
elif [ `basename $infile` = "random-opt.in" ]
then
infile="--random 1000000 --optimize"
fi
if $LIRASM --execute $infile | tr -d '\r' > testoutput.txt && cmp -s testoutput.txt $outfile
then
echo "TEST-PASS | lirasm | lirasm --execute $infile"
echo "TEST-PASS | lirasm | lirasm $options --execute $infile"
else
echo "TEST-UNEXPECTED-FAIL | lirasm | lirasm --execute $infile"
echo "TEST-UNEXPECTED-FAIL | lirasm | lirasm $options --execute $infile"
echo "expected output"
cat $outfile
echo "actual output"
cat testoutput.txt
fi
}
# Tests common to all supported back-ends.
for infile in "$TESTS_DIR"/*.in
do
runtest $infile
done
runtest "--random 1000000"
runtest "--random 1000000 --optimize"
# ---- Platform-specific tests and configurations. ----
# ARM
if [[ $(uname -m) == arm* ]]
then
for infile in "$TESTS_DIR"/*.in
do
# Run standard tests, but set code generation for older architectures.
# It may also be beneficial to test ARMv6 and ARMv7 with --novfp, but such
# a platform seems so unlikely that it probably isn't worthwhile. It's also
# unlikely that it's worth testing ARMv5 with VFP.
runtest $infile "--arch 6"
runtest $infile "--arch 5 --novfp"
done
# Run specific soft-float tests, but only for ARMv5 without VFP.
# NOTE: It looks like MIPS ought to be able to run these tests, but I can't
# test this and _not_ running them seems like the safest option.
for infile in "$TESTS_DIR"/softfloat/*.in
do
runtest $infile "--arch 5 --novfp"
done
# Run reduced random tests for these targets. (The default ARMv7 target
# still runs the long tests.)
runtest "--random 10000 --arch 6"
runtest "--random 10000 --arch 5 --novfp"
runtest "--random 10000 --optimize --arch 6"
runtest "--random 10000 --optimize --arch 5 --novfp"
fi
rm testoutput.txt

View File

@ -1 +0,0 @@
# dummy file, contents aren't used

View File

@ -1 +0,0 @@
# dummy file, contents aren't used

View File

@ -0,0 +1,4 @@
; IEEE-754 encodes -0.0 as 0x80000000,00000000
d = immd -0.0
hi = dhi2i d
reti hi

View File

@ -0,0 +1 @@
Output is: -2147483648

View File

@ -0,0 +1,4 @@
; IEEE-754 encodes the following constant as 0x3ff00000,ffffffff
d = immd 1.0000009536743162
lo = dlo2i d
reti lo

View File

@ -0,0 +1 @@
Output is: -1

View File

@ -0,0 +1,20 @@
; It's very difficult to test that the 'lo' part is actually doing anything
; because it tends to get lost when lirasm dumps the result to the console.
; By far the easiest way to check this is to use dlo2i and dhi2i to see if we
; get what we started with (assuming that those instructions work).
hi = immi 1127219201 ; 0x43300001 (positive, exponent of +52 ...
lo = immi -1 ; 0xffffffff (... mantissa of 0x100001ffffffff)
d = ii2d lo hi
hi2 = dhi2i d
lo2 = dlo2i d
; XOR to check for differences, then OR the two results. 0 indicates success,
; but anything else indicates some kind of loss of data.
rhi = xori hi hi2
rlo = xori lo lo2
res = ori rhi rlo
reti res