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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# Blackfin testcase for push/pop multiples instructions
# mach: bfin
.include "testutils.inc"
# Tests follow the pattern:
# - do the push multiple
# - write a garbage value to all registers pushed
# - do the pop multiple
# - check all registers popped against known values
start
# Repeat the same operation multiple times, so this:
# do_x moo, R, 1
# becomes this:
# moo R1, 0x11111111
# moo R0, 0x00000000
.macro _do_x func:req, reg:req, max:req, x:req
.ifle (\max - \x)
\func \reg\()\x, 0x\x\x\x\x\x\x\x\x
.endif
.endm
.macro do_x func:req, reg:req, max:req
.ifc \reg, R
_do_x \func, \reg, \max, 7
_do_x \func, \reg, \max, 6
.endif
_do_x \func, \reg, \max, 5
_do_x \func, \reg, \max, 4
_do_x \func, \reg, \max, 3
_do_x \func, \reg, \max, 2
_do_x \func, \reg, \max, 1
_do_x \func, \reg, \max, 0
.endm
# Keep the garbage value in I0
.macro loadi reg:req, val:req
\reg = I0;
.endm
imm32 I0, 0xAABCDEFF
#
# Test push/pop multiples with (R7:x) syntax
#
_push_r_tests:
# initialize all Rx regs with a known value
do_x imm32, R, 0
.macro checkr tochk:req, val:req
P0 = \tochk;
imm32 P1, \val
CC = P0 == P1;
IF !CC JUMP 8f;
.endm
.macro pushr maxr:req
_push_r\maxr:
[--SP] = (R7:\maxr);
do_x loadi, R, \maxr
(R7:\maxr) = [SP++];
do_x checkr, R, \maxr
# need to do a long jump to avoid PCREL issues
jump 9f;
8: jump.l 1f;
9:
.endm
pushr 7
pushr 6
pushr 5
pushr 4
pushr 3
pushr 2
pushr 1
pushr 0
#
# Test push/pop multiples with (P5:x) syntax
#
_push_p_tests:
# initialize all Px regs with a known value
do_x imm32, P, 0
.macro checkp tochk:req, val:req
R0 = \tochk;
imm32 R1, \val
CC = R0 == R1;
IF !CC JUMP 8f;
.endm
.macro pushp maxp:req
_push_p\maxp:
[--SP] = (P5:\maxp);
do_x loadi, P, \maxp
(P5:\maxp) = [SP++];
do_x checkp, P, \maxp
# need to do a long jump to avoid PCREL issues
jump 9f;
8: jump.l 1f;
9:
.endm
# checkp func clobbers R0/R1
L0 = R0;
L1 = R1;
pushp 5
pushp 4
pushp 3
pushp 2
pushp 1
pushp 0
R0 = L0;
R1 = L1;
#
# Test push/pop multiples with (R7:x, P5:x) syntax
#
_push_rp_tests:
.macro _pushrp maxr:req, maxp:req
_push_r\maxr\()_p\maxp:
[--SP] = (R7:\maxr, P5:\maxp);
do_x loadi, R, \maxr
do_x loadi, P, \maxp
(R7:\maxr, P5:\maxp) = [SP++];
# checkr func clobbers P0/P1
L0 = P0;
L1 = P1;
do_x checkr, R, \maxr
P1 = L1;
P0 = L0;
# checkp func clobbers R0/R1
L0 = R0;
L1 = R1;
do_x checkp, P, \maxp
R0 = L0;
R1 = L1;
# need to do a long jump to avoid PCREL issues
jump 9f;
8: jump.l 1f;
9:
.endm
.macro pushrp maxr:req
_pushrp \maxr, 5
_pushrp \maxr, 4
_pushrp \maxr, 3
_pushrp \maxr, 2
_pushrp \maxr, 1
_pushrp \maxr, 0
.endm
pushrp 7
pushrp 6
pushrp 5
pushrp 4
pushrp 3
pushrp 2
pushrp 1
pushrp 0
pass
1:
fail
|