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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
// MAC test program.
// Test basic edge values
// SIGNED FRACTIONAL mode
// test ops: "+=" "-=" "=" "NOP"
# mach: bfin
.include "testutils.inc"
start
// load r0=0x80007fff
// load r1=0x80007fff
// load r2=0xf0000000
// load r3=0x0000007f
// load r4=0x00000080
loadsym P0, data0;
R0 = [ P0 ++ ];
R1 = [ P0 ++ ];
R2 = [ P0 ++ ];
R3 = [ P0 ++ ];
R4 = [ P0 ++ ];
// 0x7fff * 0x7fff = 0x007ffe0002
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1 += R0.L * R1.L, A0 += R0.L * R1.L;
R6 = A1.w;
_DBG ASTAT;
_DBG A0;
R7.L = A1.x;
_DBG ASTAT;
DBGA ( R6.L , 0x0002 );
DBGA ( R6.H , 0x7ffe );
DBGA ( R7.L , 0x0000 );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x0 );
// 0x8000 * 0x7fff = 0xff80010000
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1 += R0.H * R1.L, A0 += R0.H * R1.L;
R6 = A1.w;
R7.L = A1.x;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x8001 );
DBGA ( R7.L , 0xffff );
_DBG ASTAT;
R7 = ASTAT;
DBGA (R7.H, 0x0);
DBGA (R7.L, 0x0);
// 0x8000 * 0x8000 = 0x007fffffff
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1 += R0.H * R1.H, A0 += R0.H * R1.H;
R6 = A1.w;
R7.L = A1.x;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x8000 );
DBGA ( R7.L , 0x0000 );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x0 );
// saturate positive by first loading large value into accums
// expected value is 0x7fffffffff
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1.w = R2;
A1.x = R3.L;
A0.w = R2;
A0.x = R3.L;
A1 += R0.L * R1.L, A0 += R0.L * R1.L;
R6 = A1.w;
R7.L = A1.x;
DBGA ( R6.L , 0xffff );
DBGA ( R6.H , 0xffff );
DBGA ( R7.L , 0x007f );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x1 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x1 );
// saturate negative
// expected value is 0x8000000000
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1.x = R4.L;
A0.x = R4.L;
A1 += R0.L * R1.H, A0 += R0.L * R1.H;
R6 = A1.w;
_DBG ASTAT;
R7.L = A1.x;
_DBG ASTAT;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x0000 );
DBGA ( R7.L , 0xff80 );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x1 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x1 );
// saturate positive with "-="
// expected value is 0x7fffffffff
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1.w = R2;
A1.x = R3.L;
A0.w = R2;
A0.x = R3.L;
A1 -= R0.H * R1.L, A0 -= R0.H * R1.L;
R6 = A1.w;
R7.L = A1.x;
DBGA ( R6.L , 0xffff );
DBGA ( R6.H , 0xffff );
DBGA ( R7.L , 0x007f );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x1 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x1 );
// saturate negative with "-="
// expected value is 0x8000000000
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1.x = R4.L;
A0.x = R4.L;
A1 -= R0.L * R1.L, A0 -= R0.L * R1.L;
R6 = A1.w;
_DBG ASTAT;
R7.L = A1.x;
_DBG ASTAT;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x0000 );
DBGA ( R7.L , 0xff80 );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x1 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x1 );
// 0x8000 * 0x8000 = 0xff80000001 with "-="
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1 -= R0.H * R1.H, A0 -= R0.H * R1.H;
R6 = A1.w;
_DBG ASTAT;
R7.L = A1.x;
_DBG ASTAT;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x8000 );
DBGA ( R7.L , 0xffff );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x0 );
// 0x7fff * 0x7fff = 0x007ffe0002 with "="
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1 += R0.L * R1.L, A0 += R0.L * R1.L;
A1 = R0.L * R1.L, A0 = R0.L * R1.L;
R6 = A1.w;
R7.L = A1.x;
DBGA ( R6.L , 0x0002 );
DBGA ( R6.H , 0x7ffe );
DBGA ( R7.L , 0x0000 );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x0 );
// 0x7fff * 0x7fff = 0x007ffe0002 with "NOP"
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1 += R0.L * R1.L;
R6 = A1.w;
R7.L = A1.x;
DBGA ( R6.L , 0x0002 );
DBGA ( R6.H , 0x7ffe );
DBGA ( R7.L , 0x0000 );
R6 = A0.w;
R7.L = A0.x;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x0000 );
DBGA ( R7.L , 0x0000 );
CC = AZ; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AN; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AC0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV0; R7 = CC; DBGA ( R7.L , 0x0 );
CC = AV1; R7 = CC; DBGA ( R7.L , 0x0 );
// 0x8000 * 0x8000 = 0x007fffffff with "NOP"
R7 = 0;
ASTAT = R7;
A1 = A0 = 0;
A1 += R0.H * R1.H;
_DBG A1;
R6 = A1.w;
R7.L = A1.x;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x8000 );
DBGA ( R7.L , 0x0000 );
R6 = A0.w;
_DBG ASTAT;
R7.L = A0.x;
_DBG ASTAT;
DBGA ( R6.L , 0x0000 );
DBGA ( R6.H , 0x0000 );
DBGA ( R7.L , 0x0000 );
R7 = ASTAT; _dbg astat;
//AV1 AV1S should be 0.
DBGA ( R7.H , 0x0000 );
DBGA ( R7.L , 0x0000 );
_DBG ASTAT;
A1 = A0 = 0;
_DBG A1;
_DBG R0; _DBG R1;
A1 += R0.L * R1.L; // make sure overflow flag is not set to zero
_DBG A1;
_DBG ASTAT;
R7 = ASTAT;
//AV1S should be 0.
DBGA ( R7.H, 0x0000 );
DBGA ( R7.L, 0x0000 );
pass
.data
data0:
.dw 0x7fff
.dw 0x8000
.dw 0x7fff
.dw 0x8000
.dw 0x0000
.dw 0xf000
.dw 0x007f
.dw 0x0000
.dw 0x0080
.dw 0x0000
|