Search
lxdream.org :: lxdream/test/sh4/add.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/add.s
changeset 225:e5cea6125580
next226:0eeeb25447d3
author nkeynes
date Wed Sep 20 09:52:32 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Commit start of SH4 test cases
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/sh4/add.s Wed Sep 20 09:52:32 2006 +0000
1.3 @@ -0,0 +1,145 @@
1.4 + .section .text
1.5 +.global _test_add
1.6 +_test_add:
1.7 + mov.l r14, @-r15
1.8 + sts.l pr, @-r15
1.9 + mov.l r12, @-r15
1.10 + mov.l r13, @-r15
1.11 + mov r15, r14
1.12 + xor r12,r12
1.13 + xor r13,r13
1.14 +# r12 is the test counter
1.15 +# r13 is the failed-test counter
1.16 +
1.17 +test_add_1: # test adding 0+0 = 0
1.18 + add #1, r12
1.19 + xor r0,r0
1.20 + xor r1,r1
1.21 + xor r2,r2
1.22 + add r0,r1
1.23 + cmp/eq r1, r2
1.24 + bt test_add_2
1.25 + add #1, r13
1.26 +
1.27 +test_add_2: # test 0+ constant 1 = 1
1.28 + add #1, r12
1.29 + xor r0, r0
1.30 + xor r1, r1
1.31 + add #1, r1
1.32 + mov.l test_add_2_result, r2
1.33 + cmp/eq r1, r2
1.34 + bt test_add_3
1.35 + add #1, r13
1.36 + bra test_add_3
1.37 + nop
1.38 +
1.39 + .align 4
1.40 +test_add_2_result:
1.41 + .long 0x00000001
1.42 +
1.43 +test_add_3: # test 0 + constant -1 = -1
1.44 + add #1, r12
1.45 + xor r0, r0
1.46 + xor r1, r1
1.47 + add #-1, r1
1.48 + mov.l test_add_3_result, r2
1.49 + cmp/eq r1, r2
1.50 + bt test_add_4
1.51 + add #1, r13
1.52 + bra test_add_4
1.53 + nop
1.54 +
1.55 + .align 4
1.56 +test_add_3_result:
1.57 + .long 0xFFFFFFFF
1.58 +
1.59 +test_add_4: # test a+b = c w/ overflow
1.60 + add #1, r12
1.61 + mov.l test_add_4_op1, r4
1.62 + mov.l test_add_4_op2, r5
1.63 + mov.l test_add_4_result, r0
1.64 + add r4, r5
1.65 + cmp/eq r5, r0
1.66 + bt test_add_5
1.67 + add #1, r13
1.68 + bra test_add_5
1.69 + nop
1.70 +
1.71 + .align 4
1.72 +test_add_4_op1:
1.73 + .long 0x98765432
1.74 +test_add_4_op2:
1.75 + .long 0xA1234567
1.76 +test_add_4_result:
1.77 + .long 0x39999999
1.78 +
1.79 +test_add_5: # test carry neither used nor set (ala ADDC)
1.80 + add #1, r12
1.81 + mov.l test_add_5_op1, r8
1.82 + mov.l test_add_5_op2, r9
1.83 + stc sr, r10
1.84 + xor r0,r0
1.85 + add #1, r0
1.86 + or r0,r10
1.87 + ldc r10, sr
1.88 + add r9,r8
1.89 + mov.l test_add_5_result, r11
1.90 + cmp/eq r11, r8
1.91 + bt test_add_5_b
1.92 + add #1, r13
1.93 + mov.l test_print_failure_k, r3
1.94 + mov r12, r5
1.95 + mov.l test_add_str_k, r4
1.96 + jsr @r3
1.97 + nop
1.98 + bra test_add_6
1.99 + nop
1.100 +test_add_5_b:
1.101 + stc sr, r1
1.102 + and r0, r1
1.103 + cmp/eq r0, r1
1.104 + bt test_add_6
1.105 + add #1, r13
1.106 + mov.l test_print_failure_k, r3
1.107 + mov r12, r5
1.108 + mov.l test_add_str_k, r4
1.109 + jsr @r3
1.110 + nop
1.111 + bra test_add_6
1.112 + nop
1.113 +
1.114 +test_add_5_op1:
1.115 + .long 0x11111111
1.116 +test_add_5_op2:
1.117 + .long 0x1000FFFF
1.118 +test_add_5_result:
1.119 + .long 0x21121110
1.120 +
1.121 +test_add_6:
1.122 +
1.123 +test_add_end:
1.124 + mov.l test_add_str_k, r4
1.125 + mov r13, r5
1.126 + mov r12, r6
1.127 + mov.l test_print_result_k, r1
1.128 + jsr @r1
1.129 + mov r14, r15
1.130 + mov.l @r15+, r13
1.131 + mov.l @r15+, r12
1.132 + lds.l @r15+, pr
1.133 + mov.l @r15+, r14
1.134 + rts
1.135 + nop
1.136 +
1.137 + .align 2
1.138 +test_add_str:
1.139 + .string "ADD"
1.140 + .align 2
1.141 +
1.142 +test_add_str_k:
1.143 + .long test_add_str
1.144 +test_print_result_k:
1.145 + .long _test_print_result
1.146 +test_print_failure_k:
1.147 + .long _test_print_failure
1.148 +
1.149 \ No newline at end of file
.