Search
lxdream.org :: lxdream/test/sh4/ftrc.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/ftrc.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/ftrc.s Tue Feb 13 08:34:27 2007 +0000
1.3 @@ -0,0 +1,217 @@
1.4 + .section .text
1.5 +.include "sh4/inc.s"
1.6 +!
1.7 +! Test ftrc
1.8 +
1.9 +.global _test_ftrc
1.10 +_test_ftrc:
1.11 + start_test
1.12 +
1.13 + xor r0,r0
1.14 + lds r0, fpscr
1.15 +
1.16 +test_ftrc_1: ! Load 1.0 single precision
1.17 + add #1, r12
1.18 + mov.l test_ftrc_1_input, r0
1.19 + lds r0, fpul
1.20 + fsts fpul, fr0
1.21 + ftrc fr0, fpul
1.22 + sts fpul, r0
1.23 + mov.l test_ftrc_1_result, r1
1.24 + cmp/eq r0,r1
1.25 + bt test_ftrc_2
1.26 +test_ftrc_1_fail:
1.27 + fail test_ftrc_str_k
1.28 + bra test_ftrc_2
1.29 + nop
1.30 +
1.31 +.align 4
1.32 +test_ftrc_1_input:
1.33 + .long 0x3F800000
1.34 +test_ftrc_1_result:
1.35 + .long 0x00000001
1.36 +
1.37 +test_ftrc_2: ! Load -1.0 double precision
1.38 + add #1, r12
1.39 + setpr
1.40 + mov.l test_ftrc_2_input_a, r0
1.41 + lds r0, fpul
1.42 + fsts fpul, fr0
1.43 + mov.l test_ftrc_2_input_b, r0
1.44 + lds r0, fpul
1.45 + fsts fpul, fr1
1.46 + ftrc fr0, fpul
1.47 + sts fpul, r0
1.48 + mov.l test_ftrc_2_result, r1
1.49 + cmp/eq r0,r1
1.50 + bt test_ftrc_3
1.51 +test_ftrc_2_fail:
1.52 + fail test_ftrc_str_k
1.53 + bra test_ftrc_3
1.54 + nop
1.55 +
1.56 +test_ftrc_2_input_a:
1.57 + .long 0xBFF00000
1.58 +test_ftrc_2_input_b:
1.59 + .long 0x00000000
1.60 +test_ftrc_2_result:
1.61 + .long 0xFFFFFFFF
1.62 +
1.63 +test_ftrc_3: ! pr=0, sz=1
1.64 + add #1, r12
1.65 + clrpr
1.66 + mov.l test_ftrc_3_input, r0
1.67 + lds r0, fpul
1.68 + fsts fpul, fr0
1.69 + fschg
1.70 + ftrc fr0, fpul
1.71 + sts fpul, r0
1.72 + mov.l test_ftrc_3_result, r1
1.73 + cmp/eq r0, r1
1.74 + bt test_ftrc_4
1.75 +test_ftrc_3_fail:
1.76 + fail test_ftrc_str_k
1.77 + bra test_ftrc_4
1.78 + nop
1.79 +
1.80 +test_ftrc_3_input:
1.81 + .long 0xCE4CCCCD
1.82 +test_ftrc_3_result:
1.83 + .long 0xCCCCCCC0
1.84 +
1.85 +test_ftrc_4: ! pr=1, sz=1
1.86 + add #1, r12
1.87 + fldi0 fr0
1.88 + fldi1 fr1
1.89 + setpr
1.90 + mov.l test_ftrc_4_input_a, r0
1.91 + lds r0, fpul
1.92 + fsts fpul, fr0
1.93 + mov.l test_ftrc_4_input_b, r0
1.94 + lds r0, fpul
1.95 + fsts fpul, fr1
1.96 + ftrc fr0, fpul
1.97 + sts fpul, r0
1.98 + mov.l test_ftrc_4_result, r1
1.99 + cmp/eq r0,r1
1.100 + bt test_ftrc_5
1.101 +test_ftrc_4_fail:
1.102 + fail test_ftrc_str_k
1.103 + bra test_ftrc_5
1.104 + nop
1.105 +
1.106 +test_ftrc_4_input_a:
1.107 + .long 0x41DFFFFF
1.108 +test_ftrc_4_input_b:
1.109 + .long 0xFFC00000
1.110 +test_ftrc_4_result:
1.111 + .long 0x7FFFFFFF
1.112 +
1.113 +
1.114 +test_ftrc_5: ! test w/ max +int, sz=0, pr=0, fr=1
1.115 + add #1, r12
1.116 + xor r0,r0
1.117 + lds r0, fpscr
1.118 + fldi0 fr0
1.119 + fldi0 fr1
1.120 + frchg
1.121 + fldi0 fr0
1.122 + fldi0 fr1
1.123 + mov.l test_ftrc_5_input, r0
1.124 + lds r0, fpul
1.125 + fsts fpul, fr0
1.126 + ftrc fr0, fpul
1.127 + sts fpul, r0
1.128 + mov.l test_ftrc_5_result, r1
1.129 + cmp/eq r0, r1
1.130 + bf test_ftrc_5_fail
1.131 + flds fr1, fpul
1.132 + sts fpul, r0
1.133 + tst r0, r0
1.134 + bf test_ftrc_5_fail
1.135 + lds r0, fpscr
1.136 + flds fr0, fpul
1.137 + sts fpul, r0
1.138 + tst r0, r0
1.139 + bt test_ftrc_6
1.140 +test_ftrc_5_fail:
1.141 + fail test_ftrc_str_k
1.142 + bra test_ftrc_6
1.143 + nop
1.144 +
1.145 +test_ftrc_5_input:
1.146 + .long 0x4F000000
1.147 +test_ftrc_5_result:
1.148 + .long 0x7FFFFFFF
1.149 +
1.150 +test_ftrc_6: ! Test max -int
1.151 + add #1, r12
1.152 + mov.l test_ftrc_6_input, r0
1.153 + lds r0, fpul
1.154 + fsts fpul, fr5
1.155 + ftrc fr5, fpul
1.156 + sts fpul, r2
1.157 + mov.l test_ftrc_6_result, r1
1.158 + cmp/eq r1, r2
1.159 + bt test_ftrc_7
1.160 +
1.161 +test_ftrc_6_fail:
1.162 + fail test_ftrc_str_k
1.163 + bra test_ftrc_7
1.164 + nop
1.165 +
1.166 +test_ftrc_6_input:
1.167 + .long 0xCF000000
1.168 +test_ftrc_6_result:
1.169 + .long 0x80000000
1.170 +
1.171 +test_ftrc_7: ! Test >max +int
1.172 + add #1, r12
1.173 + mov.l test_ftrc_7_input, r0
1.174 + lds r0, fpul
1.175 + fsts fpul, fr7
1.176 + ftrc fr7, fpul
1.177 + sts fpul, r2
1.178 + mov.l test_ftrc_7_result, r1
1.179 + cmp/eq r1, r2
1.180 + bt test_ftrc_8
1.181 +test_ftrc_7_fail:
1.182 + fail test_ftrc_str_k
1.183 + bra test_ftrc_7
1.184 + nop
1.185 +
1.186 +test_ftrc_7_input:
1.187 + .long 0x7E111111
1.188 +test_ftrc_7_result:
1.189 + .long 0x7FFFFFFF
1.190 +
1.191 +test_ftrc_8: ! test < min -int
1.192 + add #1, r12
1.193 + mov.l test_ftrc_8_input, r0
1.194 + lds r0, fpul
1.195 + fsts fpul, fr9
1.196 + ftrc fr9, fpul
1.197 + sts fpul, r2
1.198 + mov.l test_ftrc_8_result, r1
1.199 + cmp/eq r1, r2
1.200 + bt test_ftrc_end
1.201 +test_ftrc_8_fail:
1.202 + fail test_ftrc_str_k
1.203 + bra test_ftrc_8
1.204 + nop
1.205 +
1.206 +test_ftrc_8_input:
1.207 + .long 0xFE111111
1.208 +test_ftrc_8_result:
1.209 + .long 0x80000000
1.210 +
1.211 +
1.212 +test_ftrc_end:
1.213 + end_test test_ftrc_str_k
1.214 +
1.215 +test_ftrc_str:
1.216 + .string "FTRC"
1.217 +
1.218 +.align 4
1.219 +test_ftrc_str_k:
1.220 + .long test_ftrc_str
.