Search
lxdream.org :: lxdream :: r1192:ba3df0bf2c23
lxdream 0.9.1
released Jun 29
Download Now
changeset1192:ba3df0bf2c23
parent1191:12fdf3aafcd4
child1193:dff55bdc4f46
authornkeynes
dateMon Dec 12 09:54:27 2011 +1000 (12 years ago)
FSRRA uses higher precision for intermediate results - change sqrtf to sqrt.
src/sh4/sh4core.in
test/Makefile.in
test/sh4/fsrra.s
test/sh4/testsh4.c
1.1 --- a/src/sh4/sh4core.in Fri Dec 02 18:18:04 2011 +1000
1.2 +++ b/src/sh4/sh4core.in Mon Dec 12 09:54:27 2011 +1000
1.3 @@ -1273,7 +1273,7 @@
1.4 FSRRA FRn {:
1.5 CHECKFPUEN();
1.6 if( !IS_FPU_DOUBLEPREC() ) {
1.7 - FR(FRn) = 1.0/sqrtf(FR(FRn));
1.8 + FR(FRn) = 1.0/sqrt(FR(FRn));
1.9 }
1.10 :}
1.11 FIPR FVm, FVn {:
2.1 --- a/test/Makefile.in Fri Dec 02 18:18:04 2011 +1000
2.2 +++ b/test/Makefile.in Mon Dec 12 09:54:27 2011 +1000
2.3 @@ -96,6 +96,7 @@
2.4 sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \
2.5 sh4/bf.so sh4/bsr.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so \
2.6 sh4/div0.so sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so \
2.7 + sh4/fsrra.so \
2.8 sh4/ldc.so sh4/mac.so \
2.9 sh4/rot.so sh4/shl.so sh4/shld.so sh4/sub.so sh4/subc.so sh4/subv.so \
2.10 sh4/trapa.so sh4/tas.so sh4/xtrct.so \
2.11 @@ -190,6 +191,7 @@
2.12 lib.c lib.h math.s pvr.c pvr.h rendload.c sh4/add.s sh4/addc.s \
2.13 sh4/addv.s sh4/and.s sh4/andi.s sh4/bf.s sh4/bsr.s sh4/bt.s sh4/cmp.s \
2.14 sh4/cmpstr.s sh4/div0.s sh4/div1.s sh4/excslot.s sh4/float.s sh4/fmov.s sh4/ftrc.s \
2.15 + sh4/fsrra.s \
2.16 sh4/inc.s sh4/mac.s sh4/ldc.s sh4/rot.s sh4/shl.s sh4/shld.s sh4/sub.s sh4/subc.s \
2.17 sh4/subv.s sh4/tas.s sh4/testsh4.c sh4/tlb.s sh4/vmexit.s sh4/trapa.s sh4/undef.s \
2.18 sh4/xtrct.s sh4/utlb.c sh4/utlb.h sh4/testutlb.s testdata.c testdata.h testdisp.c \
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/sh4/fsrra.s Mon Dec 12 09:54:27 2011 +1000
3.3 @@ -0,0 +1,85 @@
3.4 +.section .text
3.5 +.include "sh4/inc.s"
3.6 +
3.7 +.global _test_fsrra
3.8 +_test_fsrra:
3.9 + start_test
3.10 + mov.l r11, @-r15
3.11 + mov.l test_fsrra_data_k, r11
3.12 +
3.13 +test_fsrra_loop:
3.14 + mov.l test_fsrra_data_end_k, r4
3.15 + cmp/eq r11, r4
3.16 + bt test_fsrra_end
3.17 + add #1, r12
3.18 +
3.19 + fmov @r11+, fr5
3.20 + fsrra fr5
3.21 + flds fr5, fpul
3.22 + sts fpul, r5
3.23 + mov.l @r11+, r4
3.24 + cmp/eq r4, r5
3.25 + bt test_fsrra_loop
3.26 +
3.27 + mov.l test_fsrra_error_k, r3
3.28 + jsr @r3
3.29 + fail test_fsrra_str_k
3.30 + bra test_fsrra_loop
3.31 + nop
3.32 +
3.33 +test_fsrra_end:
3.34 + mov.l @r15+, r11
3.35 + end_test test_fsrra_str_k
3.36 +
3.37 + .align 4
3.38 +test_fsrra_data_k:
3.39 + .long test_fsrra_data
3.40 +test_fsrra_data:
3.41 +test_fsrra_data_1:
3.42 + .long 0x3F800000
3.43 + .long 0x3F800000
3.44 +
3.45 + .long 0x43214321
3.46 + .long 0x3da14613
3.47 +
3.48 + .long 0x3B0D693E
3.49 + .long 0x41ac38ca
3.50 +
3.51 + .long 0x3B5D87B7
3.52 + .long 0x41899934
3.53 +
3.54 + .long 0x41899934
3.55 + .long 0x3e76e8e3
3.56 +
3.57 +# .long 0xFFFFFFF0
3.58 +# .long 0x7fbfffff
3.59 +
3.60 + .long 0x00000040
3.61 + .long 0x633504f3
3.62 +
3.63 + .long 0xFFFFFF80
3.64 + .long 0xffffff80
3.65 +
3.66 + .long 0x00000001
3.67 + .long 0x64b504f3
3.68 +
3.69 + .long 0x98765432
3.70 + .long 0xffc00000
3.71 +
3.72 + .long 0x64b504f3
3.73 + .long 0x2cd744fd
3.74 +
3.75 + .long 0x2cd744fd
3.76 + .long 0x48c5672a
3.77 +
3.78 +test_fsrra_data_end:
3.79 + .align 4
3.80 +test_fsrra_data_end_k:
3.81 + .long test_fsrra_data_end
3.82 +test_fsrra_str_k:
3.83 + .long test_fsrra_str
3.84 +test_fsrra_error_k:
3.85 + .long _test_print_float_error
3.86 +test_fsrra_str:
3.87 + .string "FSRRA"
3.88 +
3.89 \ No newline at end of file
4.1 --- a/test/sh4/testsh4.c Fri Dec 02 18:18:04 2011 +1000
4.2 +++ b/test/sh4/testsh4.c Mon Dec 12 09:54:27 2011 +1000
4.3 @@ -4,6 +4,11 @@
4.4 int total_tests = 0;
4.5 int total_fails = 0;
4.6
4.7 +void test_print_float_error( int expect, int actual )
4.8 +{
4.9 + fprintf( stderr, "Error: expected 0x%08x but was 0x%08x\n", expect, actual );
4.10 +}
4.11 +
4.12 int test_print_result( char *testname, int failed, int total )
4.13 {
4.14 fprintf( stdout, "%s: %d/%d tests passed\n", testname, total-failed, total );
4.15 @@ -83,6 +88,7 @@
4.16 test_div0();
4.17 test_div1();
4.18 test_float();
4.19 + test_fsrra();
4.20 test_fmov();
4.21 test_ftrc();
4.22 test_ldc();
.