Search
lxdream.org :: lxdream/test/sh4/float.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/float.s
changeset 357:3592a10b3242
next358:65043a8f5785
author nkeynes
date Tue Feb 13 08:34:27 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add tests for FLOAT and FTRC
Comment out user-mode exception test (broken)
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/sh4/float.s Tue Feb 13 08:34:27 2007 +0000
1.3 @@ -0,0 +1,209 @@
1.4 +.section .text
1.5 +.include "sh4/inc.s"
1.6 +!
1.7 +! Test float
1.8 +
1.9 +.global _test_float
1.10 +_test_float:
1.11 + start_test
1.12 +
1.13 + xor r0,r0
1.14 + lds r0, fpscr
1.15 +
1.16 +test_float_1: ! Load 1.0 single precision
1.17 + add #1, r12
1.18 + add #1, r0
1.19 + fldi0 fr0
1.20 + fldi0 fr1
1.21 + lds r0, fpul
1.22 + float fpul, fr0
1.23 + sts fpul, r1
1.24 + cmp/eq r0, r1
1.25 + bf test_float_1_fail
1.26 + flds fr0, fpul
1.27 + sts fpul, r0
1.28 + mov.l test_float_1_result, r1
1.29 + cmp/eq r0,r1
1.30 + bf test_float_1_fail
1.31 + flds fr1, fpul
1.32 + sts fpul, r0
1.33 + tst r0, r0
1.34 + bt test_float_2
1.35 +test_float_1_fail:
1.36 + fail test_float_str_k
1.37 + bra test_float_2
1.38 + nop
1.39 +
1.40 +.align 4
1.41 +test_float_1_result:
1.42 + .long 0x3F800000
1.43 +
1.44 +test_float_2: ! Load -1.0 double precision
1.45 + add #1, r12
1.46 + fldi0 fr0
1.47 + fldi1 fr1
1.48 + setpr
1.49 + xor r0,r0
1.50 + add #-1, r0
1.51 + lds r0, fpul
1.52 + float fpul, fr0
1.53 + sts fpul, r1
1.54 + cmp/eq r0, r1
1.55 + bf test_float_2_fail
1.56 + flds fr0, fpul
1.57 + sts fpul, r0
1.58 + flds fr1, fpul
1.59 + sts fpul, r2
1.60 + mov.l test_float_2_result_a, r1
1.61 + mov.l test_float_2_result_b, r3
1.62 + cmp/eq r0,r1
1.63 + bf test_float_2_fail
1.64 + cmp/eq r2,r3
1.65 + bt test_float_3
1.66 +test_float_2_fail:
1.67 + fail test_float_str_k
1.68 + bra test_float_3
1.69 + nop
1.70 +
1.71 +test_float_2_result_a:
1.72 + .long 0xBFF00000
1.73 +test_float_2_result_b:
1.74 + .long 0x00000000
1.75 +
1.76 +test_float_3: ! pr=0, sz=1
1.77 + add #1, r12
1.78 + clrpr
1.79 + fldi0 fr0
1.80 + fldi0 fr1
1.81 + fschg
1.82 + mov.l test_float_3_input, r0
1.83 + lds r0, fpul
1.84 + float fpul, fr0
1.85 + sts fpul, r1
1.86 + cmp/eq r0, r1
1.87 + bf test_float_3_fail
1.88 + flds fr0, fpul
1.89 + sts fpul, r0
1.90 + mov.l test_float_3_result, r1
1.91 + cmp/eq r0, r1
1.92 + bf test_float_3_fail
1.93 + flds fr1, fpul
1.94 + sts fpul, r0
1.95 + tst r0, r0
1.96 + bt test_float_4
1.97 +test_float_3_fail:
1.98 + fail test_float_str_k
1.99 + bra test_float_4
1.100 + nop
1.101 +
1.102 +test_float_3_input:
1.103 + .long 0xCCCCCCCC
1.104 +test_float_3_result:
1.105 + .long 0xCE4CCCCD
1.106 +
1.107 +test_float_4: ! pr=1, sz=1
1.108 + add #1, r12
1.109 + fldi0 fr0
1.110 + fldi1 fr1
1.111 + setpr
1.112 + mov.l test_float_4_input, r0
1.113 + lds r0, fpul
1.114 + float fpul, fr0
1.115 + sts fpul, r1
1.116 + cmp/eq r0, r1
1.117 + bf test_float_4_fail
1.118 + flds fr0, fpul
1.119 + sts fpul, r0
1.120 + flds fr1, fpul
1.121 + sts fpul, r2
1.122 + mov.l test_float_4_result_a, r1
1.123 + mov.l test_float_4_result_b, r3
1.124 + cmp/eq r0,r1
1.125 + bf test_float_4_fail
1.126 + cmp/eq r2,r3
1.127 + bt test_float_5
1.128 +test_float_4_fail:
1.129 + fail test_float_str_k
1.130 + bra test_float_5
1.131 + nop
1.132 +
1.133 +test_float_4_input:
1.134 + .long 0x7FFFFFFF
1.135 +test_float_4_result_a:
1.136 + .long 0x41DFFFFF
1.137 +test_float_4_result_b:
1.138 + .long 0xFFC00000
1.139 +
1.140 +
1.141 +test_float_5: ! test w/ max +int, sz=0, pr=0, fr=1
1.142 + add #1, r12
1.143 + xor r0,r0
1.144 + lds r0, fpscr
1.145 + fldi0 fr0
1.146 + fldi0 fr1
1.147 + frchg
1.148 + fldi0 fr0
1.149 + fldi0 fr1
1.150 + mov.l test_float_5_input, r0
1.151 + lds r0, fpul
1.152 + float fpul, fr0
1.153 + sts fpul, r1
1.154 + cmp/eq r0, r1
1.155 + bf test_float_5_fail
1.156 + flds fr0, fpul
1.157 + sts fpul, r0
1.158 + mov.l test_float_5_result, r1
1.159 + cmp/eq r0, r1
1.160 + bf test_float_5_fail
1.161 + flds fr1, fpul
1.162 + sts fpul, r0
1.163 + tst r0, r0
1.164 + bf test_float_5_fail
1.165 + lds r0, fpscr
1.166 + flds fr0, fpul
1.167 + sts fpul, r0
1.168 + tst r0, r0
1.169 + bt test_float_6
1.170 +test_float_5_fail:
1.171 + fail test_float_str_k
1.172 + bra test_float_6
1.173 + nop
1.174 +
1.175 +test_float_5_input:
1.176 + .long 0x7FFFFFFF
1.177 +test_float_5_result:
1.178 + .long 0x4F000000
1.179 +
1.180 +test_float_6: ! Test max -int
1.181 + add #1, r12
1.182 + mov.l test_float_6_input, r0
1.183 + lds r0, fpul
1.184 + float fpul, fr5
1.185 + sts fpul, r1
1.186 + cmp/eq r0, r1
1.187 + bf test_float_6_fail
1.188 + flds fr5, fpul
1.189 + sts fpul, r2
1.190 + mov.l test_float_6_result, r1
1.191 + cmp/eq r1, r2
1.192 + bt test_float_end
1.193 +
1.194 +test_float_6_fail:
1.195 + fail test_float_str_k
1.196 + bra test_float_end
1.197 + nop
1.198 +
1.199 +test_float_6_input:
1.200 + .long 0x80000000
1.201 +test_float_6_result:
1.202 + .long 0xCF000000
1.203 +
1.204 +test_float_end:
1.205 + end_test test_float_str_k
1.206 +
1.207 +test_float_str:
1.208 + .string "FLOAT"
1.209 +
1.210 +.align 4
1.211 +test_float_str_k:
1.212 + .long test_float_str
1.213 \ No newline at end of file
.