Search
lxdream.org :: lxdream :: r393:5e5335b61373
lxdream 0.9.1
released Jun 29
Download Now
changeset393:5e5335b61373
parent392:39e596b3b6dd
child394:7eb172bfeefe
authornkeynes
dateWed Sep 19 09:13:08 2007 +0000 (13 years ago)
Add tests for SUB, SUBC and XTRCT
Add rounding tests for FTRC
test/Makefile
test/sh4/ftrc.s
test/sh4/sub.s
test/sh4/subc.s
test/sh4/testsh4.c
test/sh4/xtrct.s
1.1 --- a/test/Makefile Tue Sep 18 10:48:57 2007 +0000
1.2 +++ b/test/Makefile Wed Sep 19 09:13:08 2007 +0000
1.3 @@ -75,7 +75,7 @@
1.4 sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \
1.5 sh4/bf.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so sh4/div0.so \
1.6 sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so sh4/mac.s \
1.7 - sh4/shld.so \
1.8 + sh4/shld.so sh4/sub.so sh4/subc.so sh4/xtrct.so \
1.9 sh4/excslot.so sh4/undef.so
1.10 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.11 $(SH4OBJCOPY) testsh4 testsh4.bin
2.1 --- a/test/sh4/ftrc.s Tue Sep 18 10:48:57 2007 +0000
2.2 +++ b/test/sh4/ftrc.s Wed Sep 19 09:13:08 2007 +0000
2.3 @@ -274,10 +274,10 @@
2.4 sts fpul, r1
2.5 mov.l test_ftrc_11_result, r2
2.6 cmp/eq r1, r2
2.7 - bt test_ftrc_end
2.8 + bt test_ftrc_12
2.9 test_ftrc_11_fail:
2.10 fail test_ftrc_str_k
2.11 - bra test_ftrc_end
2.12 + bra test_ftrc_12
2.13 nop
2.14 test_ftrc_11_input_a:
2.15 .long 0x40FFFF11
2.16 @@ -288,7 +288,40 @@
2.17 test_ftrc_11_result:
2.18 .long 0x00000000
2.19
2.20 +test_ftrc_12: ! single precision numeric tests (rounding)
2.21 + mov.l r11, @-r15
2.22 + mov.l r10, @-r15
2.23 + mova test_ftrc_12_data, r0
2.24 + mov r0, r10
2.25 + mov #4, r11
2.26 + clrpr
2.27 +test_ftrc_12_loop:
2.28 + add #1, r12
2.29 + fmov @r10+, fr5
2.30 + ftrc fr5, fpul
2.31 + sts fpul, r4
2.32 + mov.l @r10+, r5
2.33 + cmp/eq r4, r5
2.34 + bt test_ftrc_12_ok
2.35 + fail test_ftrc_str_k
2.36 +test_ftrc_12_ok:
2.37 + dt r11
2.38 + bf test_ftrc_12_loop
2.39 + bra test_ftrc_end
2.40 + nop
2.41 +test_ftrc_12_data:
2.42 + .long 0x449a5314
2.43 + .long 0x000004D2
2.44 + .long 0xC5A9C785
2.45 + .long 0xFFFFEAC8
2.46 + .long 0x49098291
2.47 + .long 0x00089829
2.48 + .long 0xC2DA999A
2.49 + .long 0xFFFFFF93
2.50 +
2.51 test_ftrc_end:
2.52 + mov.l @r15+, r10
2.53 + mov.l @r15+, r11
2.54 end_test test_ftrc_str_k
2.55
2.56 test_ftrc_str:
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/sh4/sub.s Wed Sep 19 09:13:08 2007 +0000
3.3 @@ -0,0 +1,119 @@
3.4 +.section .text
3.5 +.include "sh4/inc.s"
3.6 +
3.7 +.global _test_sub
3.8 +_test_sub:
3.9 + start_test
3.10 +
3.11 +test_sub_1: ! test subing 0+0 = 0
3.12 + add #1, r12
3.13 + xor r0,r0
3.14 + xor r1,r1
3.15 + xor r2,r2
3.16 + sett
3.17 + sub r0,r1
3.18 + bf test_sub_1_fail
3.19 + cmp/eq r1, r2
3.20 + bt test_sub_2
3.21 +test_sub_1_fail:
3.22 + fail test_sub_str_k
3.23 +
3.24 +test_sub_2: ! test 0+ constant 1 = 1
3.25 + add #1, r12
3.26 + xor r0, r0
3.27 + xor r1, r1
3.28 + mov.l test_sub_2_input, r0
3.29 + mov.l test_sub_2_result, r2
3.30 + clrt
3.31 + sub r0, r1
3.32 + bt test_sub_2_fail
3.33 + cmp/eq r1, r2
3.34 + bt test_sub_3
3.35 +test_sub_2_fail:
3.36 + fail test_sub_str_k
3.37 + bra test_sub_3
3.38 + nop
3.39 +
3.40 + .align 4
3.41 +test_sub_2_input:
3.42 + .long 0x00000001
3.43 +test_sub_2_result:
3.44 + .long 0xFFFFFFFF
3.45 +
3.46 +test_sub_3: ! test 0 + constant -1 = -1
3.47 + add #1, r12
3.48 + mov.l test_sub_3_input_1, r0
3.49 + mov r0, r1
3.50 + mov.l test_sub_3_input_2, r1
3.51 + sett
3.52 + sub r0, r1
3.53 + bf test_sub_3_fail
3.54 + mov.l test_sub_3_result, r2
3.55 + cmp/eq r1, r2
3.56 + bt test_sub_4
3.57 +test_sub_3_fail:
3.58 + fail test_sub_str_k
3.59 + bra test_sub_4
3.60 + nop
3.61 +
3.62 + .align 4
3.63 +test_sub_3_input_1:
3.64 + .long 0xFFFFFF84
3.65 +test_sub_3_input_2:
3.66 + .long 0x43217000
3.67 +test_sub_3_result:
3.68 + .long 0x4321707C
3.69 +
3.70 +test_sub_4: ! Test 0 result
3.71 + add #1, r12
3.72 + mov.l test_sub_4_op1, r2
3.73 + mov.l test_sub_4_op2, r1
3.74 + mov r2, r3
3.75 + sub r1, r3
3.76 + mov.l test_sub_4_result_1, r0
3.77 + cmp/eq r0, r3
3.78 + bf test_sub_4_fail
3.79 + mov r2, r3
3.80 + sub r3, r1
3.81 + mov.l test_sub_4_result_2, r2
3.82 + cmp/eq r1, r2
3.83 + bt test_sub_5
3.84 +test_sub_4_fail:
3.85 + fail test_sub_str_k
3.86 + bra test_sub_5
3.87 + nop
3.88 +test_sub_4_op1:
3.89 + .long 0x00000001
3.90 +test_sub_4_op2:
3.91 + .long 0xFFFFFFFF
3.92 +test_sub_4_result_1:
3.93 + .long 0x00000002
3.94 +test_sub_4_result_2:
3.95 + .long 0xFFFFFFFE
3.96 +
3.97 +test_sub_5:
3.98 + add #1, r12
3.99 + mov.l test_sub_5_op, r2
3.100 + sett
3.101 + sub r2, r2
3.102 + bf test_sub_5_fail
3.103 + tst r2, r2
3.104 + bt test_sub_end
3.105 +test_sub_5_fail:
3.106 + fail test_sub_str_k
3.107 + bra test_sub_end
3.108 + nop
3.109 +
3.110 +test_sub_5_op:
3.111 + .long 0xABCD1234
3.112 +
3.113 +test_sub_end:
3.114 + end_test test_sub_str_k
3.115 +
3.116 +test_sub_str:
3.117 + .string "SUB"
3.118 +
3.119 +.align 4
3.120 +test_sub_str_k:
3.121 + .long test_sub_str
3.122 +
3.123 \ No newline at end of file
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/test/sh4/subc.s Wed Sep 19 09:13:08 2007 +0000
4.3 @@ -0,0 +1,83 @@
4.4 +.section .text
4.5 +.include "sh4/inc.s"
4.6 +
4.7 +.global _test_subc
4.8 +_test_subc:
4.9 + start_test
4.10 +
4.11 +test_subc_1: ! test subing 0+0 = 0
4.12 + add #1, r12
4.13 +
4.14 + xor r3, r3
4.15 + clrt
4.16 + subc r3, r3
4.17 + bt test_subc_1_fail
4.18 + tst r3, r3
4.19 + bt test_subc_2
4.20 +test_subc_1_fail:
4.21 + fail test_subc_str_k
4.22 +
4.23 +test_subc_2: ! test subing 0+0+T = -1
4.24 + add #1, r12
4.25 +
4.26 + xor r3, r3
4.27 + sett
4.28 + subc r3, r3
4.29 + bf test_subc_2_fail
4.30 + mov.l test_subc_2_result, r2
4.31 + cmp/eq r2, r3
4.32 + bt test_subc_3
4.33 +test_subc_2_fail:
4.34 + fail test_subc_str_k
4.35 + bra test_subc_3
4.36 + nop
4.37 +test_subc_2_result:
4.38 + .long 0xFFFFFFFF
4.39 +test_subc_3:
4.40 + add #1, r12
4.41 +
4.42 + xor r3, r3
4.43 + mov.l test_subc_3_input, r2
4.44 + clrt
4.45 + subc r2, r3
4.46 + bf test_subc_3_fail
4.47 + mov.l test_subc_3_result, r1
4.48 + cmp/eq r1, r3
4.49 + bt test_subc_4
4.50 +test_subc_3_fail:
4.51 + fail test_subc_str_k
4.52 + bra test_subc_4
4.53 + nop
4.54 +test_subc_3_input:
4.55 + .long 0x00000001
4.56 +test_subc_3_result:
4.57 + .long 0xFFFFFFFF
4.58 +
4.59 +test_subc_4:
4.60 + add #1, r12
4.61 +
4.62 + xor r3, r3
4.63 + mov.l test_subc_4_input, r2
4.64 + sett
4.65 + subc r3, r2
4.66 + bt test_subc_4_fail
4.67 + tst r2, r2
4.68 + bt test_subc_5
4.69 +test_subc_4_fail:
4.70 + fail test_subc_str_k
4.71 + bra test_subc_5
4.72 + nop
4.73 +test_subc_4_input:
4.74 + .long 0x00000001
4.75 +
4.76 +test_subc_5:
4.77 +test_subc_end:
4.78 + end_test test_subc_str_k
4.79 +
4.80 +test_subc_str:
4.81 + .string "SUBC"
4.82 +
4.83 +.align 4
4.84 +test_subc_str_k:
4.85 + .long test_subc_str
4.86 +
4.87 \ No newline at end of file
5.1 --- a/test/sh4/testsh4.c Tue Sep 18 10:48:57 2007 +0000
5.2 +++ b/test/sh4/testsh4.c Wed Sep 19 09:13:08 2007 +0000
5.3 @@ -62,6 +62,9 @@
5.4 test_ftrc();
5.5 test_mac();
5.6 test_shld();
5.7 + test_sub();
5.8 + test_subc();
5.9 + test_xtrct();
5.10 fprintf( stdout, "--> %d/%d instruction tests passed (%d%%)\n\n",
5.11 total_tests-total_fails, total_tests,
5.12 ((total_tests-total_fails)*100)/total_tests );
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/test/sh4/xtrct.s Wed Sep 19 09:13:08 2007 +0000
6.3 @@ -0,0 +1,60 @@
6.4 +.section .text
6.5 +.include "sh4/inc.s"
6.6 +
6.7 +.global _test_xtrct
6.8 +_test_xtrct:
6.9 + start_test
6.10 +
6.11 +test_xtrct_1:
6.12 + add #1, r12
6.13 +
6.14 + mov.l test_xtrct_1_input_1, r3
6.15 + mov.l test_xtrct_1_input_2, r4
6.16 + mov r4, r5
6.17 + xtrct r3, r4
6.18 + xtrct r5, r3
6.19 + mov.l test_xtrct_1_result_1, r0
6.20 + mov.l test_xtrct_1_result_2, r1
6.21 + cmp/eq r0, r4
6.22 + bf test_xtrct_1_fail
6.23 + cmp/eq r1, r3
6.24 + bt test_xtrct_2
6.25 +test_xtrct_1_fail:
6.26 + fail test_xtrct_str_k
6.27 + bra test_xtrct_2
6.28 + nop
6.29 +test_xtrct_1_input_1:
6.30 + .long 0x12345678
6.31 +test_xtrct_1_input_2:
6.32 + .long 0x9ABCDEF0
6.33 +test_xtrct_1_result_1:
6.34 + .long 0x56789ABC
6.35 +test_xtrct_1_result_2:
6.36 + .long 0xDEF01234
6.37 +
6.38 +test_xtrct_2:
6.39 + add #1, r12
6.40 +
6.41 + mov.l test_xtrct_2_input, r3
6.42 + xtrct r3, r3
6.43 + mov.l test_xtrct_2_result, r4
6.44 + cmp/eq r3, r3
6.45 + bt test_xtrct_end
6.46 + fail test_xtrct_str_k
6.47 + bra test_xtrct_end
6.48 + nop
6.49 +test_xtrct_2_input:
6.50 + .long 0x2143546A
6.51 +test_xtrct_2_result:
6.52 + .long 0x546A2143
6.53 +
6.54 +test_xtrct_end:
6.55 + end_test test_xtrct_str_k
6.56 +
6.57 +test_xtrct_str:
6.58 + .string "XTRCT"
6.59 +
6.60 +.align 4
6.61 +test_xtrct_str_k:
6.62 + .long test_xtrct_str
6.63 +
6.64 \ No newline at end of file
.