Search
lxdream.org :: lxdream/test/sh4/add.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/add.s
changeset 226:0eeeb25447d3
prev225:e5cea6125580
next231:a9e61a96a885
author nkeynes
date Sat Sep 23 10:35:29 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change SH4 tests: Add tests for addc, addv, and
file annotate diff log raw
1.1 --- a/test/sh4/add.s Wed Sep 20 09:52:32 2006 +0000
1.2 +++ b/test/sh4/add.s Sat Sep 23 10:35:29 2006 +0000
1.3 @@ -1,17 +1,11 @@
1.4 - .section .text
1.5 +.section .text
1.6 +.include "sh4/inc.s"
1.7 +
1.8 .global _test_add
1.9 _test_add:
1.10 - mov.l r14, @-r15
1.11 - sts.l pr, @-r15
1.12 - mov.l r12, @-r15
1.13 - mov.l r13, @-r15
1.14 - mov r15, r14
1.15 - xor r12,r12
1.16 - xor r13,r13
1.17 -# r12 is the test counter
1.18 -# r13 is the failed-test counter
1.19 + start_test
1.20
1.21 -test_add_1: # test adding 0+0 = 0
1.22 +test_add_1: ! test adding 0+0 = 0
1.23 add #1, r12
1.24 xor r0,r0
1.25 xor r1,r1
1.26 @@ -19,9 +13,9 @@
1.27 add r0,r1
1.28 cmp/eq r1, r2
1.29 bt test_add_2
1.30 - add #1, r13
1.31 + fail test_add_str_k
1.32
1.33 -test_add_2: # test 0+ constant 1 = 1
1.34 +test_add_2: ! test 0+ constant 1 = 1
1.35 add #1, r12
1.36 xor r0, r0
1.37 xor r1, r1
1.38 @@ -29,7 +23,7 @@
1.39 mov.l test_add_2_result, r2
1.40 cmp/eq r1, r2
1.41 bt test_add_3
1.42 - add #1, r13
1.43 + fail test_add_str_k
1.44 bra test_add_3
1.45 nop
1.46
1.47 @@ -37,7 +31,7 @@
1.48 test_add_2_result:
1.49 .long 0x00000001
1.50
1.51 -test_add_3: # test 0 + constant -1 = -1
1.52 +test_add_3: ! test 0 + constant -1 = -1
1.53 add #1, r12
1.54 xor r0, r0
1.55 xor r1, r1
1.56 @@ -45,7 +39,7 @@
1.57 mov.l test_add_3_result, r2
1.58 cmp/eq r1, r2
1.59 bt test_add_4
1.60 - add #1, r13
1.61 + fail test_add_str_k
1.62 bra test_add_4
1.63 nop
1.64
1.65 @@ -53,7 +47,7 @@
1.66 test_add_3_result:
1.67 .long 0xFFFFFFFF
1.68
1.69 -test_add_4: # test a+b = c w/ overflow
1.70 +test_add_4: ! test a+b = c w/ overflow
1.71 add #1, r12
1.72 mov.l test_add_4_op1, r4
1.73 mov.l test_add_4_op2, r5
1.74 @@ -61,7 +55,7 @@
1.75 add r4, r5
1.76 cmp/eq r5, r0
1.77 bt test_add_5
1.78 - add #1, r13
1.79 + fail test_add_str_k
1.80 bra test_add_5
1.81 nop
1.82
1.83 @@ -73,38 +67,28 @@
1.84 test_add_4_result:
1.85 .long 0x39999999
1.86
1.87 -test_add_5: # test carry neither used nor set (ala ADDC)
1.88 +test_add_5: ! test carry neither used nor set (ala ADDC)
1.89 add #1, r12
1.90 mov.l test_add_5_op1, r8
1.91 mov.l test_add_5_op2, r9
1.92 stc sr, r10
1.93 xor r0,r0
1.94 add #1, r0
1.95 + stc sr, r1
1.96 or r0,r10
1.97 ldc r10, sr
1.98 add r9,r8
1.99 mov.l test_add_5_result, r11
1.100 cmp/eq r11, r8
1.101 bt test_add_5_b
1.102 - add #1, r13
1.103 - mov.l test_print_failure_k, r3
1.104 - mov r12, r5
1.105 - mov.l test_add_str_k, r4
1.106 - jsr @r3
1.107 - nop
1.108 + fail test_add_str_k
1.109 bra test_add_6
1.110 nop
1.111 test_add_5_b:
1.112 - stc sr, r1
1.113 and r0, r1
1.114 cmp/eq r0, r1
1.115 bt test_add_6
1.116 - add #1, r13
1.117 - mov.l test_print_failure_k, r3
1.118 - mov r12, r5
1.119 - mov.l test_add_str_k, r4
1.120 - jsr @r3
1.121 - nop
1.122 + fail test_add_str_k
1.123 bra test_add_6
1.124 nop
1.125
1.126 @@ -115,31 +99,54 @@
1.127 test_add_5_result:
1.128 .long 0x21121110
1.129
1.130 -test_add_6:
1.131 +test_add_6: ! test maximum negative immediate
1.132 + add #1, r12
1.133 + xor r0,r0
1.134 + add #128, r0
1.135 + mov.l test_add_6_result, r1
1.136 + cmp/eq r0, r1
1.137 + bt test_add_7
1.138 + fail test_add_str_k
1.139 + bra test_add_7
1.140 + nop
1.141 +test_add_6_result:
1.142 + .long 0xFFFFFF80
1.143 +
1.144 +test_add_7: ! test maximum positive immediate
1.145 + add #1, r12
1.146 + xor r0,r0
1.147 + add #127, r0
1.148 + mov.l test_add_7_result, r1
1.149 + cmp/eq r0, r1
1.150 + bt test_add_8
1.151 + fail test_add_str_k
1.152 + bra test_add_8
1.153 + nop
1.154 +test_add_7_result:
1.155 + .long 0x0000007F
1.156 +
1.157 +test_add_8: ! Test example from manual
1.158 + add #1, r12
1.159 + mov.l test_add_8_op1, r3
1.160 + add #-2, R3
1.161 + mov.l test_add_8_result, r1
1.162 + cmp/eq r3,r1
1.163 + bt test_add_end
1.164 + fail test_add_str_k
1.165 + bra test_add_end
1.166 + nop
1.167 +test_add_8_op1:
1.168 + .long 0x00000001
1.169 +test_add_8_result:
1.170 + .long 0xFFFFFFFF
1.171
1.172 test_add_end:
1.173 - mov.l test_add_str_k, r4
1.174 - mov r13, r5
1.175 - mov r12, r6
1.176 - mov.l test_print_result_k, r1
1.177 - jsr @r1
1.178 - mov r14, r15
1.179 - mov.l @r15+, r13
1.180 - mov.l @r15+, r12
1.181 - lds.l @r15+, pr
1.182 - mov.l @r15+, r14
1.183 - rts
1.184 - nop
1.185 + end_test test_add_str_k
1.186
1.187 - .align 2
1.188 test_add_str:
1.189 .string "ADD"
1.190 - .align 2
1.191 -
1.192 +
1.193 +.align 4
1.194 test_add_str_k:
1.195 .long test_add_str
1.196 -test_print_result_k:
1.197 - .long _test_print_result
1.198 -test_print_failure_k:
1.199 - .long _test_print_failure
1.200
1.201 \ No newline at end of file
.