Commit | Line | Data |
---|---|---|
cbb38b47 BE |
1 | # sh testcase for add #$imm8, $rn -*- Asm -*- |
2 | # mach: all | |
3 | # as: -isa=shcompact | |
4 | # ld: -m shelf32 | |
5 | ||
6 | .include "compact/testutils.inc" | |
7 | ||
8 | start | |
9 | init: | |
10 | # Initialise some registers with values which help us to verify | |
11 | # that the correct source registers are used by the ADD instruction. | |
12 | mov #0, r0 | |
13 | mov #1, r1 | |
14 | mov #2, r2 | |
15 | mov #3, r3 | |
16 | mov #5, r5 | |
17 | mov #15, r15 | |
18 | ||
19 | addi: | |
20 | # 0 + 0 = 0. | |
21 | add #0, r0 | |
22 | assert r0, #0 | |
23 | ||
24 | # 0 + 1 = 1. | |
25 | add #0, r1 | |
26 | assert r1, #1 | |
27 | ||
28 | # 2 + 2 = 4. | |
29 | add #2, r2 | |
30 | assert r2, #4 | |
31 | ||
32 | # 120 + 5 = 125. | |
33 | add #120, r5 | |
34 | assert r5, #125 | |
35 | ||
36 | large: | |
37 | mov #1, r0 | |
38 | neg r0, r0 | |
39 | add #2, r0 | |
40 | assert r0, #1 | |
41 | ||
42 | okay: | |
43 | pass | |
44 | ||
45 | wrong: | |
46 | fail |