Search
lxdream.org :: lxdream :: r1083:34895c8bab20
lxdream 0.9.1
released Jun 29
Download Now
changeset1083:34895c8bab20
parent1082:852fc1db460a
child1084:852412cf56e0
authornkeynes
dateWed Dec 02 10:36:49 2009 +1000 (10 years ago)
Add missing SUBV instruction to the emulation core (translation core is ok),
along with test cases. Thanks to D. Jeff Dionne for pointing this out.
src/sh4/sh4core.in
test/Makefile.in
test/sh4/subv.s
test/sh4/testsh4.c
1.1 --- a/src/sh4/sh4core.in Wed Dec 02 10:03:40 2009 +1000
1.2 +++ b/src/sh4/sh4core.in Wed Dec 02 10:36:49 2009 +1000
1.3 @@ -747,7 +747,11 @@
1.4 sh4r.r[Rn] = sh4r.r[Rn] - sh4r.r[Rm] - sh4r.t;
1.5 sh4r.t = (sh4r.r[Rn] > tmp || (sh4r.r[Rn] == tmp && sh4r.t == 1));
1.6 :}
1.7 -
1.8 +SUBV Rm, Rn {:
1.9 + tmp = sh4r.r[Rn] - sh4r.r[Rm];
1.10 + sh4r.t = ( (sh4r.r[Rn]>>31) != (sh4r.r[Rm]>>31) && ((sh4r.r[Rn]>>31) != (tmp>>31)) );
1.11 + sh4r.r[Rn] = tmp;
1.12 +:}
1.13 BRAF Rn {:
1.14 CHECKSLOTILLEGAL();
1.15 CHECKDEST( pc + 4 + sh4r.r[Rn] );
2.1 --- a/test/Makefile.in Wed Dec 02 10:03:40 2009 +1000
2.2 +++ b/test/Makefile.in Wed Dec 02 10:36:49 2009 +1000
2.3 @@ -96,7 +96,7 @@
2.4 sh4/bf.so sh4/bsr.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so \
2.5 sh4/div0.so sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so \
2.6 sh4/ldc.so sh4/mac.so \
2.7 - sh4/rot.so sh4/shl.so sh4/shld.so sh4/sub.so sh4/subc.so \
2.8 + sh4/rot.so sh4/shl.so sh4/shld.so sh4/sub.so sh4/subc.so sh4/subv.so \
2.9 sh4/trapa.so sh4/tas.so sh4/xtrct.so \
2.10 sh4/excslot.so sh4/undef.so sh4/tlb.so sh4/vmexit.so
2.11 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/sh4/subv.s Wed Dec 02 10:36:49 2009 +1000
3.3 @@ -0,0 +1,106 @@
3.4 +.section .text
3.5 +.include "sh4/inc.s"
3.6 +
3.7 +.global _test_subv
3.8 +_test_subv:
3.9 + start_test
3.10 + mov.l r11, @-r15
3.11 + mov.l test_subv_data_k, r11
3.12 +
3.13 +test_subv_loop:
3.14 + mov.l test_subv_data_end_k, r4
3.15 + cmp/eq r11, r4
3.16 + bt test_subv_end
3.17 + add #1, r12
3.18 +
3.19 + clc
3.20 + mov.l @r11+, r0
3.21 + mov.l @r11+, r1
3.22 + subv r0, r1
3.23 + stc sr, r4
3.24 + mov.l @r11+, r2
3.25 + mov.l @r11+, r3
3.26 + cmp/eq r1, r2
3.27 + bt test_subv_b
3.28 + fail test_subv_str_k
3.29 + bra test_subv_loop
3.30 + nop
3.31 +test_subv_b:
3.32 + ldc r4, sr
3.33 + xor r0, r0
3.34 + add #1, r0
3.35 + and r0, r4
3.36 + cmp/eq r3, r4
3.37 + bt test_subv_loop
3.38 + fail test_subv_str_k
3.39 + bra test_subv_loop
3.40 + nop
3.41 +
3.42 +test_subv_end:
3.43 + mov.l @r15+, r11
3.44 + end_test test_subv_str_k
3.45 +
3.46 + .align 4
3.47 +test_subv_data_k:
3.48 + .long test_subv_data
3.49 +test_subv_data:
3.50 +test_subv_data_1:
3.51 + .long 0x00000000
3.52 + .long 0x00000000
3.53 + .long 0x00000000
3.54 + .long 0x00000000
3.55 +
3.56 + .long 0x0000000F
3.57 + .long 0x7FFFFFFF
3.58 + .long 0x7FFFFFF0
3.59 + .long 0x00000000
3.60 +
3.61 + .long 0x0000000F
3.62 + .long 0xFFFFFFFF
3.63 + .long 0xFFFFFFF0
3.64 + .long 0x00000000
3.65 +
3.66 + .long 0xFFFFFFF0
3.67 + .long 0xFFFFFFE0
3.68 + .long 0xFFFFFFF0
3.69 + .long 0x00000000
3.70 +
3.71 + .long 0x00000040
3.72 + .long 0x00000020
3.73 + .long 0xFFFFFFE0
3.74 + .long 0x00000000
3.75 +
3.76 + .long 0xFFFFFF80
3.77 + .long 0xFFFFFFB2
3.78 + .long 0x00000032
3.79 + .long 0x00000000
3.80 +
3.81 + .long 0x00000001
3.82 + .long 0x80000000
3.83 + .long 0x7FFFFFFF
3.84 + .long 0x00000001
3.85 +
3.86 + .long 0xFFFFFFFF
3.87 + .long 0x7FFFFFFF
3.88 + .long 0x80000000
3.89 + .long 0x00000001
3.90 +
3.91 + .long 0x98765432
3.92 + .long 0x30ECA864
3.93 + .long 0x98765432
3.94 + .long 0x00000001
3.95 +
3.96 + .long 0x43214321
3.97 + .long 0x86428642
3.98 + .long 0x43214321
3.99 + .long 0x00000001
3.100 +
3.101 +test_subv_data_end:
3.102 + .align 4
3.103 +test_subv_data_end_k:
3.104 + .long test_subv_data_end
3.105 +test_subv_str_k:
3.106 + .long test_subv_str
3.107 +test_subv_str:
3.108 + .string "SUBV"
3.109 +
3.110 \ No newline at end of file
4.1 --- a/test/sh4/testsh4.c Wed Dec 02 10:03:40 2009 +1000
4.2 +++ b/test/sh4/testsh4.c Wed Dec 02 10:36:49 2009 +1000
4.3 @@ -14,9 +14,6 @@
4.4
4.5 void test_print_failure( char *testname, int number, char *message )
4.6 {
4.7 - fprintf( stderr, "Fail" );
4.8 - fprintf( stderr, testname );
4.9 -
4.10 if( message == NULL ) {
4.11 fprintf( stderr, "%s: Test %d failed!\n", testname, number );
4.12 } else {
4.13 @@ -95,6 +92,7 @@
4.14 test_shld();
4.15 test_sub();
4.16 test_subc();
4.17 + test_subv();
4.18 test_trapa();
4.19 test_tas();
4.20 test_xtrct();
.