filename | test/sh4/inc.s |
changeset | 226:0eeeb25447d3 |
next | 228:70adc8ffa8d1 |
author | nkeynes |
date | Sat Sep 23 10:35:29 2006 +0000 (16 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 +00001.2 +++ b/test/sh4/inc.s Sat Sep 23 10:35:29 2006 +00001.3 @@ -0,0 +1,150 @@1.4 +.altmacro1.5 +.macro fail name1.6 +LOCAL LC11.7 +LOCAL LC21.8 + add #1, r131.9 + mov.l LC1, r31.10 + mov r12, r51.11 + mov.l \name, r41.12 + xor r6, r61.13 + jsr @r31.14 + nop1.15 + bra LC21.16 + nop1.17 +.align 41.18 +LC1:1.19 + .long _test_print_failure1.20 +LC2:1.21 +.endm1.22 +1.23 +.macro failm name msg1.24 +LOCAL LC11.25 +LOCAL LC21.26 + add #1, r131.27 + mov.l LC1, r31.28 + mov r12, r51.29 + mov.l \name, r41.30 + mov.l \msg, r61.31 + jsr @r31.32 + nop1.33 + bra LC21.34 + nop1.35 +.align 41.36 +LC1:1.37 + .long _test_print_failure1.38 +LC2:1.39 +.endm1.40 +1.41 +1.42 +.macro start_test1.43 + mov.l r14, @-r151.44 + sts.l pr, @-r151.45 + mov.l r12, @-r151.46 + mov.l r13, @-r151.47 + mov r15, r141.48 + xor r12,r121.49 + xor r13,r131.50 +! r12 is the test counter1.51 +! r13 is the failed-test counter1.52 +.endm1.53 +1.54 +.macro end_test name1.55 +LOCAL test_print_result_k1.56 + mov.l \name, r41.57 + mov r13, r51.58 + mov r12, r61.59 + mov.l test_print_result_k, r31.60 + jsr @r31.61 + nop1.62 + mov r14, r151.63 + mov.l @r15+, r131.64 + mov.l @r15+, r121.65 + lds.l @r15+, pr1.66 + mov.l @r15+, r141.67 + rts1.68 + nop1.69 +.align 41.70 +test_print_result_k:1.71 + .long _test_print_result1.72 +.endm1.73 +1.74 +1.75 +.macro assert_t_set testname1.76 +LOCAL LC11.77 +LOCAL LC21.78 +LOCAL LCM1.79 + stc sr, r11.80 + mov.l r1, @-r151.81 + xor r0, r01.82 + add #1, r01.83 + and r0, r11.84 + cmp/eq r0, r11.85 + bt LC21.86 + add #1, r131.87 + mov.l LC1, r31.88 + mov r12, r51.89 + mov.l \testname, r41.90 + mov.l LCM, r61.91 + jsr @r31.92 + nop1.93 + bra LC21.94 + nop1.95 +.align 41.96 +LC1:1.97 + .long _test_print_failure1.98 +LCM: .long assert_t_clear_message1.99 +LC2:1.100 + mov.l @r15+, r11.101 + ldc r1, sr1.102 +.endm1.103 +1.104 +.macro assert_t_clear testname1.105 +LOCAL LC11.106 +LOCAL LC21.107 +LOCAL LCM1.108 + stc sr, r11.109 + mov.l r1, @-r151.110 + xor r0, r01.111 + add #1, r01.112 + and r0, r11.113 + cmp/eq r0, r11.114 + bf LC21.115 + add #1, r131.116 + mov.l LC1, r31.117 + mov r12, r51.118 + mov.l \testname, r41.119 + mov.l LCM, r61.120 + jsr @r31.121 + nop1.122 + bra LC21.123 + nop1.124 +.align 41.125 +LC1:1.126 + .long _test_print_failure1.127 +LCM: .long assert_t_clear_message1.128 +LC2:1.129 + mov.l @r15+, r11.130 + ldc r1, sr1.131 +.endm1.132 +1.133 +! Note that yes there is a perfectly good clrt instruction, but we try to1.134 +! minimize the number of instructions we depend on here.1.135 +1.136 +.macro clc1.137 + xor r0, r01.138 + addc r0, r01.139 +.endm1.140 +.macro setc1.141 + xor r0, r01.142 + not r0, r01.143 + addc r0, r01.144 +.endm1.145 +1.146 +1.147 + .align 21.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
.