Search
lxdream.org :: lxdream :: r364:d738f6883d4a
lxdream 0.9.1
released Jun 29
Download Now
changeset364:d738f6883d4a
parent363:7d0bab24016c
child365:94cab5ad0ed8
authornkeynes
dateTue Sep 04 08:30:22 2007 +0000 (16 years ago)
Add tests for CMPSTR, DIV0U, DIV0S, SHLD, and SHAD
test/Makefile
test/sh4/cmpstr.s
test/sh4/div0.s
test/sh4/shld.s
test/sh4/testsh4.c
1.1 --- a/test/Makefile Tue Aug 28 08:47:35 2007 +0000
1.2 +++ b/test/Makefile Tue Sep 04 08:30:22 2007 +0000
1.3 @@ -73,8 +73,9 @@
1.4
1.5 testsh4: crt0.so sh4/testsh4.so timer.so interrupt.so \
1.6 sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \
1.7 - sh4/bf.so sh4/bt.so sh4/cmp.so \
1.8 + sh4/bf.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so sh4/div0.so \
1.9 sh4/float.so sh4/fmov.so sh4/ftrc.so sh4/mac.s \
1.10 + sh4/shld.so \
1.11 sh4/excslot.so sh4/undef.so
1.12 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.13 $(SH4OBJCOPY) testsh4 testsh4.bin
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/test/sh4/cmpstr.s Tue Sep 04 08:30:22 2007 +0000
2.3 @@ -0,0 +1,72 @@
2.4 +.section .text
2.5 +.include "sh4/inc.s"
2.6 +!
2.7 +! Test cmp/xx
2.8 +
2.9 +.global _test_cmpstr
2.10 +_test_cmpstr:
2.11 + start_test
2.12 + mov.l r11, @-r15
2.13 + mov.l r10, @-r15
2.14 +
2.15 +test_cmpstr_1: ! CMP/STR r2,r2
2.16 + add #1, r12
2.17 + mova test_cmpstr_str, r0
2.18 + cmp/str r0, r0
2.19 + bt test_cmpstr_2
2.20 + fail test_cmpstr_str_k
2.21 +
2.22 +test_cmpstr_2:
2.23 + mova test_cmpstr_data, r0
2.24 + mov r0, r11
2.25 + mov #6, r10
2.26 +
2.27 +test_cmpstr_2_loop:
2.28 + add #1, r12
2.29 + mov.l @r11+, r2
2.30 + mov.l @r11+, r3
2.31 + mov.l @r11+, r4
2.32 + cmp/str r2, r3
2.33 + movt r0
2.34 + cmp/eq r0, r4
2.35 + bt test_cmpstr_2_ok
2.36 + fail test_cmpstr_str_k
2.37 +test_cmpstr_2_ok:
2.38 + dt r10
2.39 + bf test_cmpstr_2_loop
2.40 +
2.41 +test_cmpstr_end:
2.42 + mov.l @r15+, r10
2.43 + mov.l @r15+, r11
2.44 + end_test test_cmpstr_str_k
2.45 +
2.46 +test_cmpstr_data:
2.47 + .long 0x81828384
2.48 + .long 0x82838485
2.49 + .long 0x00000000
2.50 +
2.51 + .long 0x01040302
2.52 + .long 0x02010304
2.53 + .long 0x00000001
2.54 +
2.55 + .long 0xAA55AA55
2.56 + .long 0x55AA55AA
2.57 + .long 0x00000000
2.58 +
2.59 + .long 0x12345678
2.60 + .long 0x12345678
2.61 + .long 0x00000001
2.62 +
2.63 + .long 0xABCD01DC
2.64 + .long 0xABCD01DD
2.65 + .long 0x00000001
2.66 +
2.67 + .long 0x12003423
2.68 + .long 0x12342300
2.69 + .long 0x00000001
2.70 +
2.71 +test_cmpstr_str_k:
2.72 + .long test_cmpstr_str
2.73 +test_cmpstr_str:
2.74 + .string "CMP/STR"
2.75 +
2.76 \ No newline at end of file
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/sh4/div0.s Tue Sep 04 08:30:22 2007 +0000
3.3 @@ -0,0 +1,80 @@
3.4 +.section .text
3.5 +.include "sh4/inc.s"
3.6 +!
3.7 +! Test DIV0 operation
3.8 +!
3.9 +.global _test_div0
3.10 +_test_div0:
3.11 + start_test
3.12 + mov.l r11, @-r15
3.13 + mov.l r10, @-r15
3.14 +
3.15 +test_div0u:
3.16 + add #1, r12
3.17 + stc sr, r2
3.18 + mov.l test_div0_sr_mask, r0
3.19 + or r0, r2
3.20 + ldc r2, sr
3.21 +
3.22 + div0u
3.23 + stc sr, r3
3.24 + mov r3, r4
3.25 + and r0, r4
3.26 + tst r4, r4
3.27 + bf test_div0u_fail
3.28 + not r0, r0
3.29 + and r0, r3
3.30 + and r0, r2
3.31 + cmp/eq r2, r3
3.32 + bt test_div0s
3.33 +test_div0u_fail:
3.34 + fail test_div0_str_k
3.35 +
3.36 +test_div0s:
3.37 + mova test_div0s_data, r0
3.38 + mov r0, r11
3.39 + mov #4, r10
3.40 +
3.41 +test_div0s_loop:
3.42 + add #1, r12
3.43 + mov.l @r11+, r1
3.44 + mov.l @r11+, r2
3.45 + mov.l @r11+, r3
3.46 + div0s r1,r2
3.47 + stc sr, r4
3.48 + mov.l test_div0_sr_mask, r0
3.49 + and r0,r4
3.50 + cmp/eq r3,r4
3.51 + bt test_div0s_ok
3.52 + fail test_div0_str_k
3.53 +test_div0s_ok:
3.54 + dt r10
3.55 + bf test_div0s_loop
3.56 +
3.57 +test_div0_end:
3.58 + mov.l @r15+, r10
3.59 + mov.l @r15+, r11
3.60 + end_test test_div0_str_k
3.61 +
3.62 +test_div0s_data:
3.63 + .long 0x01234567
3.64 + .long 0x12345678
3.65 + .long 0x00000000
3.66 + .long 0xFFFF8912
3.67 + .long 0x7ABC1526
3.68 + .long 0x00000201
3.69 + .long 0x55443322
3.70 + .long 0x80000234
3.71 + .long 0x00000101
3.72 + .long 0xFFFFFFFF
3.73 + .long 0x9CD39495
3.74 + .long 0x00000300
3.75 +
3.76 +test_div0_sr_mask:
3.77 + .long 0x00000301
3.78 +
3.79 +test_div0_str_k:
3.80 + .long test_div0_str
3.81 +test_div0_str:
3.82 + .string "DIV0"
3.83 +
3.84 \ No newline at end of file
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/test/sh4/shld.s Tue Sep 04 08:30:22 2007 +0000
4.3 @@ -0,0 +1,127 @@
4.4 +.section .text
4.5 +.include "sh4/inc.s"
4.6 +!
4.7 +! Test SHAD/SHLD operation
4.8 +!
4.9 +.global _test_shld
4.10 +_test_shld:
4.11 + start_test
4.12 + mov.l r11, @-r15
4.13 + mov.l r10, @-r15
4.14 +
4.15 +test_shld_1:
4.16 + mov #8, r11
4.17 + mova test_shld_data, r0
4.18 + mov r0, r10
4.19 +
4.20 +test_shld_1_loop1:
4.21 + add #1, r12
4.22 + mov.l @r10+, r2
4.23 + mov.l @r10+, r3
4.24 + mov.l @r10+, r4
4.25 + shld r3, r2
4.26 + cmp/eq r2, r4
4.27 + bt test_shld_1_ok
4.28 + fail test_shld_str_k
4.29 +test_shld_1_ok:
4.30 + dt r11
4.31 + bf test_shld_1_loop1
4.32 +
4.33 +test_shad_1: ! Same again, but using shad
4.34 + mov #8, r11
4.35 + mova test_shad_data, r0
4.36 + mov r0, r10
4.37 +
4.38 +test_shad_1_loop1:
4.39 + add #1, r12
4.40 + mov.l @r10+, r2
4.41 + mov.l @r10+, r3
4.42 + mov.l @r10+, r4
4.43 + shad r3, r2
4.44 + cmp/eq r2, r4
4.45 + bt test_shad_1_ok
4.46 + fail test_shld_str_k
4.47 +test_shad_1_ok:
4.48 + dt r11
4.49 + bf test_shad_1_loop1
4.50 +
4.51 +test_shld_end:
4.52 + mov.l @r15+, r10
4.53 + mov.l @r15+, r11
4.54 + end_test test_shld_str_k
4.55 +
4.56 +test_shld_data:
4.57 + .long 0x12345678
4.58 + .long 0
4.59 + .long 0x12345678
4.60 +
4.61 + .long 0xA8B9CADB
4.62 + .long 0x00000010
4.63 + .long 0xCADB0000
4.64 +
4.65 + .long 0x8A9BACBD
4.66 + .long 0xFFFFFFF0
4.67 + .long 0x00008A9B
4.68 +
4.69 + .long 0x7A9BACBD
4.70 + .long 0xFFFFFFF0
4.71 + .long 0x00007A9B
4.72 +
4.73 + .long 0x7891ACDC
4.74 + .long 0x80000000
4.75 + .long 0x00000000
4.76 +
4.77 + .long 0x8719C010
4.78 + .long 0x80000000
4.79 + .long 0x00000000
4.80 +
4.81 + .long 0x7891ACDF
4.82 + .long 0x7FFFFFFF
4.83 + .long 0x80000000
4.84 +
4.85 + .long 0x8719C01E
4.86 + .long 0x000000FF
4.87 + .long 0x00000000
4.88 +
4.89 +test_shad_data:
4.90 + .long 0x12345678
4.91 + .long 0
4.92 + .long 0x12345678
4.93 +
4.94 + .long 0xA8B9CADB
4.95 + .long 0x00000010
4.96 + .long 0xCADB0000
4.97 +
4.98 + .long 0x8A9BACBD
4.99 + .long 0xFFFFFFF0
4.100 + .long 0xFFFF8A9B
4.101 +
4.102 + .long 0x7A9BACBD
4.103 + .long 0xFFFFFFF0
4.104 + .long 0x00007A9B
4.105 +
4.106 + .long 0x7891ACDC
4.107 + .long 0x80000000
4.108 + .long 0x00000000
4.109 +
4.110 + .long 0x8719C010
4.111 + .long 0x80000000
4.112 + .long 0xFFFFFFFF
4.113 +
4.114 + .long 0x7891ACDF
4.115 + .long 0x7FFFFFFF
4.116 + .long 0x80000000
4.117 +
4.118 + .long 0x8719C01E
4.119 + .long 0x000000FF
4.120 + .long 0x00000000
4.121 +
4.122 +test_shld_data_end:
4.123 + .align 4
4.124 +test_shld_data_end_k:
4.125 + .long test_shld_data_end
4.126 +test_shld_str_k:
4.127 + .long test_shld_str
4.128 +test_shld_str:
4.129 + .string "SHLD"
4.130 +
4.131 \ No newline at end of file
5.1 --- a/test/sh4/testsh4.c Tue Aug 28 08:47:35 2007 +0000
5.2 +++ b/test/sh4/testsh4.c Tue Sep 04 08:30:22 2007 +0000
5.3 @@ -54,10 +54,13 @@
5.4 test_bf();
5.5 test_bt();
5.6 test_cmp();
5.7 + test_cmpstr();
5.8 + test_div0();
5.9 test_float();
5.10 test_fmov();
5.11 test_ftrc();
5.12 test_mac();
5.13 + test_shld();
5.14 fprintf( stdout, "--> %d/%d instruction tests passed (%d%%)\n\n",
5.15 total_tests-total_fails, total_tests,
5.16 ((total_tests-total_fails)*100)/total_tests );
.