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