revision 226:0eeeb25447d3
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 226:0eeeb25447d3 |
parent | 225:e5cea6125580 |
child | 227:1b98af7fc601 |
author | nkeynes |
date | Sat Sep 23 10:35:29 2006 +0000 (17 years ago) |
SH4 tests: Add tests for addc, addv, and
test/Makefile | view | annotate | diff | log | ||
test/sh4/add.s | view | annotate | diff | log | ||
test/sh4/addc.s | view | annotate | diff | log | ||
test/sh4/addv.s | view | annotate | diff | log | ||
test/sh4/and.s | view | annotate | diff | log | ||
test/sh4/andi.s | view | annotate | diff | log | ||
test/sh4/inc.s | view | annotate | diff | log | ||
test/sh4/testsh4.c | view | annotate | diff | log |
1.1 --- a/test/Makefile Wed Sep 20 09:52:32 2006 +00001.2 +++ b/test/Makefile Sat Sep 23 10:35:29 2006 +00001.3 @@ -69,9 +69,10 @@1.4 $(RUNTEST) testta < testta.data < testta2.data < testta3.data < testta4.data < testta5.data1.5 $(RUNTEST) testregs1.7 -build-tests: testmath testide testta testregs1.8 +build-tests: testsh4 testmath testide testta testregs1.10 -testsh4: crt0.so sh4/testsh4.so sh4/timer.so sh4/add.so1.11 +testsh4: crt0.so sh4/testsh4.so sh4/timer.so \1.12 + sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so1.13 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.15 testide: crt0.so testide.so ide.so
2.1 --- a/test/sh4/add.s Wed Sep 20 09:52:32 2006 +00002.2 +++ b/test/sh4/add.s Sat Sep 23 10:35:29 2006 +00002.3 @@ -1,17 +1,11 @@2.4 - .section .text2.5 +.section .text2.6 +.include "sh4/inc.s"2.7 +2.8 .global _test_add2.9 _test_add:2.10 - mov.l r14, @-r152.11 - sts.l pr, @-r152.12 - mov.l r12, @-r152.13 - mov.l r13, @-r152.14 - mov r15, r142.15 - xor r12,r122.16 - xor r13,r132.17 -# r12 is the test counter2.18 -# r13 is the failed-test counter2.19 + start_test2.21 -test_add_1: # test adding 0+0 = 02.22 +test_add_1: ! test adding 0+0 = 02.23 add #1, r122.24 xor r0,r02.25 xor r1,r12.26 @@ -19,9 +13,9 @@2.27 add r0,r12.28 cmp/eq r1, r22.29 bt test_add_22.30 - add #1, r132.31 + fail test_add_str_k2.33 -test_add_2: # test 0+ constant 1 = 12.34 +test_add_2: ! test 0+ constant 1 = 12.35 add #1, r122.36 xor r0, r02.37 xor r1, r12.38 @@ -29,7 +23,7 @@2.39 mov.l test_add_2_result, r22.40 cmp/eq r1, r22.41 bt test_add_32.42 - add #1, r132.43 + fail test_add_str_k2.44 bra test_add_32.45 nop2.47 @@ -37,7 +31,7 @@2.48 test_add_2_result:2.49 .long 0x000000012.51 -test_add_3: # test 0 + constant -1 = -12.52 +test_add_3: ! test 0 + constant -1 = -12.53 add #1, r122.54 xor r0, r02.55 xor r1, r12.56 @@ -45,7 +39,7 @@2.57 mov.l test_add_3_result, r22.58 cmp/eq r1, r22.59 bt test_add_42.60 - add #1, r132.61 + fail test_add_str_k2.62 bra test_add_42.63 nop2.65 @@ -53,7 +47,7 @@2.66 test_add_3_result:2.67 .long 0xFFFFFFFF2.69 -test_add_4: # test a+b = c w/ overflow2.70 +test_add_4: ! test a+b = c w/ overflow2.71 add #1, r122.72 mov.l test_add_4_op1, r42.73 mov.l test_add_4_op2, r52.74 @@ -61,7 +55,7 @@2.75 add r4, r52.76 cmp/eq r5, r02.77 bt test_add_52.78 - add #1, r132.79 + fail test_add_str_k2.80 bra test_add_52.81 nop2.83 @@ -73,38 +67,28 @@2.84 test_add_4_result:2.85 .long 0x399999992.87 -test_add_5: # test carry neither used nor set (ala ADDC)2.88 +test_add_5: ! test carry neither used nor set (ala ADDC)2.89 add #1, r122.90 mov.l test_add_5_op1, r82.91 mov.l test_add_5_op2, r92.92 stc sr, r102.93 xor r0,r02.94 add #1, r02.95 + stc sr, r12.96 or r0,r102.97 ldc r10, sr2.98 add r9,r82.99 mov.l test_add_5_result, r112.100 cmp/eq r11, r82.101 bt test_add_5_b2.102 - add #1, r132.103 - mov.l test_print_failure_k, r32.104 - mov r12, r52.105 - mov.l test_add_str_k, r42.106 - jsr @r32.107 - nop2.108 + fail test_add_str_k2.109 bra test_add_62.110 nop2.111 test_add_5_b:2.112 - stc sr, r12.113 and r0, r12.114 cmp/eq r0, r12.115 bt test_add_62.116 - add #1, r132.117 - mov.l test_print_failure_k, r32.118 - mov r12, r52.119 - mov.l test_add_str_k, r42.120 - jsr @r32.121 - nop2.122 + fail test_add_str_k2.123 bra test_add_62.124 nop2.126 @@ -115,31 +99,54 @@2.127 test_add_5_result:2.128 .long 0x211211102.130 -test_add_6:2.131 +test_add_6: ! test maximum negative immediate2.132 + add #1, r122.133 + xor r0,r02.134 + add #128, r02.135 + mov.l test_add_6_result, r12.136 + cmp/eq r0, r12.137 + bt test_add_72.138 + fail test_add_str_k2.139 + bra test_add_72.140 + nop2.141 +test_add_6_result:2.142 + .long 0xFFFFFF802.143 +2.144 +test_add_7: ! test maximum positive immediate2.145 + add #1, r122.146 + xor r0,r02.147 + add #127, r02.148 + mov.l test_add_7_result, r12.149 + cmp/eq r0, r12.150 + bt test_add_82.151 + fail test_add_str_k2.152 + bra test_add_82.153 + nop2.154 +test_add_7_result:2.155 + .long 0x0000007F2.156 +2.157 +test_add_8: ! Test example from manual2.158 + add #1, r122.159 + mov.l test_add_8_op1, r32.160 + add #-2, R32.161 + mov.l test_add_8_result, r12.162 + cmp/eq r3,r12.163 + bt test_add_end2.164 + fail test_add_str_k2.165 + bra test_add_end2.166 + nop2.167 +test_add_8_op1:2.168 + .long 0x000000012.169 +test_add_8_result:2.170 + .long 0xFFFFFFFF2.172 test_add_end:2.173 - mov.l test_add_str_k, r42.174 - mov r13, r52.175 - mov r12, r62.176 - mov.l test_print_result_k, r12.177 - jsr @r12.178 - mov r14, r152.179 - mov.l @r15+, r132.180 - mov.l @r15+, r122.181 - lds.l @r15+, pr2.182 - mov.l @r15+, r142.183 - rts2.184 - nop2.185 + end_test test_add_str_k2.187 - .align 22.188 test_add_str:2.189 .string "ADD"2.190 - .align 22.191 -2.192 +2.193 +.align 42.194 test_add_str_k:2.195 .long test_add_str2.196 -test_print_result_k:2.197 - .long _test_print_result2.198 -test_print_failure_k:2.199 - .long _test_print_failure2.201 \ No newline at end of file
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00003.2 +++ b/test/sh4/addc.s Sat Sep 23 10:35:29 2006 +00003.3 @@ -0,0 +1,210 @@3.4 +.section .text3.5 +.include "sh4/inc.s"3.6 +3.7 +.global _test_addc3.8 +_test_addc:3.9 + start_test3.10 +3.11 +test_addc_1: ! test adding 0+0 = 03.12 + clc3.13 + add #1, r123.14 + xor r0,r03.15 + xor r1,r13.16 + xor r2,r23.17 + addc r0,r13.18 + stc sr, r43.19 + cmp/eq r1, r23.20 + bt test_addc_1_b3.21 + fail test_addc_str_k3.22 + bra test_addc_23.23 + nop3.24 +test_addc_1_b:3.25 + ldc r4, sr3.26 + assert_t_clear test_addc_str_k3.27 +3.28 +test_addc_2: ! test 0+ constant 1 = 13.29 + add #1, r123.30 + clc3.31 + xor r0, r03.32 + xor r1, r13.33 + add #1, r03.34 + addc r0, r13.35 + stc sr, r43.36 + mov.l test_addc_2_result, r23.37 + cmp/eq r1, r23.38 + bt test_addc_2_b3.39 + fail test_addc_str_k3.40 + bra test_addc_33.41 + nop3.42 +test_addc_2_b:3.43 + ldc r4, sr3.44 + assert_t_clear test_addc_str_k3.45 + bra test_addc_33.46 + nop3.47 +3.48 + .align 43.49 +test_addc_2_result:3.50 + .long 0x000000013.51 +3.52 +test_addc_3: ! test 0 + constant -1 = -13.53 + add #1, r123.54 + clc3.55 + xor r0, r03.56 + xor r1, r13.57 + add #-1, r03.58 + addc r0, r13.59 + mov.l test_addc_3_result, r23.60 + stc sr, r33.61 + cmp/eq r1, r23.62 + bt test_addc_3_b3.63 + fail test_addc_str_k3.64 + bra test_addc_43.65 + nop3.66 +test_addc_3_b:3.67 + ldc r3, sr3.68 + assert_t_clear test_addc_str_k3.69 + bra test_addc_43.70 + nop3.71 +3.72 + .align 43.73 +test_addc_3_result:3.74 + .long 0xFFFFFFFF3.75 +3.76 +test_addc_4: ! test a+b = c w/ carry set3.77 + add #1, r123.78 + clc3.79 + mov.l test_addc_4_op1, r43.80 + mov.l test_addc_4_op2, r53.81 + mov.l test_addc_4_result, r03.82 + addc r4, r53.83 + stc sr, r13.84 + cmp/eq r5, r03.85 + bt test_addc_4_b3.86 + fail test_addc_str_k3.87 + bra test_addc_53.88 + nop3.89 +test_addc_4_b:3.90 + ldc r1, sr3.91 + assert_t_set test_addc_str_k3.92 + bra test_addc_53.93 + nop3.94 +3.95 + .align 43.96 +test_addc_4_op1:3.97 + .long 0x987654323.98 +test_addc_4_op2:3.99 + .long 0xA12345673.100 +test_addc_4_result:3.101 + .long 0x399999993.102 +3.103 +test_addc_5: ! test carry used and cleared3.104 + add #1, r123.105 + mov.l test_addc_5_op1, r83.106 + mov.l test_addc_5_op2, r93.107 + stc sr, r103.108 + xor r0,r03.109 + add #1, r03.110 + or r0,r103.111 + ldc r10, sr3.112 + addc r9,r83.113 + stc sr, r13.114 + mov.l test_addc_5_result, r113.115 + cmp/eq r11, r83.116 + bt test_addc_5_b3.117 + fail test_addc_str_k3.118 + bra test_addc_63.119 + nop3.120 +test_addc_5_b:3.121 + ldc r1, sr3.122 + assert_t_clear test_addc_str_k3.123 + bra test_addc_63.124 + nop3.125 +3.126 +test_addc_5_op1:3.127 + .long 0x111111113.128 +test_addc_5_op2:3.129 + .long 0x1000FFFF3.130 +test_addc_5_result:3.131 + .long 0x211211113.132 +3.133 +test_addc_6: ! test carry set on full rollover (ie n + 0xFFFFFFFF + carry )3.134 + add #1, r123.135 + setc3.136 + mov.l test_addc_6_op1, r53.137 + mov.l test_addc_6_op2, r63.138 + addc r5, r63.139 + stc sr, r13.140 + cmp/eq r5, r63.141 + bt test_addc_6_b3.142 + fail test_addc_str_k3.143 + bra test_addc_73.144 + nop3.145 +test_addc_6_b:3.146 + ldc r1, sr3.147 + assert_t_set test_addc_str_k3.148 + bra test_addc_73.149 + nop3.150 +3.151 +test_addc_6_op1:3.152 + .long 0x123467893.153 +test_addc_6_op2:3.154 + .long 0xFFFFFFFF3.155 +3.156 +3.157 +test_addc_7:3.158 + add #1, r123.159 + clc3.160 + mov.l test_addc_7_op1, r53.161 + mov.l test_addc_7_op2, r63.162 + addc r5, r63.163 + stc sr, r13.164 + mov.l test_addc_7_result, r23.165 + cmp/eq r2, r63.166 + bt test_addc_7_b3.167 + fail test_addc_str_k3.168 + bra test_addc_83.169 + nop3.170 +test_addc_7_b:3.171 + ldc r1, sr3.172 + assert_t_set test_addc_str_k3.173 + bra test_addc_83.174 + nop3.175 +3.176 +test_addc_7_op1:3.177 + .long 0x987654323.178 +test_addc_7_op2:3.179 + .long 0xFFFFFFFF3.180 +test_addc_7_result:3.181 + .long 0x987654313.182 +3.183 +test_addc_8:3.184 + add #1, r123.185 + setc3.186 + xor r0,r03.187 + addc r0, r03.188 + stc sr, r33.189 + mov.l test_addc_8_result, r13.190 + cmp/eq r0, r13.191 + bt test_addc_8_b3.192 + fail test_addc_str_k3.193 + bra test_addc_93.194 + nop3.195 +test_addc_8_b:3.196 + ldc r3, sr3.197 + assert_t_clear test_addc_str_k3.198 + bra test_addc_93.199 + nop3.200 +3.201 +test_addc_8_result:3.202 + .long 0x000000013.203 +3.204 +test_addc_9:3.205 +test_addc_end:3.206 + end_test test_addc_str_k3.207 +3.208 +test_addc_str:3.209 + .string "ADDC"3.210 +3.211 +.align 43.212 +test_addc_str_k:3.213 + .long test_addc_str
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/test/sh4/addv.s Sat Sep 23 10:35:29 2006 +00004.3 @@ -0,0 +1,105 @@4.4 +.section .text4.5 +.include "sh4/inc.s"4.6 +4.7 +.global _test_addv4.8 +_test_addv:4.9 + start_test4.10 + mov.l r11, @-r154.11 + mov.l test_addv_data_k, r114.12 +4.13 +test_addv_loop:4.14 + mov.l test_addv_data_end_k, r44.15 + cmp/eq r11, r44.16 + bt test_addv_end4.17 + add #1, r124.18 +4.19 + clc4.20 + mov.l @r11+, r04.21 + mov.l @r11+, r14.22 + addv r0, r14.23 + stc sr, r44.24 + mov.l @r11+, r24.25 + mov.l @r11+, r34.26 + cmp/eq r1, r24.27 + bt test_addv_b4.28 + fail test_addv_str_k4.29 + bra test_addv_loop4.30 + nop4.31 +test_addv_b:4.32 + ldc r4, sr4.33 + xor r0, r04.34 + add #1, r04.35 + and r0, r44.36 + cmp/eq r3, r44.37 + bt test_addv_loop4.38 + fail test_addv_str_k4.39 + bra test_addv_loop4.40 + nop4.41 +4.42 +test_addv_end:4.43 + end_test test_addv_str_k4.44 +4.45 + .align 44.46 +test_addv_data_k:4.47 + .long test_addv_data4.48 +test_addv_data:4.49 +test_addv_data_1:4.50 + .long 0x000000004.51 + .long 0x000000004.52 + .long 0x000000004.53 + .long 0x000000004.54 +4.55 + .long 0x7FFFFFF04.56 + .long 0x0000000F4.57 + .long 0x7FFFFFFF4.58 + .long 0x000000004.59 +4.60 + .long 0xFFFFFFF04.61 + .long 0x0000000F4.62 + .long 0xFFFFFFFF4.63 + .long 0x000000004.64 +4.65 + .long 0xFFFFFFF04.66 + .long 0xFFFFFFF04.67 + .long 0xFFFFFFE04.68 + .long 0x000000004.69 +4.70 + .long 0xFFFFFFE04.71 + .long 0x000000404.72 + .long 0x000000204.73 + .long 0x000000004.74 +4.75 + .long 0x000000324.76 + .long 0xFFFFFF804.77 + .long 0xFFFFFFB24.78 + .long 0x000000004.79 +4.80 + .long 0x7FFFFFFF4.81 + .long 0x000000014.82 + .long 0x800000004.83 + .long 0x000000014.84 +4.85 + .long 0x800000004.86 + .long 0xFFFFFFFF4.87 + .long 0x7FFFFFFF4.88 + .long 0x000000014.89 +4.90 + .long 0x987654324.91 + .long 0x987654324.92 + .long 0x30ECA8644.93 + .long 0x000000014.94 +4.95 + .long 0x432143214.96 + .long 0x432143214.97 + .long 0x864286424.98 + .long 0x000000014.99 +4.100 +test_addv_data_end:4.101 + .align 44.102 +test_addv_data_end_k:4.103 + .long test_addv_data_end4.104 +test_addv_str_k:4.105 + .long test_addv_str4.106 +test_addv_str:4.107 + .string "ADDV"4.108 +4.109 \ No newline at end of file
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00005.2 +++ b/test/sh4/and.s Sat Sep 23 10:35:29 2006 +00005.3 @@ -0,0 +1,87 @@5.4 +.section .text5.5 +.include "sh4/inc.s"5.6 +!5.7 +! Test AND Rm,Rn operation5.8 +!5.9 +.global _test_and5.10 +_test_and:5.11 + start_test5.12 + mov.l r11, @-r155.13 + mov.l test_and_data_k, r115.14 +5.15 +test_and_loop:5.16 + mov.l test_and_data_end_k, r45.17 + cmp/eq r11, r45.18 + bt test_and_end5.19 + add #1, r125.20 +5.21 + clc5.22 + mov.l @r11+, r05.23 + mov.l @r11+, r15.24 + and r0, r15.25 + stc sr, r45.26 + mov.l @r11+, r25.27 + mov.l @r11+, r35.28 + cmp/eq r1, r25.29 + bt test_and_b5.30 + fail test_and_str_k5.31 + bra test_and_loop5.32 + nop5.33 +test_and_b:5.34 + ldc r4, sr5.35 + xor r0, r05.36 + add #1, r05.37 + and r0, r45.38 + cmp/eq r3, r45.39 + bt test_and_loop5.40 + fail test_and_str_k5.41 + bra test_and_loop5.42 + nop5.43 +5.44 +test_and_end:5.45 + end_test test_and_str_k5.46 +5.47 + .align 45.48 +test_and_data_k:5.49 + .long test_and_data5.50 +test_and_data:5.51 +test_and_data_1:5.52 + .long 0xFFFFFFFF5.53 + .long 0x000000005.54 + .long 0x000000005.55 + .long 0x000000005.56 +5.57 + .long 0x555555555.58 + .long 0xAAAAAAAA5.59 + .long 0x000000005.60 + .long 0x000000005.61 +5.62 + .long 0xFFFFFFFF5.63 + .long 0xA5A5A5A55.64 + .long 0xA5A5A5A55.65 + .long 0x000000005.66 +5.67 + .long 0xFFFFFFFF5.68 + .long 0xFFFFFFFF5.69 + .long 0xFFFFFFFF5.70 + .long 0x000000005.71 +5.72 + .long 0x123456785.73 + .long 0x987654325.74 + .long 0x103454305.75 + .long 0x000000005.76 +5.77 + .long 0x00FFFFFF5.78 + .long 0x987654325.79 + .long 0x007654325.80 + .long 0x000000005.81 +5.82 +test_and_data_end:5.83 + .align 45.84 +test_and_data_end_k:5.85 + .long test_and_data_end5.86 +test_and_str_k:5.87 + .long test_and_str5.88 +test_and_str:5.89 + .string "AND"5.90 +5.91 \ No newline at end of file
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00006.2 +++ b/test/sh4/andi.s Sat Sep 23 10:35:29 2006 +00006.3 @@ -0,0 +1,85 @@6.4 +.section .text6.5 +.include "sh4/inc.s"6.6 +!6.7 +! Test AND #imm, R0 operation6.8 +! Test AND #imm, @(r0,GBR)6.9 +6.10 +.global _test_andi6.11 +_test_andi:6.12 + start_test6.13 +6.14 +test_andi_1: ! test and ff, 06.15 + add #1, r126.16 + xor r0, r06.17 + xor r1, r16.18 + and #255, r06.19 + cmp/eq r0, r16.20 + bt test_andi_26.21 + fail test_andi_str_k6.22 +6.23 +test_andi_2: ! test 0-extend6.24 + add #1, r126.25 + mov.l test_andi_2_op1, r06.26 + and #255, r06.27 + mov.l test_andi_2_result, r46.28 + cmp/eq r0, r46.29 + bt test_andi_36.30 + fail test_andi_str_k6.31 + bra test_andi_36.32 + nop6.33 +6.34 +test_andi_2_op1:6.35 + .long 0x987654326.36 +test_andi_2_result:6.37 + .long 0x000000326.38 +6.39 +test_andi_3: ! Test single-bit AND6.40 + add #1, r126.41 + mov.l test_andi_3_op1, r06.42 + and #128, r06.43 + mov.l test_andi_3_result, r36.44 + cmp/eq r0, r36.45 + bt test_andi_46.46 + fail test_andi_str_k6.47 + bra test_andi_46.48 + nop6.49 +test_andi_3_op1:6.50 + .long 0x123456AB6.51 +test_andi_3_result:6.52 + .long 0x000000806.53 +6.54 +test_andi_4: ! Test GBR version6.55 + add #1, r126.56 + stc gbr, r46.57 + mov.l test_andi_4_gbr, r06.58 + ldc r0, gbr6.59 + mov.l test_andi_4_op1, r06.60 + and.b #254, @(r0,gbr)6.61 + ldc r4, gbr6.62 + mov.l test_andi_4_output, r16.63 + mov.l test_andi_4_result, r26.64 + cmp/eq r1, r26.65 + bt test_andi_56.66 + fail test_andi_str_k6.67 + bra test_andi_56.68 + nop6.69 +test_andi_4_gbr:6.70 + .long test_andi_4_gbr6.71 +test_andi_4_op1:6.72 + .long 0x000000086.73 +test_andi_4_output:6.74 + .long 0x123456AB6.75 +test_andi_4_result:6.76 + .long 0x123456AA6.77 +6.78 +test_andi_5:6.79 +test_andi_end:6.80 + end_test test_andi_str_k6.81 +6.82 +test_andi_str:6.83 + .string "ANDi"6.84 +6.85 +.align 46.86 +test_andi_str_k:6.87 + .long test_andi_str6.88 +6.89 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00007.2 +++ b/test/sh4/inc.s Sat Sep 23 10:35:29 2006 +00007.3 @@ -0,0 +1,150 @@7.4 +.altmacro7.5 +.macro fail name7.6 +LOCAL LC17.7 +LOCAL LC27.8 + add #1, r137.9 + mov.l LC1, r37.10 + mov r12, r57.11 + mov.l \name, r47.12 + xor r6, r67.13 + jsr @r37.14 + nop7.15 + bra LC27.16 + nop7.17 +.align 47.18 +LC1:7.19 + .long _test_print_failure7.20 +LC2:7.21 +.endm7.22 +7.23 +.macro failm name msg7.24 +LOCAL LC17.25 +LOCAL LC27.26 + add #1, r137.27 + mov.l LC1, r37.28 + mov r12, r57.29 + mov.l \name, r47.30 + mov.l \msg, r67.31 + jsr @r37.32 + nop7.33 + bra LC27.34 + nop7.35 +.align 47.36 +LC1:7.37 + .long _test_print_failure7.38 +LC2:7.39 +.endm7.40 +7.41 +7.42 +.macro start_test7.43 + mov.l r14, @-r157.44 + sts.l pr, @-r157.45 + mov.l r12, @-r157.46 + mov.l r13, @-r157.47 + mov r15, r147.48 + xor r12,r127.49 + xor r13,r137.50 +! r12 is the test counter7.51 +! r13 is the failed-test counter7.52 +.endm7.53 +7.54 +.macro end_test name7.55 +LOCAL test_print_result_k7.56 + mov.l \name, r47.57 + mov r13, r57.58 + mov r12, r67.59 + mov.l test_print_result_k, r37.60 + jsr @r37.61 + nop7.62 + mov r14, r157.63 + mov.l @r15+, r137.64 + mov.l @r15+, r127.65 + lds.l @r15+, pr7.66 + mov.l @r15+, r147.67 + rts7.68 + nop7.69 +.align 47.70 +test_print_result_k:7.71 + .long _test_print_result7.72 +.endm7.73 +7.74 +7.75 +.macro assert_t_set testname7.76 +LOCAL LC17.77 +LOCAL LC27.78 +LOCAL LCM7.79 + stc sr, r17.80 + mov.l r1, @-r157.81 + xor r0, r07.82 + add #1, r07.83 + and r0, r17.84 + cmp/eq r0, r17.85 + bt LC27.86 + add #1, r137.87 + mov.l LC1, r37.88 + mov r12, r57.89 + mov.l \testname, r47.90 + mov.l LCM, r67.91 + jsr @r37.92 + nop7.93 + bra LC27.94 + nop7.95 +.align 47.96 +LC1:7.97 + .long _test_print_failure7.98 +LCM: .long assert_t_clear_message7.99 +LC2:7.100 + mov.l @r15+, r17.101 + ldc r1, sr7.102 +.endm7.103 +7.104 +.macro assert_t_clear testname7.105 +LOCAL LC17.106 +LOCAL LC27.107 +LOCAL LCM7.108 + stc sr, r17.109 + mov.l r1, @-r157.110 + xor r0, r07.111 + add #1, r07.112 + and r0, r17.113 + cmp/eq r0, r17.114 + bf LC27.115 + add #1, r137.116 + mov.l LC1, r37.117 + mov r12, r57.118 + mov.l \testname, r47.119 + mov.l LCM, r67.120 + jsr @r37.121 + nop7.122 + bra LC27.123 + nop7.124 +.align 47.125 +LC1:7.126 + .long _test_print_failure7.127 +LCM: .long assert_t_clear_message7.128 +LC2:7.129 + mov.l @r15+, r17.130 + ldc r1, sr7.131 +.endm7.132 +7.133 +! Note that yes there is a perfectly good clrt instruction, but we try to7.134 +! minimize the number of instructions we depend on here.7.135 +7.136 +.macro clc7.137 + xor r0, r07.138 + addc r0, r07.139 +.endm7.140 +.macro setc7.141 + xor r0, r07.142 + not r0, r07.143 + addc r0, r07.144 +.endm7.145 +7.146 +7.147 + .align 27.148 +assert_t_set_message:7.149 + .string "Expected T=1 but was 0"7.150 +7.151 +assert_t_clear_message:7.152 + .string "Expected T=0 but was 1"7.153 +7.154 \ No newline at end of file
8.1 --- a/test/sh4/testsh4.c Wed Sep 20 09:52:32 2006 +00008.2 +++ b/test/sh4/testsh4.c Sat Sep 23 10:35:29 2006 +00008.3 @@ -1,18 +1,34 @@8.4 #include <stdio.h>8.6 +int total_tests = 0;8.7 +int total_fails = 0;8.8 +8.9 int test_print_result( char *testname, int failed, int total )8.10 {8.11 fprintf( stderr, "%s: %d/%d tests passed\n", testname, total-failed, total );8.12 + total_tests += total;8.13 + total_fails += failed;8.14 return failed;8.15 }8.17 -void test_print_failure( char *testname, int number )8.18 +void test_print_failure( char *testname, int number, char *message )8.19 {8.20 - fprintf( stderr, "%s: Test %d failed!\n", testname, number );8.21 + if( message == NULL ) {8.22 + fprintf( stderr, "%s: Test %d failed!\n", testname, number );8.23 + } else {8.24 + fprintf( stderr, "%s: Test %d failed: %s\n", testname, number, message );8.25 + }8.26 }8.28 int main()8.29 {8.31 test_add();8.32 + test_addc();8.33 + test_addv();8.34 + test_and();8.35 + test_andi();8.36 +8.37 + fprintf( stderr, "Total: %d/%d tests passed (%d%%)\n", total_tests-total_fails,8.38 + total_tests, ((total_tests-total_fails)*100)/total_tests );8.39 }
.