Search
lxdream.org :: lxdream/test/sh4/mac.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/mac.s
changeset 358:65043a8f5785
author nkeynes
date Thu Aug 23 12:31:31 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add tests for mac.l and mac.w
Start test cases for fmov
Update exception tests
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/sh4/mac.s Thu Aug 23 12:31:31 2007 +0000
1.3 @@ -0,0 +1,262 @@
1.4 +.section .text
1.5 +.include "sh4/inc.s"
1.6 +!
1.7 +! Test MAC Rm,Rn operation
1.8 +!
1.9 +.global _test_mac
1.10 +_test_mac:
1.11 + start_test
1.12 +
1.13 +test_macl_1: ! Basic mac.l ops.
1.14 + add #1, r12
1.15 + clrmac
1.16 + clrs
1.17 + mov.l test_macl_1_inputs_k, r0
1.18 + mov.l test_macl_1_results_k, r6
1.19 + mov r0, r1
1.20 + mac.l @r0+, @r1+
1.21 + sts macl, r2
1.22 + sts mach, r3
1.23 + mov.l @r6+, r4
1.24 + cmp/eq r2, r4
1.25 + bf test_macl_1_fail
1.26 + xor r5, r5
1.27 + cmp/eq r3, r5
1.28 + bf test_macl_1_fail
1.29 + cmp/eq r0, r1
1.30 + bf test_macl_1_fail
1.31 + mov.l test_macl_1_inputs_k, r0
1.32 + cmp/eq r0, r1
1.33 + bt test_macl_1_fail
1.34 + add #-4, r1
1.35 + cmp/eq r0, r1
1.36 + bf test_macl_1_fail
1.37 +
1.38 + mac.l @r0+, @r0+
1.39 + sts macl, r2
1.40 + sts mach, r3
1.41 + mov.l @r6+, r4
1.42 + cmp/eq r2, r4
1.43 + bf test_macl_1_fail
1.44 + xor r5, r5
1.45 + cmp/eq r3, r5
1.46 + bf test_macl_1_fail
1.47 + add #8, r1
1.48 + cmp/eq r0, r1
1.49 + bf test_macl_1_fail
1.50 +
1.51 + mac.l @r0+, @r1+
1.52 + sts macl, r2
1.53 + sts mach, r3
1.54 + mov.l @r6+, r4
1.55 + cmp/eq r2, r4
1.56 + bf test_macl_1_fail
1.57 + mov.l @r6+, r5
1.58 + cmp/eq r3, r5
1.59 + bf test_macl_1_fail
1.60 + bra test_macl_2
1.61 + nop
1.62 +test_macl_1_fail:
1.63 + fail test_mac_str_k
1.64 + bra test_macl_2
1.65 + nop
1.66 +test_macl_1_inputs_k:
1.67 + .long test_macl_1_inputs
1.68 +test_macl_1_inputs:
1.69 + .long 0x00000010
1.70 + .long 0x00000021
1.71 + .long 0xF0000002
1.72 +test_macl_1_results_k:
1.73 + .long test_macl_1_results
1.74 +test_macl_1_results:
1.75 + .long 0x00000100
1.76 + .long 0x00000310
1.77 + .long 0xC0000314
1.78 + .long 0x00FFFFFF
1.79 +
1.80 +test_macl_2: ! Test saturation
1.81 + add #1, r12
1.82 + sets
1.83 + mova test_macl_2_results, r0
1.84 + mov r0, r3
1.85 + mova test_macl_2_inputs, r0
1.86 + mac.l @r0+, @r0+
1.87 + sts macl, r1
1.88 + mov.l @r3+, r2
1.89 + cmp/eq r1, r2
1.90 + bf test_macl_2_fail
1.91 + sts mach, r1
1.92 + mov.l @r3+, r2
1.93 + cmp/eq r1, r2
1.94 + bf test_macl_2_fail
1.95 + mov r0, r1
1.96 + mova test_macl_2_inputs, r0
1.97 + add #8, r0
1.98 + cmp/eq r0, r1
1.99 + bf test_macl_2_fail
1.100 +
1.101 + mac.l @r0+, @r0+
1.102 + sts macl, r1
1.103 + mov.l @r3+, r2
1.104 + cmp/eq r1, r2
1.105 + bf test_macl_2_fail
1.106 + sts mach, r1
1.107 + mov.l @r3+, r2
1.108 + cmp/eq r1, r2
1.109 + bt test_macw_1
1.110 +
1.111 +test_macl_2_fail:
1.112 + fail test_mac_str_k
1.113 + bra test_macw_1
1.114 + nop
1.115 +test_macl_2_inputs:
1.116 + .long 0x00000000
1.117 + .long 0x00000010
1.118 + .long 0x7FFFFFDB
1.119 + .long 0x800000EC
1.120 +
1.121 +test_macl_2_results:
1.122 + .long 0xFFFFFFFF
1.123 + .long 0x00007FFF
1.124 + .long 0x00000000
1.125 + .long 0xFFFF8000
1.126 +
1.127 +test_macw_1:
1.128 + add #1, r12
1.129 + clrs
1.130 + clrmac
1.131 +
1.132 + mova test_macw_1_results, r0
1.133 + mov r0, r4
1.134 + mova test_macw_1_inputs, r0
1.135 + mov r0, r1
1.136 + mac.w @r0+, @r1+
1.137 + sts macl, r2
1.138 + mov.l @r4+, r3
1.139 + cmp/eq r2, r3
1.140 + bf test_macw_1_fail
1.141 + sts mach, r2
1.142 + tst r2,r2
1.143 + bf test_macw_1_fail
1.144 + cmp/eq r0, r1
1.145 + bf test_macw_1_fail
1.146 + mova test_macw_1_inputs, r0
1.147 + add #-2, r1
1.148 + cmp/eq r0, r1
1.149 + bf test_macw_1_fail
1.150 +
1.151 + mac.w @r0+, @r0+
1.152 + sts macl, r2
1.153 + mov.l @r4+, r3
1.154 + cmp/eq r2, r3
1.155 + bf test_macw_1_fail
1.156 + sts mach, r2
1.157 + tst r2, r2
1.158 + bf test_macw_1_fail
1.159 + add #4, r1
1.160 + cmp/eq r0, r1
1.161 + bf test_macw_1_fail
1.162 +
1.163 + add #2, r1
1.164 + mac.w @r0+, @r1+
1.165 + sts macl, r2
1.166 + mov.l @r4+, r3
1.167 + cmp/eq r2, r3
1.168 + bf test_macw_1_fail
1.169 + sts mach, r2
1.170 + tst r2, r2
1.171 + bf test_macw_1_fail
1.172 + bra test_macw_2
1.173 + nop
1.174 +
1.175 +test_macw_1_fail:
1.176 + fail test_mac_str_k
1.177 + bra test_macw_2
1.178 + nop
1.179 +test_macw_1_inputs:
1.180 + .long 0x00210014
1.181 + .long 0x0002FFFF
1.182 +test_macw_1_results:
1.183 + .long 0x00000190
1.184 + .long 0x00000424
1.185 + .long 0x00000422
1.186 +
1.187 +test_macw_2:
1.188 + add #1, r12
1.189 + sets
1.190 + clrmac
1.191 + xor r0, r0
1.192 + not r0, r0
1.193 + lds r0, mach
1.194 +
1.195 + mova test_macw_2_results, r0
1.196 + mov r0, r3
1.197 + mova test_macw_2_inputs, r0
1.198 + mov #3, r6
1.199 +test_macw_2_loop:
1.200 + mac.w @r0+, @r0+
1.201 + sts macl, r1
1.202 + mov.l @r3+, r2
1.203 + cmp/eq r1, r2
1.204 + bf test_macw_2_fail
1.205 + sts mach, r1
1.206 + mov.l @r3+, r2
1.207 + cmp/eq r1, r2
1.208 + bf test_macw_2_fail
1.209 + dt r6
1.210 + bf test_macw_2_loop
1.211 +
1.212 + clrmac
1.213 + mov #3, r6
1.214 +test_macw_2_loop_2:
1.215 + mac.w @r0+, @r0+
1.216 + sts macl, r1
1.217 + mov.l @r3+, r2
1.218 + cmp/eq r1, r2
1.219 + bf test_macw_2_fail
1.220 + sts mach, r1
1.221 + mov.l @r3+, r2
1.222 + cmp/eq r1, r2
1.223 + bf test_macw_2_fail
1.224 + dt r6
1.225 + bf test_macw_2_loop_2
1.226 + bra test_mac_end
1.227 + nop
1.228 +
1.229 +test_macw_2_fail:
1.230 + fail test_mac_str_k
1.231 + bra test_mac_end
1.232 + nop
1.233 +test_macw_2_inputs:
1.234 + .long 0x7FFE7FFF
1.235 + .long 0x7FFF7FFD
1.236 + .long 0x7FFB7FFC
1.237 + .long 0x80007FF1
1.238 + .long 0x7FF28003
1.239 + .long 0x80047FF5
1.240 +test_macw_2_results:
1.241 + .long 0x3FFE8002
1.242 + .long 0xFFFFFFFF
1.243 + .long 0x7FFC8005
1.244 + .long 0xFFFFFFFF
1.245 + .long 0x7FFFFFFF
1.246 + .long 0x00000001
1.247 + .long 0xC0078000
1.248 + .long 0x00000000
1.249 + .long 0x800FFFD6
1.250 + .long 0x00000000
1.251 + .long 0x80000000
1.252 + .long 0x00000001
1.253 +
1.254 +test_mac_end:
1.255 + end_test test_mac_str_k
1.256 +
1.257 +test_mac_data_end:
1.258 + .align 4
1.259 +test_mac_data_end_k:
1.260 + .long test_mac_data_end
1.261 +test_mac_str_k:
1.262 + .long test_mac_str
1.263 +test_mac_str:
1.264 + .string "MAC"
1.265 +
1.266 \ No newline at end of file
.