Search
lxdream.org :: lxdream/test/sh4/inc.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/inc.s
changeset 226:0eeeb25447d3
next228:70adc8ffa8d1
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/sh4/inc.s Sat Sep 23 10:35:29 2006 +0000
1.3 @@ -0,0 +1,150 @@
1.4 +.altmacro
1.5 +.macro fail name
1.6 +LOCAL LC1
1.7 +LOCAL LC2
1.8 + add #1, r13
1.9 + mov.l LC1, r3
1.10 + mov r12, r5
1.11 + mov.l \name, r4
1.12 + xor r6, r6
1.13 + jsr @r3
1.14 + nop
1.15 + bra LC2
1.16 + nop
1.17 +.align 4
1.18 +LC1:
1.19 + .long _test_print_failure
1.20 +LC2:
1.21 +.endm
1.22 +
1.23 +.macro failm name msg
1.24 +LOCAL LC1
1.25 +LOCAL LC2
1.26 + add #1, r13
1.27 + mov.l LC1, r3
1.28 + mov r12, r5
1.29 + mov.l \name, r4
1.30 + mov.l \msg, r6
1.31 + jsr @r3
1.32 + nop
1.33 + bra LC2
1.34 + nop
1.35 +.align 4
1.36 +LC1:
1.37 + .long _test_print_failure
1.38 +LC2:
1.39 +.endm
1.40 +
1.41 +
1.42 +.macro start_test
1.43 + mov.l r14, @-r15
1.44 + sts.l pr, @-r15
1.45 + mov.l r12, @-r15
1.46 + mov.l r13, @-r15
1.47 + mov r15, r14
1.48 + xor r12,r12
1.49 + xor r13,r13
1.50 +! r12 is the test counter
1.51 +! r13 is the failed-test counter
1.52 +.endm
1.53 +
1.54 +.macro end_test name
1.55 +LOCAL test_print_result_k
1.56 + mov.l \name, r4
1.57 + mov r13, r5
1.58 + mov r12, r6
1.59 + mov.l test_print_result_k, r3
1.60 + jsr @r3
1.61 + nop
1.62 + mov r14, r15
1.63 + mov.l @r15+, r13
1.64 + mov.l @r15+, r12
1.65 + lds.l @r15+, pr
1.66 + mov.l @r15+, r14
1.67 + rts
1.68 + nop
1.69 +.align 4
1.70 +test_print_result_k:
1.71 + .long _test_print_result
1.72 +.endm
1.73 +
1.74 +
1.75 +.macro assert_t_set testname
1.76 +LOCAL LC1
1.77 +LOCAL LC2
1.78 +LOCAL LCM
1.79 + stc sr, r1
1.80 + mov.l r1, @-r15
1.81 + xor r0, r0
1.82 + add #1, r0
1.83 + and r0, r1
1.84 + cmp/eq r0, r1
1.85 + bt LC2
1.86 + add #1, r13
1.87 + mov.l LC1, r3
1.88 + mov r12, r5
1.89 + mov.l \testname, r4
1.90 + mov.l LCM, r6
1.91 + jsr @r3
1.92 + nop
1.93 + bra LC2
1.94 + nop
1.95 +.align 4
1.96 +LC1:
1.97 + .long _test_print_failure
1.98 +LCM: .long assert_t_clear_message
1.99 +LC2:
1.100 + mov.l @r15+, r1
1.101 + ldc r1, sr
1.102 +.endm
1.103 +
1.104 +.macro assert_t_clear testname
1.105 +LOCAL LC1
1.106 +LOCAL LC2
1.107 +LOCAL LCM
1.108 + stc sr, r1
1.109 + mov.l r1, @-r15
1.110 + xor r0, r0
1.111 + add #1, r0
1.112 + and r0, r1
1.113 + cmp/eq r0, r1
1.114 + bf LC2
1.115 + add #1, r13
1.116 + mov.l LC1, r3
1.117 + mov r12, r5
1.118 + mov.l \testname, r4
1.119 + mov.l LCM, r6
1.120 + jsr @r3
1.121 + nop
1.122 + bra LC2
1.123 + nop
1.124 +.align 4
1.125 +LC1:
1.126 + .long _test_print_failure
1.127 +LCM: .long assert_t_clear_message
1.128 +LC2:
1.129 + mov.l @r15+, r1
1.130 + ldc r1, sr
1.131 +.endm
1.132 +
1.133 +! Note that yes there is a perfectly good clrt instruction, but we try to
1.134 +! minimize the number of instructions we depend on here.
1.135 +
1.136 +.macro clc
1.137 + xor r0, r0
1.138 + addc r0, r0
1.139 +.endm
1.140 +.macro setc
1.141 + xor r0, r0
1.142 + not r0, r0
1.143 + addc r0, r0
1.144 +.endm
1.145 +
1.146 +
1.147 + .align 2
1.148 +assert_t_set_message:
1.149 + .string "Expected T=1 but was 0"
1.150 +
1.151 +assert_t_clear_message:
1.152 + .string "Expected T=0 but was 1"
1.153 +
1.154 \ No newline at end of file
.