Search
lxdream.org :: lxdream/test/sh4/div0.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/div0.s
changeset 364:d738f6883d4a
author nkeynes
date Tue Sep 04 08:30:22 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add tests for CMPSTR, DIV0U, DIV0S, SHLD, and SHAD
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/sh4/div0.s Tue Sep 04 08:30:22 2007 +0000
1.3 @@ -0,0 +1,80 @@
1.4 +.section .text
1.5 +.include "sh4/inc.s"
1.6 +!
1.7 +! Test DIV0 operation
1.8 +!
1.9 +.global _test_div0
1.10 +_test_div0:
1.11 + start_test
1.12 + mov.l r11, @-r15
1.13 + mov.l r10, @-r15
1.14 +
1.15 +test_div0u:
1.16 + add #1, r12
1.17 + stc sr, r2
1.18 + mov.l test_div0_sr_mask, r0
1.19 + or r0, r2
1.20 + ldc r2, sr
1.21 +
1.22 + div0u
1.23 + stc sr, r3
1.24 + mov r3, r4
1.25 + and r0, r4
1.26 + tst r4, r4
1.27 + bf test_div0u_fail
1.28 + not r0, r0
1.29 + and r0, r3
1.30 + and r0, r2
1.31 + cmp/eq r2, r3
1.32 + bt test_div0s
1.33 +test_div0u_fail:
1.34 + fail test_div0_str_k
1.35 +
1.36 +test_div0s:
1.37 + mova test_div0s_data, r0
1.38 + mov r0, r11
1.39 + mov #4, r10
1.40 +
1.41 +test_div0s_loop:
1.42 + add #1, r12
1.43 + mov.l @r11+, r1
1.44 + mov.l @r11+, r2
1.45 + mov.l @r11+, r3
1.46 + div0s r1,r2
1.47 + stc sr, r4
1.48 + mov.l test_div0_sr_mask, r0
1.49 + and r0,r4
1.50 + cmp/eq r3,r4
1.51 + bt test_div0s_ok
1.52 + fail test_div0_str_k
1.53 +test_div0s_ok:
1.54 + dt r10
1.55 + bf test_div0s_loop
1.56 +
1.57 +test_div0_end:
1.58 + mov.l @r15+, r10
1.59 + mov.l @r15+, r11
1.60 + end_test test_div0_str_k
1.61 +
1.62 +test_div0s_data:
1.63 + .long 0x01234567
1.64 + .long 0x12345678
1.65 + .long 0x00000000
1.66 + .long 0xFFFF8912
1.67 + .long 0x7ABC1526
1.68 + .long 0x00000201
1.69 + .long 0x55443322
1.70 + .long 0x80000234
1.71 + .long 0x00000101
1.72 + .long 0xFFFFFFFF
1.73 + .long 0x9CD39495
1.74 + .long 0x00000300
1.75 +
1.76 +test_div0_sr_mask:
1.77 + .long 0x00000301
1.78 +
1.79 +test_div0_str_k:
1.80 + .long test_div0_str
1.81 +test_div0_str:
1.82 + .string "DIV0"
1.83 +
1.84 \ No newline at end of file
.