revision 384:c9d5c194984b
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 384:c9d5c194984b |
parent | 383:f597b73474cb |
child | 385:766eca01ef4d |
author | nkeynes |
date | Sun Sep 16 07:01:07 2007 +0000 (15 years ago) |
Add DIV1 test cases
Update comment against opcode since it looks to be validated now
Update comment against opcode since it looks to be validated now
![]() | src/sh4/sh4core.c | view | annotate | diff | log | |
![]() | src/sh4/sh4core.in | view | annotate | diff | log | |
![]() | test/Makefile | view | annotate | diff | log | |
![]() | test/sh4/div1.s | view | annotate | diff | log | |
![]() | test/sh4/testsh4.c | view | annotate | diff | log |
1.1 --- a/src/sh4/sh4core.c Sun Sep 16 06:59:47 2007 +00001.2 +++ b/src/sh4/sh4core.c Sun Sep 16 07:01:07 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: sh4core.c,v 1.45 2007-09-12 09:20:38 nkeynes Exp $1.6 + * $Id: sh4core.c,v 1.46 2007-09-16 07:01:07 nkeynes Exp $1.7 *1.8 * SH4 emulation core, and parent module for all the SH4 peripheral1.9 * modules.1.10 @@ -823,10 +823,7 @@1.11 case 0x4:1.12 { /* DIV1 Rm, Rn */1.13 uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF);1.14 - /* This is just from the sh4p manual with some1.15 - * simplifications (someone want to check it's correct? :)1.16 - * Why they couldn't just provide a real DIV instruction...1.17 - */1.18 + /* This is derived from the sh4 manual with some simplifications */1.19 uint32_t tmp0, tmp1, tmp2, dir;1.21 dir = sh4r.q ^ sh4r.m;
2.1 --- a/src/sh4/sh4core.in Sun Sep 16 06:59:47 2007 +00002.2 +++ b/src/sh4/sh4core.in Sun Sep 16 07:01:07 2007 +00002.3 @@ -1,5 +1,5 @@2.4 /**2.5 - * $Id: sh4core.in,v 1.5 2007-09-12 09:20:38 nkeynes Exp $2.6 + * $Id: sh4core.in,v 1.6 2007-09-16 07:01:07 nkeynes Exp $2.7 *2.8 * SH4 emulation core, and parent module for all the SH4 peripheral2.9 * modules.2.10 @@ -575,10 +575,7 @@2.11 sh4r.t = sh4r.q ^ sh4r.m;2.12 :}2.13 DIV1 Rm, Rn {:2.14 - /* This is just from the sh4p manual with some2.15 - * simplifications (someone want to check it's correct? :)2.16 - * Why they couldn't just provide a real DIV instruction...2.17 - */2.18 + /* This is derived from the sh4 manual with some simplifications */2.19 uint32_t tmp0, tmp1, tmp2, dir;2.21 dir = sh4r.q ^ sh4r.m;
3.1 --- a/test/Makefile Sun Sep 16 06:59:47 2007 +00003.2 +++ b/test/Makefile Sun Sep 16 07:01:07 2007 +00003.3 @@ -74,7 +74,7 @@3.4 testsh4: crt0.so sh4/testsh4.so timer.so interrupt.so \3.5 sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \3.6 sh4/bf.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so sh4/div0.so \3.7 - sh4/float.so sh4/fmov.so sh4/ftrc.so sh4/mac.s \3.8 + sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so sh4/mac.s \3.9 sh4/shld.so \3.10 sh4/excslot.so sh4/undef.so3.11 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/test/sh4/div1.s Sun Sep 16 07:01:07 2007 +00004.3 @@ -0,0 +1,137 @@4.4 +.section .text4.5 +.include "sh4/inc.s"4.6 +!4.7 +! Test DIV1 operation4.8 +!4.9 +.global _test_div14.10 +_test_div1:4.11 + start_test4.12 + mov.l r11, @-r154.13 + mov.l r10, @-r154.14 +4.15 + mova test_div1_data, r04.16 + mov r0, r114.17 + mov #12, r104.18 +test_div1_loop:4.19 + add #1, r124.20 +4.21 + mov.l @r11+, r44.22 + mov.l @r11+, r54.23 + mov.l @r11+, r64.24 +4.25 + stc sr, r24.26 + mov.l test_div1_sr_mask, r04.27 + not r0, r14.28 + and r1, r24.29 + or r6, r24.30 + ldc r2, sr4.31 + mov r4, r34.32 +4.33 + div1 r4, r54.34 +4.35 + stc sr, r24.36 + and r0, r24.37 + cmp/eq r3, r44.38 + bf test_div1_fail4.39 + mov.l @r11+, r34.40 + cmp/eq r3, r54.41 + bf test_div1_fail4.42 + mov.l @r11+, r34.43 + cmp/eq r3, r24.44 + bt test_div1_next4.45 +test_div1_fail:4.46 + fail test_div1_str_k4.47 +4.48 +test_div1_next:4.49 + dt r104.50 + bf test_div1_loop4.51 +4.52 +test_div1_end:4.53 + mov.l @r15+, r104.54 + mov.l @r15+, r114.55 + end_test test_div1_str_k4.56 +4.57 +test_div1_data:4.58 + .long 0x123456784.59 + .long 0x012341234.60 + .long 0x000000014.61 + .long 0xF0122BCF4.62 + .long 0x000001004.63 +4.64 + .long 0x112233444.65 + .long 0xF0122BCF4.66 + .long 0x000001004.67 + .long 0xF1468AE24.68 + .long 0x000001004.69 +4.70 + .long 0x201030404.71 + .long 0xF1468AE24.72 + .long 0x000001014.73 + .long 0x029D46054.74 + .long 0x000000014.75 +4.76 + .long 0x012312314.77 + .long 0x029D46054.78 + .long 0x000000004.79 + .long 0x041779D94.80 + .long 0x000000014.81 +4.82 + .long 0xF12341234.83 + .long 0x134344544.84 + .long 0x000001004.85 + .long 0x17A9C9CB4.86 + .long 0x000001004.87 +4.88 + .long 0x654321234.89 + .long 0x123123124.90 + .long 0x000001014.91 + .long 0x89A567484.92 + .long 0x000000014.93 +4.94 +! and now the m=1 cases4.95 + .long 0x123456784.96 + .long 0x012341234.97 + .long 0x000003014.98 + .long 0xF0122BCF4.99 + .long 0x000002004.100 +4.101 + .long 0x112233444.102 + .long 0xF0122BCF4.103 + .long 0x000002004.104 + .long 0xF1468AE24.105 + .long 0x000002004.106 +4.107 + .long 0x201030404.108 + .long 0xF1468AE24.109 + .long 0x000002014.110 + .long 0x029D46054.111 + .long 0x000003014.112 +4.113 + .long 0x012312314.114 + .long 0x029D46054.115 + .long 0x000003004.116 + .long 0x041779D94.117 + .long 0x000003014.118 +4.119 + .long 0xF12341234.120 + .long 0x134344544.121 + .long 0x000002004.122 + .long 0x17A9C9CB4.123 + .long 0x000002004.124 +4.125 + .long 0x654321234.126 + .long 0x123123124.127 + .long 0x000002014.128 + .long 0x89A567484.129 + .long 0x000003014.130 +4.131 +test_div1_data_end:4.132 +4.133 +test_div1_sr_mask:4.134 + .long 0x000003014.135 +4.136 +test_div1_str_k:4.137 + .long test_div1_str4.138 +test_div1_str:4.139 + .string "DIV1"4.140 +4.141 \ No newline at end of file
.