1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# sh testcase for sub $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
.include "compact/testutils.inc"
start
.global sub1
sub1:
# 0 - x.
mov #0, r0
mov #3, r1
sub r1, r0
mov #2, r7
not r7, r7
cmp/eq r7, r0
bf wrong
.global sub2
sub2:
# x - 0.
mov #0, r0
mov #3, r1
sub r0, r1
assert r1, #3
.global sub3
sub3:
# x - y.
mov #4, r0
mov #3, r1
sub r0, r1
mov #0, r7
not r7, r7
cmp/eq r7, r1
bf wrong
.global sub4
sub4:
# y - x.
mov #4, r0
mov #3, r1
sub r1, r0
assert r0, #1
.global sub5
sub5:
# y - y == 0 (where y are in two distinct registers).
mov #4, r0
mov #4, r1
sub r1, r0
assert r0, #0
.global sub6
sub6:
# y - y = 0 (where y is the same register).
mov #4, r1
sub r1, r1
assert r1, #0
okay:
pass
wrong:
fail
|