Search
lxdream.org :: lxdream :: r226:0eeeb25447d3
lxdream 0.9.1
released Jun 29
Download Now
changeset226:0eeeb25447d3
parent225:e5cea6125580
child227:1b98af7fc601
authornkeynes
dateSat Sep 23 10:35:29 2006 +0000 (14 years ago)
SH4 tests: Add tests for addc, addv, and
test/Makefile
test/sh4/add.s
test/sh4/addc.s
test/sh4/addv.s
test/sh4/and.s
test/sh4/andi.s
test/sh4/inc.s
test/sh4/testsh4.c
1.1 --- a/test/Makefile Wed Sep 20 09:52:32 2006 +0000
1.2 +++ b/test/Makefile Sat Sep 23 10:35:29 2006 +0000
1.3 @@ -69,9 +69,10 @@
1.4 $(RUNTEST) testta < testta.data < testta2.data < testta3.data < testta4.data < testta5.data
1.5 $(RUNTEST) testregs
1.6
1.7 -build-tests: testmath testide testta testregs
1.8 +build-tests: testsh4 testmath testide testta testregs
1.9
1.10 -testsh4: crt0.so sh4/testsh4.so sh4/timer.so sh4/add.so
1.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.so
1.13 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.14
1.15 testide: crt0.so testide.so ide.so
2.1 --- a/test/sh4/add.s Wed Sep 20 09:52:32 2006 +0000
2.2 +++ b/test/sh4/add.s Sat Sep 23 10:35:29 2006 +0000
2.3 @@ -1,17 +1,11 @@
2.4 - .section .text
2.5 +.section .text
2.6 +.include "sh4/inc.s"
2.7 +
2.8 .global _test_add
2.9 _test_add:
2.10 - mov.l r14, @-r15
2.11 - sts.l pr, @-r15
2.12 - mov.l r12, @-r15
2.13 - mov.l r13, @-r15
2.14 - mov r15, r14
2.15 - xor r12,r12
2.16 - xor r13,r13
2.17 -# r12 is the test counter
2.18 -# r13 is the failed-test counter
2.19 + start_test
2.20
2.21 -test_add_1: # test adding 0+0 = 0
2.22 +test_add_1: ! test adding 0+0 = 0
2.23 add #1, r12
2.24 xor r0,r0
2.25 xor r1,r1
2.26 @@ -19,9 +13,9 @@
2.27 add r0,r1
2.28 cmp/eq r1, r2
2.29 bt test_add_2
2.30 - add #1, r13
2.31 + fail test_add_str_k
2.32
2.33 -test_add_2: # test 0+ constant 1 = 1
2.34 +test_add_2: ! test 0+ constant 1 = 1
2.35 add #1, r12
2.36 xor r0, r0
2.37 xor r1, r1
2.38 @@ -29,7 +23,7 @@
2.39 mov.l test_add_2_result, r2
2.40 cmp/eq r1, r2
2.41 bt test_add_3
2.42 - add #1, r13
2.43 + fail test_add_str_k
2.44 bra test_add_3
2.45 nop
2.46
2.47 @@ -37,7 +31,7 @@
2.48 test_add_2_result:
2.49 .long 0x00000001
2.50
2.51 -test_add_3: # test 0 + constant -1 = -1
2.52 +test_add_3: ! test 0 + constant -1 = -1
2.53 add #1, r12
2.54 xor r0, r0
2.55 xor r1, r1
2.56 @@ -45,7 +39,7 @@
2.57 mov.l test_add_3_result, r2
2.58 cmp/eq r1, r2
2.59 bt test_add_4
2.60 - add #1, r13
2.61 + fail test_add_str_k
2.62 bra test_add_4
2.63 nop
2.64
2.65 @@ -53,7 +47,7 @@
2.66 test_add_3_result:
2.67 .long 0xFFFFFFFF
2.68
2.69 -test_add_4: # test a+b = c w/ overflow
2.70 +test_add_4: ! test a+b = c w/ overflow
2.71 add #1, r12
2.72 mov.l test_add_4_op1, r4
2.73 mov.l test_add_4_op2, r5
2.74 @@ -61,7 +55,7 @@
2.75 add r4, r5
2.76 cmp/eq r5, r0
2.77 bt test_add_5
2.78 - add #1, r13
2.79 + fail test_add_str_k
2.80 bra test_add_5
2.81 nop
2.82
2.83 @@ -73,38 +67,28 @@
2.84 test_add_4_result:
2.85 .long 0x39999999
2.86
2.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, r12
2.90 mov.l test_add_5_op1, r8
2.91 mov.l test_add_5_op2, r9
2.92 stc sr, r10
2.93 xor r0,r0
2.94 add #1, r0
2.95 + stc sr, r1
2.96 or r0,r10
2.97 ldc r10, sr
2.98 add r9,r8
2.99 mov.l test_add_5_result, r11
2.100 cmp/eq r11, r8
2.101 bt test_add_5_b
2.102 - add #1, r13
2.103 - mov.l test_print_failure_k, r3
2.104 - mov r12, r5
2.105 - mov.l test_add_str_k, r4
2.106 - jsr @r3
2.107 - nop
2.108 + fail test_add_str_k
2.109 bra test_add_6
2.110 nop
2.111 test_add_5_b:
2.112 - stc sr, r1
2.113 and r0, r1
2.114 cmp/eq r0, r1
2.115 bt test_add_6
2.116 - add #1, r13
2.117 - mov.l test_print_failure_k, r3
2.118 - mov r12, r5
2.119 - mov.l test_add_str_k, r4
2.120 - jsr @r3
2.121 - nop
2.122 + fail test_add_str_k
2.123 bra test_add_6
2.124 nop
2.125
2.126 @@ -115,31 +99,54 @@
2.127 test_add_5_result:
2.128 .long 0x21121110
2.129
2.130 -test_add_6:
2.131 +test_add_6: ! test maximum negative immediate
2.132 + add #1, r12
2.133 + xor r0,r0
2.134 + add #128, r0
2.135 + mov.l test_add_6_result, r1
2.136 + cmp/eq r0, r1
2.137 + bt test_add_7
2.138 + fail test_add_str_k
2.139 + bra test_add_7
2.140 + nop
2.141 +test_add_6_result:
2.142 + .long 0xFFFFFF80
2.143 +
2.144 +test_add_7: ! test maximum positive immediate
2.145 + add #1, r12
2.146 + xor r0,r0
2.147 + add #127, r0
2.148 + mov.l test_add_7_result, r1
2.149 + cmp/eq r0, r1
2.150 + bt test_add_8
2.151 + fail test_add_str_k
2.152 + bra test_add_8
2.153 + nop
2.154 +test_add_7_result:
2.155 + .long 0x0000007F
2.156 +
2.157 +test_add_8: ! Test example from manual
2.158 + add #1, r12
2.159 + mov.l test_add_8_op1, r3
2.160 + add #-2, R3
2.161 + mov.l test_add_8_result, r1
2.162 + cmp/eq r3,r1
2.163 + bt test_add_end
2.164 + fail test_add_str_k
2.165 + bra test_add_end
2.166 + nop
2.167 +test_add_8_op1:
2.168 + .long 0x00000001
2.169 +test_add_8_result:
2.170 + .long 0xFFFFFFFF
2.171
2.172 test_add_end:
2.173 - mov.l test_add_str_k, r4
2.174 - mov r13, r5
2.175 - mov r12, r6
2.176 - mov.l test_print_result_k, r1
2.177 - jsr @r1
2.178 - mov r14, r15
2.179 - mov.l @r15+, r13
2.180 - mov.l @r15+, r12
2.181 - lds.l @r15+, pr
2.182 - mov.l @r15+, r14
2.183 - rts
2.184 - nop
2.185 + end_test test_add_str_k
2.186
2.187 - .align 2
2.188 test_add_str:
2.189 .string "ADD"
2.190 - .align 2
2.191 -
2.192 +
2.193 +.align 4
2.194 test_add_str_k:
2.195 .long test_add_str
2.196 -test_print_result_k:
2.197 - .long _test_print_result
2.198 -test_print_failure_k:
2.199 - .long _test_print_failure
2.200
2.201 \ No newline at end of file
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/sh4/addc.s Sat Sep 23 10:35:29 2006 +0000
3.3 @@ -0,0 +1,210 @@
3.4 +.section .text
3.5 +.include "sh4/inc.s"
3.6 +
3.7 +.global _test_addc
3.8 +_test_addc:
3.9 + start_test
3.10 +
3.11 +test_addc_1: ! test adding 0+0 = 0
3.12 + clc
3.13 + add #1, r12
3.14 + xor r0,r0
3.15 + xor r1,r1
3.16 + xor r2,r2
3.17 + addc r0,r1
3.18 + stc sr, r4
3.19 + cmp/eq r1, r2
3.20 + bt test_addc_1_b
3.21 + fail test_addc_str_k
3.22 + bra test_addc_2
3.23 + nop
3.24 +test_addc_1_b:
3.25 + ldc r4, sr
3.26 + assert_t_clear test_addc_str_k
3.27 +
3.28 +test_addc_2: ! test 0+ constant 1 = 1
3.29 + add #1, r12
3.30 + clc
3.31 + xor r0, r0
3.32 + xor r1, r1
3.33 + add #1, r0
3.34 + addc r0, r1
3.35 + stc sr, r4
3.36 + mov.l test_addc_2_result, r2
3.37 + cmp/eq r1, r2
3.38 + bt test_addc_2_b
3.39 + fail test_addc_str_k
3.40 + bra test_addc_3
3.41 + nop
3.42 +test_addc_2_b:
3.43 + ldc r4, sr
3.44 + assert_t_clear test_addc_str_k
3.45 + bra test_addc_3
3.46 + nop
3.47 +
3.48 + .align 4
3.49 +test_addc_2_result:
3.50 + .long 0x00000001
3.51 +
3.52 +test_addc_3: ! test 0 + constant -1 = -1
3.53 + add #1, r12
3.54 + clc
3.55 + xor r0, r0
3.56 + xor r1, r1
3.57 + add #-1, r0
3.58 + addc r0, r1
3.59 + mov.l test_addc_3_result, r2
3.60 + stc sr, r3
3.61 + cmp/eq r1, r2
3.62 + bt test_addc_3_b
3.63 + fail test_addc_str_k
3.64 + bra test_addc_4
3.65 + nop
3.66 +test_addc_3_b:
3.67 + ldc r3, sr
3.68 + assert_t_clear test_addc_str_k
3.69 + bra test_addc_4
3.70 + nop
3.71 +
3.72 + .align 4
3.73 +test_addc_3_result:
3.74 + .long 0xFFFFFFFF
3.75 +
3.76 +test_addc_4: ! test a+b = c w/ carry set
3.77 + add #1, r12
3.78 + clc
3.79 + mov.l test_addc_4_op1, r4
3.80 + mov.l test_addc_4_op2, r5
3.81 + mov.l test_addc_4_result, r0
3.82 + addc r4, r5
3.83 + stc sr, r1
3.84 + cmp/eq r5, r0
3.85 + bt test_addc_4_b
3.86 + fail test_addc_str_k
3.87 + bra test_addc_5
3.88 + nop
3.89 +test_addc_4_b:
3.90 + ldc r1, sr
3.91 + assert_t_set test_addc_str_k
3.92 + bra test_addc_5
3.93 + nop
3.94 +
3.95 + .align 4
3.96 +test_addc_4_op1:
3.97 + .long 0x98765432
3.98 +test_addc_4_op2:
3.99 + .long 0xA1234567
3.100 +test_addc_4_result:
3.101 + .long 0x39999999
3.102 +
3.103 +test_addc_5: ! test carry used and cleared
3.104 + add #1, r12
3.105 + mov.l test_addc_5_op1, r8
3.106 + mov.l test_addc_5_op2, r9
3.107 + stc sr, r10
3.108 + xor r0,r0
3.109 + add #1, r0
3.110 + or r0,r10
3.111 + ldc r10, sr
3.112 + addc r9,r8
3.113 + stc sr, r1
3.114 + mov.l test_addc_5_result, r11
3.115 + cmp/eq r11, r8
3.116 + bt test_addc_5_b
3.117 + fail test_addc_str_k
3.118 + bra test_addc_6
3.119 + nop
3.120 +test_addc_5_b:
3.121 + ldc r1, sr
3.122 + assert_t_clear test_addc_str_k
3.123 + bra test_addc_6
3.124 + nop
3.125 +
3.126 +test_addc_5_op1:
3.127 + .long 0x11111111
3.128 +test_addc_5_op2:
3.129 + .long 0x1000FFFF
3.130 +test_addc_5_result:
3.131 + .long 0x21121111
3.132 +
3.133 +test_addc_6: ! test carry set on full rollover (ie n + 0xFFFFFFFF + carry )
3.134 + add #1, r12
3.135 + setc
3.136 + mov.l test_addc_6_op1, r5
3.137 + mov.l test_addc_6_op2, r6
3.138 + addc r5, r6
3.139 + stc sr, r1
3.140 + cmp/eq r5, r6
3.141 + bt test_addc_6_b
3.142 + fail test_addc_str_k
3.143 + bra test_addc_7
3.144 + nop
3.145 +test_addc_6_b:
3.146 + ldc r1, sr
3.147 + assert_t_set test_addc_str_k
3.148 + bra test_addc_7
3.149 + nop
3.150 +
3.151 +test_addc_6_op1:
3.152 + .long 0x12346789
3.153 +test_addc_6_op2:
3.154 + .long 0xFFFFFFFF
3.155 +
3.156 +
3.157 +test_addc_7:
3.158 + add #1, r12
3.159 + clc
3.160 + mov.l test_addc_7_op1, r5
3.161 + mov.l test_addc_7_op2, r6
3.162 + addc r5, r6
3.163 + stc sr, r1
3.164 + mov.l test_addc_7_result, r2
3.165 + cmp/eq r2, r6
3.166 + bt test_addc_7_b
3.167 + fail test_addc_str_k
3.168 + bra test_addc_8
3.169 + nop
3.170 +test_addc_7_b:
3.171 + ldc r1, sr
3.172 + assert_t_set test_addc_str_k
3.173 + bra test_addc_8
3.174 + nop
3.175 +
3.176 +test_addc_7_op1:
3.177 + .long 0x98765432
3.178 +test_addc_7_op2:
3.179 + .long 0xFFFFFFFF
3.180 +test_addc_7_result:
3.181 + .long 0x98765431
3.182 +
3.183 +test_addc_8:
3.184 + add #1, r12
3.185 + setc
3.186 + xor r0,r0
3.187 + addc r0, r0
3.188 + stc sr, r3
3.189 + mov.l test_addc_8_result, r1
3.190 + cmp/eq r0, r1
3.191 + bt test_addc_8_b
3.192 + fail test_addc_str_k
3.193 + bra test_addc_9
3.194 + nop
3.195 +test_addc_8_b:
3.196 + ldc r3, sr
3.197 + assert_t_clear test_addc_str_k
3.198 + bra test_addc_9
3.199 + nop
3.200 +
3.201 +test_addc_8_result:
3.202 + .long 0x00000001
3.203 +
3.204 +test_addc_9:
3.205 +test_addc_end:
3.206 + end_test test_addc_str_k
3.207 +
3.208 +test_addc_str:
3.209 + .string "ADDC"
3.210 +
3.211 +.align 4
3.212 +test_addc_str_k:
3.213 + .long test_addc_str
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/test/sh4/addv.s Sat Sep 23 10:35:29 2006 +0000
4.3 @@ -0,0 +1,105 @@
4.4 +.section .text
4.5 +.include "sh4/inc.s"
4.6 +
4.7 +.global _test_addv
4.8 +_test_addv:
4.9 + start_test
4.10 + mov.l r11, @-r15
4.11 + mov.l test_addv_data_k, r11
4.12 +
4.13 +test_addv_loop:
4.14 + mov.l test_addv_data_end_k, r4
4.15 + cmp/eq r11, r4
4.16 + bt test_addv_end
4.17 + add #1, r12
4.18 +
4.19 + clc
4.20 + mov.l @r11+, r0
4.21 + mov.l @r11+, r1
4.22 + addv r0, r1
4.23 + stc sr, r4
4.24 + mov.l @r11+, r2
4.25 + mov.l @r11+, r3
4.26 + cmp/eq r1, r2
4.27 + bt test_addv_b
4.28 + fail test_addv_str_k
4.29 + bra test_addv_loop
4.30 + nop
4.31 +test_addv_b:
4.32 + ldc r4, sr
4.33 + xor r0, r0
4.34 + add #1, r0
4.35 + and r0, r4
4.36 + cmp/eq r3, r4
4.37 + bt test_addv_loop
4.38 + fail test_addv_str_k
4.39 + bra test_addv_loop
4.40 + nop
4.41 +
4.42 +test_addv_end:
4.43 + end_test test_addv_str_k
4.44 +
4.45 + .align 4
4.46 +test_addv_data_k:
4.47 + .long test_addv_data
4.48 +test_addv_data:
4.49 +test_addv_data_1:
4.50 + .long 0x00000000
4.51 + .long 0x00000000
4.52 + .long 0x00000000
4.53 + .long 0x00000000
4.54 +
4.55 + .long 0x7FFFFFF0
4.56 + .long 0x0000000F
4.57 + .long 0x7FFFFFFF
4.58 + .long 0x00000000
4.59 +
4.60 + .long 0xFFFFFFF0
4.61 + .long 0x0000000F
4.62 + .long 0xFFFFFFFF
4.63 + .long 0x00000000
4.64 +
4.65 + .long 0xFFFFFFF0
4.66 + .long 0xFFFFFFF0
4.67 + .long 0xFFFFFFE0
4.68 + .long 0x00000000
4.69 +
4.70 + .long 0xFFFFFFE0
4.71 + .long 0x00000040
4.72 + .long 0x00000020
4.73 + .long 0x00000000
4.74 +
4.75 + .long 0x00000032
4.76 + .long 0xFFFFFF80
4.77 + .long 0xFFFFFFB2
4.78 + .long 0x00000000
4.79 +
4.80 + .long 0x7FFFFFFF
4.81 + .long 0x00000001
4.82 + .long 0x80000000
4.83 + .long 0x00000001
4.84 +
4.85 + .long 0x80000000
4.86 + .long 0xFFFFFFFF
4.87 + .long 0x7FFFFFFF
4.88 + .long 0x00000001
4.89 +
4.90 + .long 0x98765432
4.91 + .long 0x98765432
4.92 + .long 0x30ECA864
4.93 + .long 0x00000001
4.94 +
4.95 + .long 0x43214321
4.96 + .long 0x43214321
4.97 + .long 0x86428642
4.98 + .long 0x00000001
4.99 +
4.100 +test_addv_data_end:
4.101 + .align 4
4.102 +test_addv_data_end_k:
4.103 + .long test_addv_data_end
4.104 +test_addv_str_k:
4.105 + .long test_addv_str
4.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 +0000
5.2 +++ b/test/sh4/and.s Sat Sep 23 10:35:29 2006 +0000
5.3 @@ -0,0 +1,87 @@
5.4 +.section .text
5.5 +.include "sh4/inc.s"
5.6 +!
5.7 +! Test AND Rm,Rn operation
5.8 +!
5.9 +.global _test_and
5.10 +_test_and:
5.11 + start_test
5.12 + mov.l r11, @-r15
5.13 + mov.l test_and_data_k, r11
5.14 +
5.15 +test_and_loop:
5.16 + mov.l test_and_data_end_k, r4
5.17 + cmp/eq r11, r4
5.18 + bt test_and_end
5.19 + add #1, r12
5.20 +
5.21 + clc
5.22 + mov.l @r11+, r0
5.23 + mov.l @r11+, r1
5.24 + and r0, r1
5.25 + stc sr, r4
5.26 + mov.l @r11+, r2
5.27 + mov.l @r11+, r3
5.28 + cmp/eq r1, r2
5.29 + bt test_and_b
5.30 + fail test_and_str_k
5.31 + bra test_and_loop
5.32 + nop
5.33 +test_and_b:
5.34 + ldc r4, sr
5.35 + xor r0, r0
5.36 + add #1, r0
5.37 + and r0, r4
5.38 + cmp/eq r3, r4
5.39 + bt test_and_loop
5.40 + fail test_and_str_k
5.41 + bra test_and_loop
5.42 + nop
5.43 +
5.44 +test_and_end:
5.45 + end_test test_and_str_k
5.46 +
5.47 + .align 4
5.48 +test_and_data_k:
5.49 + .long test_and_data
5.50 +test_and_data:
5.51 +test_and_data_1:
5.52 + .long 0xFFFFFFFF
5.53 + .long 0x00000000
5.54 + .long 0x00000000
5.55 + .long 0x00000000
5.56 +
5.57 + .long 0x55555555
5.58 + .long 0xAAAAAAAA
5.59 + .long 0x00000000
5.60 + .long 0x00000000
5.61 +
5.62 + .long 0xFFFFFFFF
5.63 + .long 0xA5A5A5A5
5.64 + .long 0xA5A5A5A5
5.65 + .long 0x00000000
5.66 +
5.67 + .long 0xFFFFFFFF
5.68 + .long 0xFFFFFFFF
5.69 + .long 0xFFFFFFFF
5.70 + .long 0x00000000
5.71 +
5.72 + .long 0x12345678
5.73 + .long 0x98765432
5.74 + .long 0x10345430
5.75 + .long 0x00000000
5.76 +
5.77 + .long 0x00FFFFFF
5.78 + .long 0x98765432
5.79 + .long 0x00765432
5.80 + .long 0x00000000
5.81 +
5.82 +test_and_data_end:
5.83 + .align 4
5.84 +test_and_data_end_k:
5.85 + .long test_and_data_end
5.86 +test_and_str_k:
5.87 + .long test_and_str
5.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 +0000
6.2 +++ b/test/sh4/andi.s Sat Sep 23 10:35:29 2006 +0000
6.3 @@ -0,0 +1,85 @@
6.4 +.section .text
6.5 +.include "sh4/inc.s"
6.6 +!
6.7 +! Test AND #imm, R0 operation
6.8 +! Test AND #imm, @(r0,GBR)
6.9 +
6.10 +.global _test_andi
6.11 +_test_andi:
6.12 + start_test
6.13 +
6.14 +test_andi_1: ! test and ff, 0
6.15 + add #1, r12
6.16 + xor r0, r0
6.17 + xor r1, r1
6.18 + and #255, r0
6.19 + cmp/eq r0, r1
6.20 + bt test_andi_2
6.21 + fail test_andi_str_k
6.22 +
6.23 +test_andi_2: ! test 0-extend
6.24 + add #1, r12
6.25 + mov.l test_andi_2_op1, r0
6.26 + and #255, r0
6.27 + mov.l test_andi_2_result, r4
6.28 + cmp/eq r0, r4
6.29 + bt test_andi_3
6.30 + fail test_andi_str_k
6.31 + bra test_andi_3
6.32 + nop
6.33 +
6.34 +test_andi_2_op1:
6.35 + .long 0x98765432
6.36 +test_andi_2_result:
6.37 + .long 0x00000032
6.38 +
6.39 +test_andi_3: ! Test single-bit AND
6.40 + add #1, r12
6.41 + mov.l test_andi_3_op1, r0
6.42 + and #128, r0
6.43 + mov.l test_andi_3_result, r3
6.44 + cmp/eq r0, r3
6.45 + bt test_andi_4
6.46 + fail test_andi_str_k
6.47 + bra test_andi_4
6.48 + nop
6.49 +test_andi_3_op1:
6.50 + .long 0x123456AB
6.51 +test_andi_3_result:
6.52 + .long 0x00000080
6.53 +
6.54 +test_andi_4: ! Test GBR version
6.55 + add #1, r12
6.56 + stc gbr, r4
6.57 + mov.l test_andi_4_gbr, r0
6.58 + ldc r0, gbr
6.59 + mov.l test_andi_4_op1, r0
6.60 + and.b #254, @(r0,gbr)
6.61 + ldc r4, gbr
6.62 + mov.l test_andi_4_output, r1
6.63 + mov.l test_andi_4_result, r2
6.64 + cmp/eq r1, r2
6.65 + bt test_andi_5
6.66 + fail test_andi_str_k
6.67 + bra test_andi_5
6.68 + nop
6.69 +test_andi_4_gbr:
6.70 + .long test_andi_4_gbr
6.71 +test_andi_4_op1:
6.72 + .long 0x00000008
6.73 +test_andi_4_output:
6.74 + .long 0x123456AB
6.75 +test_andi_4_result:
6.76 + .long 0x123456AA
6.77 +
6.78 +test_andi_5:
6.79 +test_andi_end:
6.80 + end_test test_andi_str_k
6.81 +
6.82 +test_andi_str:
6.83 + .string "ANDi"
6.84 +
6.85 +.align 4
6.86 +test_andi_str_k:
6.87 + .long test_andi_str
6.88 +
6.89 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/test/sh4/inc.s Sat Sep 23 10:35:29 2006 +0000
7.3 @@ -0,0 +1,150 @@
7.4 +.altmacro
7.5 +.macro fail name
7.6 +LOCAL LC1
7.7 +LOCAL LC2
7.8 + add #1, r13
7.9 + mov.l LC1, r3
7.10 + mov r12, r5
7.11 + mov.l \name, r4
7.12 + xor r6, r6
7.13 + jsr @r3
7.14 + nop
7.15 + bra LC2
7.16 + nop
7.17 +.align 4
7.18 +LC1:
7.19 + .long _test_print_failure
7.20 +LC2:
7.21 +.endm
7.22 +
7.23 +.macro failm name msg
7.24 +LOCAL LC1
7.25 +LOCAL LC2
7.26 + add #1, r13
7.27 + mov.l LC1, r3
7.28 + mov r12, r5
7.29 + mov.l \name, r4
7.30 + mov.l \msg, r6
7.31 + jsr @r3
7.32 + nop
7.33 + bra LC2
7.34 + nop
7.35 +.align 4
7.36 +LC1:
7.37 + .long _test_print_failure
7.38 +LC2:
7.39 +.endm
7.40 +
7.41 +
7.42 +.macro start_test
7.43 + mov.l r14, @-r15
7.44 + sts.l pr, @-r15
7.45 + mov.l r12, @-r15
7.46 + mov.l r13, @-r15
7.47 + mov r15, r14
7.48 + xor r12,r12
7.49 + xor r13,r13
7.50 +! r12 is the test counter
7.51 +! r13 is the failed-test counter
7.52 +.endm
7.53 +
7.54 +.macro end_test name
7.55 +LOCAL test_print_result_k
7.56 + mov.l \name, r4
7.57 + mov r13, r5
7.58 + mov r12, r6
7.59 + mov.l test_print_result_k, r3
7.60 + jsr @r3
7.61 + nop
7.62 + mov r14, r15
7.63 + mov.l @r15+, r13
7.64 + mov.l @r15+, r12
7.65 + lds.l @r15+, pr
7.66 + mov.l @r15+, r14
7.67 + rts
7.68 + nop
7.69 +.align 4
7.70 +test_print_result_k:
7.71 + .long _test_print_result
7.72 +.endm
7.73 +
7.74 +
7.75 +.macro assert_t_set testname
7.76 +LOCAL LC1
7.77 +LOCAL LC2
7.78 +LOCAL LCM
7.79 + stc sr, r1
7.80 + mov.l r1, @-r15
7.81 + xor r0, r0
7.82 + add #1, r0
7.83 + and r0, r1
7.84 + cmp/eq r0, r1
7.85 + bt LC2
7.86 + add #1, r13
7.87 + mov.l LC1, r3
7.88 + mov r12, r5
7.89 + mov.l \testname, r4
7.90 + mov.l LCM, r6
7.91 + jsr @r3
7.92 + nop
7.93 + bra LC2
7.94 + nop
7.95 +.align 4
7.96 +LC1:
7.97 + .long _test_print_failure
7.98 +LCM: .long assert_t_clear_message
7.99 +LC2:
7.100 + mov.l @r15+, r1
7.101 + ldc r1, sr
7.102 +.endm
7.103 +
7.104 +.macro assert_t_clear testname
7.105 +LOCAL LC1
7.106 +LOCAL LC2
7.107 +LOCAL LCM
7.108 + stc sr, r1
7.109 + mov.l r1, @-r15
7.110 + xor r0, r0
7.111 + add #1, r0
7.112 + and r0, r1
7.113 + cmp/eq r0, r1
7.114 + bf LC2
7.115 + add #1, r13
7.116 + mov.l LC1, r3
7.117 + mov r12, r5
7.118 + mov.l \testname, r4
7.119 + mov.l LCM, r6
7.120 + jsr @r3
7.121 + nop
7.122 + bra LC2
7.123 + nop
7.124 +.align 4
7.125 +LC1:
7.126 + .long _test_print_failure
7.127 +LCM: .long assert_t_clear_message
7.128 +LC2:
7.129 + mov.l @r15+, r1
7.130 + ldc r1, sr
7.131 +.endm
7.132 +
7.133 +! Note that yes there is a perfectly good clrt instruction, but we try to
7.134 +! minimize the number of instructions we depend on here.
7.135 +
7.136 +.macro clc
7.137 + xor r0, r0
7.138 + addc r0, r0
7.139 +.endm
7.140 +.macro setc
7.141 + xor r0, r0
7.142 + not r0, r0
7.143 + addc r0, r0
7.144 +.endm
7.145 +
7.146 +
7.147 + .align 2
7.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 +0000
8.2 +++ b/test/sh4/testsh4.c Sat Sep 23 10:35:29 2006 +0000
8.3 @@ -1,18 +1,34 @@
8.4 #include <stdio.h>
8.5
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.16
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.27
8.28 int main()
8.29 {
8.30
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 }
.