Commit | Line | Data |
---|---|---|
c906108c | 1 | |
28e7fd62 | 2 | # Copyright 1997-2013 Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | # This file was written by Jeff Law. (law@cygnus.com) |
18 | ||
c906108c SS |
19 | if ![istarget "mn10300*-*-*"] { |
20 | verbose "Tests ignored for all but mn10300 based targets." | |
21 | return | |
22 | } | |
23 | ||
24 | global exec_output | |
c906108c SS |
25 | |
26 | set testfile "mn10300" | |
27 | set srcfile ${srcdir}/${subdir}/${testfile}.s | |
28 | set binfile ${objdir}/${subdir}/${testfile} | |
29 | if { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } { | |
b60f0898 JB |
30 | untested mn10300.exp |
31 | return -1 | |
c906108c SS |
32 | } |
33 | ||
34 | proc add_tests { } { | |
35 | global gdb_prompt | |
36 | global hex | |
37 | global decimal | |
38 | ||
39 | send_gdb "x/14i add_tests\n" | |
40 | gdb_expect { | |
41 | -re " | |
42 | .*add d1,d2.* | |
43 | .*add d2,a3.* | |
44 | .*add a3,a2.* | |
45 | .*add a2,d1.* | |
46 | .*add 16,d1.* | |
47 | .*add 256,d2.* | |
48 | .*add 131071,d3.* | |
49 | .*add 16,a1.* | |
50 | .*add 256,a2.* | |
51 | .*add 131071,a3.* | |
52 | .*add 16,sp.* | |
53 | .*add 256,sp.* | |
54 | .*add 131071,sp.* | |
55 | .*addc d1,d2.* | |
56 | .*$gdb_prompt $" { pass "add tests" } | |
57 | -re "$gdb_prompt $" { fail "add tests" } | |
58 | timeout { fail "(timeout) add tests" } | |
59 | } | |
60 | } | |
61 | ||
62 | proc bcc_tests { } { | |
63 | global gdb_prompt | |
64 | global hex | |
65 | global decimal | |
66 | ||
67 | send_gdb "x/15i bCC_tests\n" | |
68 | gdb_expect { | |
69 | -re " | |
70 | .*beq 0x\[0-9a-f]+ <bCC_tests>.* | |
71 | .*bne 0x\[0-9a-f]+ <bCC_tests>.* | |
72 | .*bgt 0x\[0-9a-f]+ <bCC_tests>.* | |
73 | .*bge 0x\[0-9a-f]+ <bCC_tests>.* | |
74 | .*ble 0x\[0-9a-f]+ <bCC_tests>.* | |
75 | .*blt 0x\[0-9a-f]+ <bCC_tests>.* | |
76 | .*bhi 0x\[0-9a-f]+ <bCC_tests>.* | |
77 | .*bcc 0x\[0-9a-f]+ <bCC_tests>.* | |
78 | .*bls 0x\[0-9a-f]+ <bCC_tests>.* | |
79 | .*bcs 0x\[0-9a-f]+ <bCC_tests>.* | |
80 | .*bvc 0x\[0-9a-f]+ <bCC_tests>.* | |
81 | .*bvs 0x\[0-9a-f]+ <bCC_tests>.* | |
82 | .*bnc 0x\[0-9a-f]+ <bCC_tests>.* | |
83 | .*bns 0x\[0-9a-f]+ <bCC_tests>.* | |
84 | .*bra 0x\[0-9a-f]+ <bCC_tests>.* | |
85 | .*$gdb_prompt $" { pass "bCC tests" } | |
86 | -re "$gdb_prompt $" { fail "bCC tests" } | |
87 | timeout { fail "(timeout) bCC tests" } | |
88 | } | |
89 | } | |
90 | ||
91 | proc bit_tests { } { | |
92 | global gdb_prompt | |
93 | global hex | |
94 | global decimal | |
95 | ||
96 | send_gdb "x/11i bit_tests\n" | |
97 | gdb_expect { | |
98 | -re " | |
99 | .*btst 64,d1.* | |
100 | .*btst 8192,d2.* | |
101 | .*btst 131071,d3.* | |
102 | .*btst 64,\\(8,a1\\).* | |
103 | .*btst 64,\\(0x1ffff\\).* | |
104 | .*bset d1,\\(a2\\).* | |
105 | .*bset 64,\\(8,a1\\).* | |
106 | .*bset 64,\\(0x1ffff\\).* | |
107 | .*bclr d1,\\(a2\\).* | |
108 | .*bclr 64,\\(8,a1\\).* | |
109 | .*bclr 64,\\(0x1ffff\\).* | |
110 | .*$gdb_prompt $" { pass "bit tests" } | |
111 | -re "$gdb_prompt $" { fail "bit tests" } | |
112 | timeout { fail "(timeout) bit tests" } | |
113 | } | |
114 | } | |
115 | ||
116 | proc cmp_tests { } { | |
117 | global gdb_prompt | |
118 | global hex | |
119 | global decimal | |
120 | ||
121 | send_gdb "x/10i cmp_tests\n" | |
122 | gdb_expect { | |
123 | -re " | |
124 | .*cmp d1,d2.* | |
125 | .*cmp d2,a3.* | |
126 | .*cmp a3,d3.* | |
127 | .*cmp a3,a2.* | |
128 | .*cmp 16,d3.* | |
129 | .*cmp 256,d2.* | |
130 | .*cmp 131071,d1.* | |
131 | .*cmp 16,a3.* | |
132 | .*cmp 256,a2.* | |
133 | .*cmp 131071,a1.* | |
134 | .*$gdb_prompt $" { pass "cmp tests" } | |
135 | -re "$gdb_prompt $" { fail "cmp tests" } | |
136 | timeout { fail "(timeout) cmp tests" } | |
137 | } | |
138 | } | |
139 | ||
140 | proc extend_tests { } { | |
141 | global gdb_prompt | |
142 | global hex | |
143 | global decimal | |
144 | ||
145 | send_gdb "x/5i extend_tests\n" | |
146 | gdb_expect { | |
147 | -re " | |
148 | .*ext d1.* | |
149 | .*extb d2.* | |
150 | .*extbu d3.* | |
151 | .*exth d2.* | |
152 | .*exthu d1.* | |
153 | .*$gdb_prompt $" { pass "extend tests" } | |
154 | -re "$gdb_prompt $" { fail "extend tests" } | |
155 | timeout { fail "(timeout) extend tests" } | |
156 | } | |
157 | } | |
158 | ||
159 | proc extended_tests { } { | |
160 | global gdb_prompt | |
161 | global hex | |
162 | global decimal | |
163 | ||
164 | send_gdb "x/13i extended_tests\n" | |
165 | gdb_expect { | |
166 | -re " | |
167 | .*putx d1.* | |
168 | .*getx d2.* | |
169 | .*mulq d1,d2.* | |
170 | .*mulq 16,d2.* | |
171 | .*mulq 256,d3.* | |
172 | .*mulq 131071,d3.* | |
173 | .*mulqu d1,d2.* | |
174 | .*mulqu 16,d2.* | |
175 | .*mulqu 256,d3.* | |
176 | .*mulqu 131071,d3.* | |
177 | .*sat16 d2,d3.* | |
178 | .*sat24 d3,d2.* | |
179 | .*bsch d1,d2.* | |
180 | .*$gdb_prompt $" { pass "extended tests" } | |
181 | -re "$gdb_prompt $" { fail "extended tests" } | |
182 | timeout { fail "(timeout) extended tests" } | |
183 | } | |
184 | } | |
185 | ||
186 | proc logical_tests { } { | |
187 | global gdb_prompt | |
188 | global hex | |
189 | global decimal | |
190 | ||
191 | send_gdb "x/14i logical_tests\n" | |
192 | gdb_expect { | |
193 | -re " | |
194 | .*and d1,d2.* | |
195 | .*and 127,d2.* | |
196 | .*and 32767,d3.* | |
197 | .*and 131071,d3.* | |
198 | .*and 32767,psw.* | |
199 | .*or d1,d2.* | |
200 | .*or 127,d2.* | |
201 | .*or 32767,d3.* | |
202 | .*or 131071,d3.* | |
203 | .*or 32767,psw.* | |
204 | .*xor d1,d2.* | |
205 | .*xor 32767,d3.* | |
206 | .*xor 131071,d3.* | |
207 | .*not d3.* | |
208 | .*$gdb_prompt $" { pass "logical tests" } | |
209 | -re "$gdb_prompt $" { fail "logical tests" } | |
210 | timeout { fail "(timeout) logical tests" } | |
211 | } | |
212 | } | |
213 | ||
214 | proc loop_tests { } { | |
215 | global gdb_prompt | |
216 | global hex | |
217 | global decimal | |
218 | ||
219 | send_gdb "x/12i loop_tests\n" | |
220 | gdb_expect { | |
221 | -re " | |
222 | .*leq.* | |
223 | .*lne.* | |
224 | .*lgt.* | |
225 | .*lge.* | |
226 | .*lle.* | |
227 | .*llt.* | |
228 | .*lhi.* | |
229 | .*lcc.* | |
230 | .*lls.* | |
231 | .*lcs.* | |
232 | .*lra.* | |
233 | .*setlb.* | |
234 | .*$gdb_prompt $" { pass "loop tests" } | |
235 | -re "$gdb_prompt $" { fail "loop tests" } | |
236 | timeout { fail "(timeout) loop tests" } | |
237 | } | |
238 | } | |
239 | ||
240 | proc mov_tests_1 { } { | |
241 | global gdb_prompt | |
242 | global hex | |
243 | global decimal | |
244 | ||
245 | send_gdb "x/16i mov_tests_1\n" | |
246 | gdb_expect { | |
247 | -re " | |
248 | .*mov d1,d2.* | |
249 | .*mov d1,a2.* | |
250 | .*mov a2,d1.* | |
251 | .*mov a2,a1.* | |
252 | .*mov sp,a2.* | |
253 | .*mov a1,sp.* | |
254 | .*mov d2,psw.* | |
255 | .*mov mdr,d1.* | |
256 | .*mov d2,mdr.* | |
257 | .*mov \\(a2\\),d1.* | |
258 | .*mov \\(8,a2\\),d1.* | |
259 | .*mov \\(256,a2\\),d1.* | |
260 | .*mov \\(131071,a2\\),d1.* | |
261 | .*mov \\(8,sp\\),d1.* | |
262 | .*mov \\(256,sp\\),d1.* | |
263 | .*mov psw,d3.* | |
264 | .*$gdb_prompt $" { pass "mov1 tests" } | |
265 | -re "$gdb_prompt $" { fail "mov1 tests" } | |
266 | timeout { fail "(timeout) mov1 tests" } | |
267 | } | |
268 | } | |
269 | ||
270 | proc mov_tests_2 { } { | |
271 | global gdb_prompt | |
272 | global hex | |
273 | global decimal | |
274 | ||
275 | send_gdb "x/15i mov_tests_2\n" | |
276 | gdb_expect { | |
277 | -re " | |
278 | .*mov \\(131071,sp\\),d1.* | |
279 | .*mov \\(d1,a1\\),d2.* | |
280 | .*mov \\(0x8000.*\\),d1.* | |
281 | .*mov \\(0x1ffff.*\\),d1.* | |
282 | .*mov \\(a2\\),a1.* | |
283 | .*mov \\(8,a2\\),a1.* | |
284 | .*mov \\(256,a2\\),a1.* | |
285 | .*mov \\(131071,a2\\),a1.* | |
286 | .*mov \\(8,sp\\),a1.* | |
287 | .*mov \\(256,sp\\),a1.* | |
288 | .*mov \\(131071,sp\\),a1.* | |
289 | .*mov \\(d1,a1\\),a2.* | |
290 | .*mov \\(0x8000.*\\),a1.* | |
291 | .*mov \\(0x1ffff.*\\),a1.* | |
292 | .*mov \\(32,a1\\),sp.* | |
293 | .*$gdb_prompt $" { pass "mov2 tests" } | |
294 | -re "$gdb_prompt $" { fail "mov2 tests" } | |
295 | timeout { fail "(timeout) mov2 tests" } | |
296 | } | |
297 | } | |
298 | ||
299 | proc mov_tests_3 { } { | |
300 | global gdb_prompt | |
301 | global hex | |
302 | global decimal | |
303 | ||
304 | send_gdb "x/15i mov_tests_3\n" | |
305 | gdb_expect { | |
306 | -re " | |
307 | .*mov d1,\\(a2\\).* | |
308 | .*mov d1,\\(32,a2\\).* | |
309 | .*mov d1,\\(256,a2\\).* | |
310 | .*mov d1,\\(131071,a2\\).* | |
311 | .*mov d1,\\(32,sp\\).* | |
312 | .*mov d1,\\(32768,sp\\).* | |
313 | .*mov d1,\\(131071,sp\\).* | |
314 | .*mov d1,\\(d2,a2\\).* | |
315 | .*mov d1,\\(0x80.*\\).* | |
316 | .*mov d1,\\(0x1ffff.*\\).* | |
317 | .*mov a1,\\(a2\\).* | |
318 | .*mov a1,\\(32,a2\\).* | |
319 | .*mov a1,\\(256,a2\\).* | |
320 | .*mov a1,\\(131071,a2\\).* | |
321 | .*mov a1,\\(32,sp\\).* | |
322 | .*$gdb_prompt $" { pass "mov3 tests" } | |
323 | -re "$gdb_prompt $" { fail "mov3 tests" } | |
324 | timeout { fail "(timeout) mov3 tests" } | |
325 | } | |
326 | } | |
327 | ||
328 | proc mov_tests_4 { } { | |
329 | global gdb_prompt | |
330 | global hex | |
331 | global decimal | |
332 | ||
333 | send_gdb "x/12i mov_tests_4\n" | |
334 | gdb_expect { | |
335 | -re " | |
336 | .*mov a1,\\(32768,sp\\).* | |
337 | .*mov a1,\\(131071,sp\\).* | |
338 | .*mov a1,\\(d2,a2\\).* | |
339 | .*mov a1,\\(0x80.*\\).* | |
340 | .*mov a1,\\(0x1ffff.*\\).* | |
341 | .*mov sp,\\(32,a1\\).* | |
342 | .*mov 8,d1.* | |
343 | .*mov 256,d1.* | |
344 | .*mov 131071,d1.* | |
345 | .*mov 8,a1.* | |
346 | .*mov 256,a1.* | |
347 | .*mov 131071,a1.* | |
348 | .*$gdb_prompt $" { pass "mov4 tests" } | |
349 | -re "$gdb_prompt $" { fail "mov4 tests" } | |
350 | timeout { fail "(timeout) mov4 tests" } | |
351 | } | |
352 | } | |
353 | ||
354 | proc movbu_tests { } { | |
355 | global gdb_prompt | |
356 | global hex | |
357 | global decimal | |
358 | ||
359 | send_gdb "x/20i movbu_tests\n" | |
360 | gdb_expect { | |
361 | -re " | |
362 | .*movbu \\(a2\\),d1.* | |
363 | .*movbu \\(8,a2\\),d1.* | |
364 | .*movbu \\(256,a2\\),d1.* | |
365 | .*movbu \\(131071,a2\\),d1.* | |
366 | .*movbu \\(8,sp\\),d1.* | |
367 | .*movbu \\(256,sp\\),d1.* | |
368 | .*movbu \\(131071,sp\\),d1.* | |
369 | .*movbu \\(d1,a1\\),d2.* | |
370 | .*movbu \\(0x8000.*\\),d1.* | |
371 | .*movbu \\(0x1ffff.*\\),d1.* | |
372 | .*movbu d1,\\(a2\\).* | |
373 | .*movbu d1,\\(32,a2\\).* | |
374 | .*movbu d1,\\(256,a2\\).* | |
375 | .*movbu d1,\\(131071,a2\\).* | |
376 | .*movbu d1,\\(32,sp\\).* | |
377 | .*movbu d1,\\(32768,sp\\).* | |
378 | .*movbu d1,\\(131071,sp\\).* | |
379 | .*movbu d1,\\(d2,a2\\).* | |
380 | .*movbu d1,\\(0x80.*\\).* | |
381 | .*movbu d1,\\(0x1ffff.*\\).* | |
382 | .*$gdb_prompt $" { pass "movbu tests" } | |
383 | -re "$gdb_prompt $" { fail "movbu tests" } | |
384 | timeout { fail "(timeout) movbu tests" } | |
385 | } | |
386 | } | |
387 | ||
388 | proc movhu_tests { } { | |
389 | global gdb_prompt | |
390 | global hex | |
391 | global decimal | |
392 | ||
393 | send_gdb "x/20i movhu_tests\n" | |
394 | gdb_expect { | |
395 | -re " | |
396 | .*movhu \\(a2\\),d1.* | |
397 | .*movhu \\(8,a2\\),d1.* | |
398 | .*movhu \\(256,a2\\),d1.* | |
399 | .*movhu \\(131071,a2\\),d1.* | |
400 | .*movhu \\(8,sp\\),d1.* | |
401 | .*movhu \\(256,sp\\),d1.* | |
402 | .*movhu \\(131071,sp\\),d1.* | |
403 | .*movhu \\(d1,a1\\),d2.* | |
404 | .*movhu \\(0x8000.*\\),d1.* | |
405 | .*movhu \\(0x1ffff.*\\),d1.* | |
406 | .*movhu d1,\\(a2\\).* | |
407 | .*movhu d1,\\(32,a2\\).* | |
408 | .*movhu d1,\\(256,a2\\).* | |
409 | .*movhu d1,\\(131071,a2\\).* | |
410 | .*movhu d1,\\(32,sp\\).* | |
411 | .*movhu d1,\\(32768,sp\\).* | |
412 | .*movhu d1,\\(131071,sp\\).* | |
413 | .*movhu d1,\\(d2,a2\\).* | |
414 | .*movhu d1,\\(0x80.*\\).* | |
415 | .*movhu d1,\\(0x1ffff.*\\).* | |
416 | .*$gdb_prompt $" { pass "movhu tests" } | |
417 | -re "$gdb_prompt $" { fail "movhu tests" } | |
418 | timeout { fail "(timeout) movhu tests" } | |
419 | } | |
420 | } | |
421 | ||
422 | proc movm_tests { } { | |
423 | global gdb_prompt | |
424 | global hex | |
425 | global decimal | |
426 | ||
427 | send_gdb "x/4i movm_tests\n" | |
428 | gdb_expect { | |
429 | -re " | |
430 | .*movm \\(sp\\),.a2,a3..* | |
431 | .*movm \\(sp\\),.d2,d3,a2,a3,other..* | |
432 | .*movm .a2,a3.,\\(sp\\).* | |
433 | .*movm .d2,d3,a2,a3,other.,\\(sp\\).* | |
434 | .*$gdb_prompt $" { pass "movm tests" } | |
435 | -re "$gdb_prompt $" { fail "movm tests" } | |
436 | timeout { fail "(timeout) movm tests" } | |
437 | } | |
438 | } | |
439 | ||
440 | proc muldiv_tests { } { | |
441 | global gdb_prompt | |
442 | global hex | |
443 | global decimal | |
444 | ||
445 | send_gdb "x/4i muldiv_tests\n" | |
446 | gdb_expect { | |
447 | -re " | |
448 | .*mul d1,d2.* | |
449 | .*mulu d2,d3.* | |
450 | .*div d3,d3.* | |
451 | .*divu d3,d2.* | |
452 | .*$gdb_prompt $" { pass "muldiv tests" } | |
453 | -re "$gdb_prompt $" { fail "muldiv tests" } | |
454 | timeout { fail "(timeout) muldiv tests" } | |
455 | } | |
456 | } | |
457 | ||
458 | proc other_tests { } { | |
459 | global gdb_prompt | |
460 | global hex | |
461 | global decimal | |
462 | ||
463 | send_gdb "x/19i other_tests\n" | |
464 | gdb_expect { | |
465 | -re " | |
466 | .*clr d2.* | |
467 | .*inc d1.* | |
468 | .*inc a2.* | |
469 | .*inc4 a3.* | |
470 | .*jmp \\(a2\\).* | |
471 | .*jmp 0x\[0-9a-f]+ <main>.* | |
472 | .*jmp 0x\[0-9a-f]+ <start>.* | |
473 | .*call 0x\[0-9a-f]+ <main>,.a2,a3.,9.* | |
474 | .*call 0x\[0-9a-f]+ <start>,.a2,a3.,32.* | |
475 | .*calls \\(a2\\).* | |
476 | .*calls 0x\[0-9a-f]+ <main>.* | |
477 | .*calls 0x\[0-9a-f]+ <start>.* | |
478 | .*ret .a2,a3.,7.* | |
479 | .*retf .a2,a3.,5.* | |
480 | .*rets.* | |
481 | .*rti.* | |
482 | .*trap.* | |
483 | .*nop.* | |
484 | .*rtm.* | |
485 | .*$gdb_prompt $" { pass "other tests" } | |
486 | -re "$gdb_prompt $" { fail "other tests" } | |
487 | timeout { fail "(timeout) other tests" } | |
488 | } | |
489 | } | |
490 | ||
491 | proc shift_tests { } { | |
492 | global gdb_prompt | |
493 | global hex | |
494 | global decimal | |
495 | ||
496 | send_gdb "x/9i shift_tests\n" | |
497 | gdb_expect { | |
498 | -re " | |
499 | .*asr d1,d2.* | |
500 | .*asr 4,d2.* | |
501 | .*lsr d2,d3.* | |
502 | .*lsr 4,d3.* | |
503 | .*asl d3,d2.* | |
504 | .*asl 4,d2.* | |
505 | .*asl2 d2.* | |
506 | .*ror d1.* | |
507 | .*rol d2.* | |
508 | .*$gdb_prompt $" { pass "shift tests" } | |
509 | -re "$gdb_prompt $" { fail "shift tests" } | |
510 | timeout { fail "(timeout) shift tests" } | |
511 | } | |
512 | } | |
513 | ||
514 | proc sub_tests { } { | |
515 | global gdb_prompt | |
516 | global hex | |
517 | global decimal | |
518 | ||
519 | send_gdb "x/7i sub_tests\n" | |
520 | gdb_expect { | |
521 | -re " | |
522 | .*sub d1,d2.* | |
523 | .*sub d2,a3.* | |
524 | .*sub a3,d3.* | |
525 | .*sub a3,a2.* | |
526 | .*sub 131071,d2.* | |
527 | .*sub 131071,a1.* | |
528 | .*subc d1,d2.* | |
529 | .*$gdb_prompt $" { pass "sub tests" } | |
530 | -re "$gdb_prompt $" { fail "sub tests" } | |
531 | timeout { fail "(timeout) sub tests" } | |
532 | } | |
533 | } | |
534 | ||
535 | # Start with a fresh gdb. | |
536 | ||
537 | gdb_exit | |
538 | gdb_start | |
539 | gdb_reinitialize_dir $srcdir/$subdir | |
540 | gdb_load $binfile | |
541 | ||
542 | add_tests | |
543 | bcc_tests | |
544 | bit_tests | |
545 | cmp_tests | |
546 | extend_tests | |
547 | extended_tests | |
548 | logical_tests | |
549 | loop_tests | |
550 | mov_tests_1 | |
551 | mov_tests_2 | |
552 | mov_tests_3 | |
553 | mov_tests_4 | |
554 | movbu_tests | |
555 | movhu_tests | |
556 | movm_tests | |
557 | muldiv_tests | |
558 | other_tests | |
559 | shift_tests | |
560 | sub_tests |