1# Copyright (C) 2012-2014 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17#
18# Some h8300sx tests -- t12_bit
19#
20
21proc do_t12_bit_test {} {
22    set testname "t12_bit.s -- h8sx bit tests"
23
24    gas_start "t12_bit.s" "-al"
25
26    # Check each instruction bit pattern to verify it got assembled correctly.
27
28    set x 0
29    expect {
30	-re ".*   7 0000 7071" { set x [expr $x+1]; exp_continue; }
31	-re ".*   8 0002 7D107070" { set x [expr $x+1]; exp_continue; }
32	-re ".*   9 0006 7F127070" { set x [expr $x+1]; exp_continue; }
33	-re ".*  10 000a 6A181234" { set x [expr $x+1]; exp_continue; }
34	-re ".*  10      7070" { set x [expr $x+1]; exp_continue; }
35	-re ".*  11 0010 6A381234" { set x [expr $x+1]; exp_continue; }
36	-re ".*  11      56787070" { set x [expr $x+1]; exp_continue; }
37	-re ".*  12              " {
38	    if [expr $x == 7] then {
39		pass "$testname: bset #0x7, ..."
40	    } else {
41		fail "$testname: bset #0x7, ... ($x)"
42	    }
43	}
44        default	{ fail "$testname: bset #0x7, ... ($x)" }
45    }
46
47    set x 0
48    expect {
49	-re ".*  13 0018 6031" { set x [expr $x+1]; exp_continue; }
50	-re ".*  14 001a 7D106030" { set x [expr $x+1]; exp_continue; }
51	-re ".*  15 001e 7F126030" { set x [expr $x+1]; exp_continue; }
52	-re ".*  16 0022 6A181234" { set x [expr $x+1]; exp_continue; }
53	-re ".*  16      6030" { set x [expr $x+1]; exp_continue; }
54	-re ".*  17 0028 6A381234" { set x [expr $x+1]; exp_continue; }
55	-re ".*  17      56786030" { set x [expr $x+1]; exp_continue; }
56	-re ".*  18              " {
57	    if [expr $x == 7] then {
58		pass "$testname: bset r3h, ..."
59	    } else {
60		fail "$testname: bset r3h, ... ($x)"
61	    }
62	}
63        default	{ fail "$testname: bset r3h, ... ($x)" }
64    }
65
66    set x 0
67    expect {
68	-re ".*  19 0030 7D107077" { set x [expr $x+1]; exp_continue; }
69	-re ".*  20 0034 7F127077" { set x [expr $x+1]; exp_continue; }
70	-re ".*  21 0038 6A181234" { set x [expr $x+1]; exp_continue; }
71	-re ".*  21      7077" { set x [expr $x+1]; exp_continue; }
72	-re ".*  22 003e 6A381234" { set x [expr $x+1]; exp_continue; }
73	-re ".*  22      56787077" { set x [expr $x+1]; exp_continue; }
74	-re ".*  23              " {
75	    if [expr $x == 6] then {
76		pass "$testname: bset/eq #0x7, ..."
77	    } else {
78		fail "$testname: bset/eq #0x7, ... ($x)"
79	    }
80	}
81        default	{ fail "$testname: bset/eq #0x7, ... ($x)" }
82    }
83
84    set x 0
85    expect {
86	-re ".*  24 0046 7D106037" { set x [expr $x+1]; exp_continue; }
87	-re ".*  25 004a 7F126037" { set x [expr $x+1]; exp_continue; }
88	-re ".*  26 004e 6A181234" { set x [expr $x+1]; exp_continue; }
89	-re ".*  26      6037" { set x [expr $x+1]; exp_continue; }
90	-re ".*  27 0054 6A381234" { set x [expr $x+1]; exp_continue; }
91	-re ".*  27      56786037" { set x [expr $x+1]; exp_continue; }
92	-re ".*  28              " {
93	    if [expr $x == 6] then {
94		pass "$testname: bset/eq r3h, ..."
95	    } else {
96		fail "$testname: bset/eq r3h, ... ($x)"
97	    }
98	}
99        default	{ fail "$testname: bset/eq r3h, ... ($x)" }
100    }
101
102    set x 0
103    expect {
104	-re ".*  29 005c 7D107076" { set x [expr $x+1]; exp_continue; }
105	-re ".*  30 0060 7F127076" { set x [expr $x+1]; exp_continue; }
106	-re ".*  31 0064 6A181234" { set x [expr $x+1]; exp_continue; }
107	-re ".*  31      7076" { set x [expr $x+1]; exp_continue; }
108	-re ".*  32 006a 6A381234" { set x [expr $x+1]; exp_continue; }
109	-re ".*  32      56787076" { set x [expr $x+1]; exp_continue; }
110	-re ".*  33              " {
111	    if [expr $x == 6] then {
112		pass "$testname: bset/ne #0x7, ..."
113	    } else {
114		fail "$testname: bset/ne #0x7, ... ($x)"
115	    }
116	}
117        default	{ fail "$testname: bset/ne #0x7, ... ($x)" }
118    }
119
120    set x 0
121    expect {
122	-re ".*  34 0072 7D106036" { set x [expr $x+1]; exp_continue; }
123	-re ".*  35 0076 7F126036" { set x [expr $x+1]; exp_continue; }
124	-re ".*  36 007a 6A181234" { set x [expr $x+1]; exp_continue; }
125	-re ".*  36      6036" { set x [expr $x+1]; exp_continue; }
126	-re ".*  37 0080 6A381234" { set x [expr $x+1]; exp_continue; }
127	-re ".*  37      56786036" { set x [expr $x+1]; exp_continue; }
128	-re ".*  38              " {
129	    if [expr $x == 6] then {
130		pass "$testname: bset/ne r3h, ..."
131	    } else {
132		fail "$testname: bset/ne r3h, ... ($x)"
133	    }
134	}
135        default	{ fail "$testname: bset/ne r3h, ... ($x)" }
136    }
137
138    set x 0
139    expect {
140	-re ".*  39 0088 7171" { set x [expr $x+1]; exp_continue; }
141	-re ".*  40 008a 7D107170" { set x [expr $x+1]; exp_continue; }
142	-re ".*  41 008e 7F127170" { set x [expr $x+1]; exp_continue; }
143	-re ".*  42 0092 6A181234" { set x [expr $x+1]; exp_continue; }
144	-re ".*  42      7170" { set x [expr $x+1]; exp_continue; }
145	-re ".*  43 0098 6A381234" { set x [expr $x+1]; exp_continue; }
146	-re ".*  43      56787170" { set x [expr $x+1]; exp_continue; }
147	-re ".*  44              " {
148	    if [expr $x == 7] then {
149		pass "$testname: bnot #0x7, ..."
150	    } else {
151		fail "$testname: bnot #0x7, ... ($x)"
152	    }
153	}
154        default	{ fail "$testname: bnot #0x7, ... ($x)" }
155    }
156
157    set x 0
158    expect {
159	-re ".*  45 00a0 6131" { set x [expr $x+1]; exp_continue; }
160	-re ".*  46 00a2 7D106130" { set x [expr $x+1]; exp_continue; }
161	-re ".*  47 00a6 7F126130" { set x [expr $x+1]; exp_continue; }
162	-re ".*  48 00aa 6A181234" { set x [expr $x+1]; exp_continue; }
163	-re ".*  48      6130" { set x [expr $x+1]; exp_continue; }
164	-re ".*  49 00b0 6A381234" { set x [expr $x+1]; exp_continue; }
165	-re ".*  49      56786130" { set x [expr $x+1]; exp_continue; }
166	-re ".*  50              " {
167	    if [expr $x == 7] then {
168		pass "$testname: bnot r3h, ..."
169	    } else {
170		fail "$testname: bnot r3h, ... ($x)"
171	    }
172	}
173        default	{ fail "$testname: bnot r3h, ... ($x)" }
174    }
175
176    set x 0
177    expect {
178	-re ".*  51 00b8 7271" { set x [expr $x+1]; exp_continue; }
179	-re ".*  52 00ba 7D107270" { set x [expr $x+1]; exp_continue; }
180	-re ".*  53 00be 7F127270" { set x [expr $x+1]; exp_continue; }
181	-re ".*  54 00c2 6A181234" { set x [expr $x+1]; exp_continue; }
182	-re ".*  54      7270" { set x [expr $x+1]; exp_continue; }
183	-re ".*  55 00c8 6A381234" { set x [expr $x+1]; exp_continue; }
184	-re ".*  55      56787270" { set x [expr $x+1]; exp_continue; }
185	-re ".*  56              " {
186	    if [expr $x == 7] then {
187		pass "$testname: bclr #0x7, ..."
188	    } else {
189		fail "$testname: bclr #0x7, ... ($x)"
190	    }
191	}
192        default	{ fail "$testname: bclr #0x7, ... ($x)" }
193    }
194
195    set x 0
196    expect {
197	-re ".*  57 00d0 6231" { set x [expr $x+1]; exp_continue; }
198	-re ".*  58 00d2 7D106230" { set x [expr $x+1]; exp_continue; }
199	-re ".*  59 00d6 7F126230" { set x [expr $x+1]; exp_continue; }
200	-re ".*  60 00da 6A181234" { set x [expr $x+1]; exp_continue; }
201	-re ".*  60      6230" { set x [expr $x+1]; exp_continue; }
202	-re ".*  61 00e0 6A381234" { set x [expr $x+1]; exp_continue; }
203	-re ".*  61      56786230" { set x [expr $x+1]; exp_continue; }
204	-re ".*  62              " {
205	    if [expr $x == 7] then {
206		pass "$testname: bclr r3h, ..."
207	    } else {
208		fail "$testname: bclr r3h, ... ($x)"
209	    }
210	}
211        default	{ fail "$testname: bclr r3h, ... ($x)" }
212    }
213
214    set x 0
215    expect {
216	-re ".*  63 00e8 7D107277" { set x [expr $x+1]; exp_continue; }
217	-re ".*  64 00ec 7F127277" { set x [expr $x+1]; exp_continue; }
218	-re ".*  65 00f0 6A181234" { set x [expr $x+1]; exp_continue; }
219	-re ".*  65      7277" { set x [expr $x+1]; exp_continue; }
220	-re ".*  66 00f6 6A381234" { set x [expr $x+1]; exp_continue; }
221	-re ".*  66      56787277" { set x [expr $x+1]; exp_continue; }
222	-re ".*  67              " {
223	    if [expr $x == 6] then {
224		pass "$testname: bclr/eq #0x7, ..."
225	    } else {
226		fail "$testname: bclr/eq #0x7, ... ($x)"
227	    }
228	}
229        default	{ fail "$testname: bclr/eq #0x7, ... ($x)" }
230    }
231
232    set x 0
233    expect {
234	-re ".*  68 00fe 7D106237" { set x [expr $x+1]; exp_continue; }
235	-re ".*  69 0102 7F126237" { set x [expr $x+1]; exp_continue; }
236	-re ".*  70 0106 6A181234" { set x [expr $x+1]; exp_continue; }
237	-re ".*  70      6237" { set x [expr $x+1]; exp_continue; }
238	-re ".*  71 010c 6A381234" { set x [expr $x+1]; exp_continue; }
239	-re ".*  71      56786237" { set x [expr $x+1]; exp_continue; }
240	-re ".*  72              " {
241	    if [expr $x == 6] then {
242		pass "$testname: bclr/eq r3h, ..."
243	    } else {
244		fail "$testname: bclr/eq r3h, ... ($x)"
245	    }
246	}
247        default	{ fail "$testname: bclr/eq r3h, ... ($x)" }
248    }
249
250    set x 0
251    expect {
252	-re ".*  73 0114 7D107276" { set x [expr $x+1]; exp_continue; }
253	-re ".*  74 0118 7F127276" { set x [expr $x+1]; exp_continue; }
254	-re ".*  75 011c 6A181234" { set x [expr $x+1]; exp_continue; }
255	-re ".*  75      7276" { set x [expr $x+1]; exp_continue; }
256	-re ".*  76 0122 6A381234" { set x [expr $x+1]; exp_continue; }
257	-re ".*  76      56787276" { set x [expr $x+1]; exp_continue; }
258	-re ".*  77              " {
259	    if [expr $x == 6] then {
260		pass "$testname: bclr/ne #0x7, ..."
261	    } else {
262		fail "$testname: bclr/ne #0x7, ... ($x)"
263	    }
264	}
265        default	{ fail "$testname: bclr/ne #0x7, ... ($x)" }
266    }
267
268    set x 0
269    expect {
270	-re ".*  78 012a 7D106236" { set x [expr $x+1]; exp_continue; }
271	-re ".*  79 012e 7F126236" { set x [expr $x+1]; exp_continue; }
272	-re ".*  80 0132 6A181234" { set x [expr $x+1]; exp_continue; }
273	-re ".*  80      6236" { set x [expr $x+1]; exp_continue; }
274	-re ".*  81 0138 6A381234" { set x [expr $x+1]; exp_continue; }
275	-re ".*  81      56786236" { set x [expr $x+1]; exp_continue; }
276	-re ".*  82              " {
277	    if [expr $x == 6] then {
278		pass "$testname: bclr/ne r3h, ..."
279	    } else {
280		fail "$testname: bclr/ne r3h, ... ($x)"
281	    }
282	}
283        default	{ fail "$testname: bclr/ne r3h, ... ($x)" }
284    }
285
286    set x 0
287    expect {
288	-re ".*  83 0140 7371" { set x [expr $x+1]; exp_continue; }
289	-re ".*  84 0142 7C107370" { set x [expr $x+1]; exp_continue; }
290	-re ".*  85 0146 7E127370" { set x [expr $x+1]; exp_continue; }
291	-re ".*  86 014a 6A101234" { set x [expr $x+1]; exp_continue; }
292	-re ".*  86      7370" { set x [expr $x+1]; exp_continue; }
293	-re ".*  87 0150 6A301234" { set x [expr $x+1]; exp_continue; }
294	-re ".*  87      56787370" { set x [expr $x+1]; exp_continue; }
295	-re ".*  88              " {
296	    if [expr $x == 7] then {
297		pass "$testname: btst #0x7, ..."
298	    } else {
299		fail "$testname: btst #0x7, ... ($x)"
300	    }
301	}
302        default	{ fail "$testname: btst #0x7, ... ($x)" }
303    }
304
305    set x 0
306    expect {
307	-re ".*  89 0158 6331" { set x [expr $x+1]; exp_continue; }
308	-re ".*  90 015a 7C106330" { set x [expr $x+1]; exp_continue; }
309	-re ".*  91 015e 7E126330" { set x [expr $x+1]; exp_continue; }
310	-re ".*  92 0162 6A101234" { set x [expr $x+1]; exp_continue; }
311	-re ".*  92      6330" { set x [expr $x+1]; exp_continue; }
312	-re ".*  93 0168 6A301234" { set x [expr $x+1]; exp_continue; }
313	-re ".*  93      56786330" { set x [expr $x+1]; exp_continue; }
314	-re ".*  94              " {
315	    if [expr $x == 7] then {
316		pass "$testname: btst r3h, ..."
317	    } else {
318		fail "$testname: btst r3h, ... ($x)"
319	    }
320	}
321        default	{ fail "$testname: btst r3h, ... ($x)" }
322    }
323
324    set x 0
325    expect {
326	-re ".*  95 0170 7471" { set x [expr $x+1]; exp_continue; }
327	-re ".*  96 0172 7C107470" { set x [expr $x+1]; exp_continue; }
328	-re ".*  97 0176 7E127470" { set x [expr $x+1]; exp_continue; }
329	-re ".*  98 017a 6A101234" { set x [expr $x+1]; exp_continue; }
330	-re ".*  98      7470" { set x [expr $x+1]; exp_continue; }
331	-re ".*  99 0180 6A301234" { set x [expr $x+1]; exp_continue; }
332	-re ".*  99      56787470" { set x [expr $x+1]; exp_continue; }
333	-re ".* 100              " {
334	    if [expr $x == 7] then {
335		pass "$testname: bor #0x7, ..."
336	    } else {
337		fail "$testname: bor #0x7, ... ($x)"
338	    }
339	}
340        default	{ fail "$testname: bor #0x7, ... ($x)" }
341    }
342
343    set x 0
344    expect {
345	-re ".* 101 0188 74F1" { set x [expr $x+1]; exp_continue; }
346	-re ".* 102 018a 7C1074F0" { set x [expr $x+1]; exp_continue; }
347	-re ".* 103 018e 7E1274F0" { set x [expr $x+1]; exp_continue; }
348	-re ".* 104 0192 6A101234" { set x [expr $x+1]; exp_continue; }
349	-re ".* 104      74F0" { set x [expr $x+1]; exp_continue; }
350	-re ".* 105 0198 6A301234" { set x [expr $x+1]; exp_continue; }
351	-re ".* 105      567874F0" { set x [expr $x+1]; exp_continue; }
352	-re ".* 106              " {
353	    if [expr $x == 7] then {
354		pass "$testname: bior #0x7, ..."
355	    } else {
356		fail "$testname: bior #0x7, ... ($x)"
357	    }
358	}
359        default	{ fail "$testname: bior #0x7, ... ($x)" }
360    }
361
362    set x 0
363    expect {
364	-re ".* 107 01a0 7571" { set x [expr $x+1]; exp_continue; }
365	-re ".* 108 01a2 7C107570" { set x [expr $x+1]; exp_continue; }
366	-re ".* 109 01a6 7E127570" { set x [expr $x+1]; exp_continue; }
367	-re ".* 110 01aa 6A101234" { set x [expr $x+1]; exp_continue; }
368	-re ".* 110      7570" { set x [expr $x+1]; exp_continue; }
369	-re ".* 111 01b0 6A301234" { set x [expr $x+1]; exp_continue; }
370	-re ".* 111      56787570" { set x [expr $x+1]; exp_continue; }
371	-re ".* 112              " {
372	    if [expr $x == 7] then {
373		pass "$testname: bxor #0x7, ..."
374	    } else {
375		fail "$testname: bxor #0x7, ... ($x)"
376	    }
377	}
378        default	{ fail "$testname: bxor #0x7, ... ($x)" }
379    }
380
381    set x 0
382    expect {
383	-re ".* 113 01b8 75F1" { set x [expr $x+1]; exp_continue; }
384	-re ".* 114 01ba 7C1075F0" { set x [expr $x+1]; exp_continue; }
385	-re ".* 115 01be 7E1275F0" { set x [expr $x+1]; exp_continue; }
386	-re ".* 116 01c2 6A101234" { set x [expr $x+1]; exp_continue; }
387	-re ".* 116      75F0" { set x [expr $x+1]; exp_continue; }
388	-re ".* 117 01c8 6A301234" { set x [expr $x+1]; exp_continue; }
389	-re ".* 117      567875F0" { set x [expr $x+1]; exp_continue; }
390	-re ".* 118              " {
391	    if [expr $x == 7] then {
392		pass "$testname: bixor #0x7, ..."
393	    } else {
394		fail "$testname: bixor #0x7, ... ($x)"
395	    }
396	}
397        default	{ fail "$testname: bixor #0x7, ... ($x)" }
398    }
399
400    set x 0
401    expect {
402	-re ".* 119 01d0 7671" { set x [expr $x+1]; exp_continue; }
403	-re ".* 120 01d2 7C107670" { set x [expr $x+1]; exp_continue; }
404	-re ".* 121 01d6 7E127670" { set x [expr $x+1]; exp_continue; }
405	-re ".* 122 01da 6A101234" { set x [expr $x+1]; exp_continue; }
406	-re ".* 122      7670" { set x [expr $x+1]; exp_continue; }
407	-re ".* 123 01e0 6A301234" { set x [expr $x+1]; exp_continue; }
408	-re ".* 123      56787670" { set x [expr $x+1]; exp_continue; }
409	-re ".* 124              " {
410	    if [expr $x == 7] then {
411		pass "$testname: band #0x7, ..."
412	    } else {
413		fail "$testname: band #0x7, ... ($x)"
414	    }
415	}
416        default	{ fail "$testname: band #0x7, ... ($x)" }
417    }
418
419    set x 0
420    expect {
421	-re ".* 125 01e8 76F1" { set x [expr $x+1]; exp_continue; }
422	-re ".* 126 01ea 7C1076F0" { set x [expr $x+1]; exp_continue; }
423	-re ".* 127 01ee 7E1276F0" { set x [expr $x+1]; exp_continue; }
424	-re ".* 128 01f2 6A101234" { set x [expr $x+1]; exp_continue; }
425	-re ".* 128      76F0" { set x [expr $x+1]; exp_continue; }
426	-re ".* 129 01f8 6A301234" { set x [expr $x+1]; exp_continue; }
427	-re ".* 129      567876F0" { set x [expr $x+1]; exp_continue; }
428	-re ".* 130              " {
429	    if [expr $x == 7] then {
430		pass "$testname: biand #0x7, ..."
431	    } else {
432		fail "$testname: biand #0x7, ... ($x)"
433	    }
434	}
435        default	{ fail "$testname: biand #0x7, ... ($x)" }
436    }
437
438    set x 0
439    expect {
440	-re ".* 131 0200 7771" { set x [expr $x+1]; exp_continue; }
441	-re ".* 132 0202 7C107770" { set x [expr $x+1]; exp_continue; }
442	-re ".* 133 0206 7E127770" { set x [expr $x+1]; exp_continue; }
443	-re ".* 134 020a 6A101234" { set x [expr $x+1]; exp_continue; }
444	-re ".* 134      7770" { set x [expr $x+1]; exp_continue; }
445	-re ".* 135 0210 6A301234" { set x [expr $x+1]; exp_continue; }
446	-re ".* 135      56787770" { set x [expr $x+1]; exp_continue; }
447	-re ".* 136              " {
448	    if [expr $x == 7] then {
449		pass "$testname: bld #0x7, ..."
450	    } else {
451		fail "$testname: bld #0x7, ... ($x)"
452	    }
453	}
454        default	{ fail "$testname: bld #0x7, ... ($x)" }
455    }
456
457    set x 0
458    expect {
459	-re ".* 137 0218 77F1" { set x [expr $x+1]; exp_continue; }
460	-re ".* 138 021a 7C1077F0" { set x [expr $x+1]; exp_continue; }
461	-re ".* 139 021e 7E1277F0" { set x [expr $x+1]; exp_continue; }
462	-re ".* 140 0222 6A101234" { set x [expr $x+1]; exp_continue; }
463	-re ".* 140      77F0" { set x [expr $x+1]; exp_continue; }
464	-re ".* 141 0228 6A301234" { set x [expr $x+1]; exp_continue; }
465	-re ".* 141      567877F0" { set x [expr $x+1]; exp_continue; }
466	-re ".* 142              " {
467	    if [expr $x == 7] then {
468		pass "$testname: bild #0x7, ..."
469	    } else {
470		fail "$testname: bild #0x7, ... ($x)"
471	    }
472	}
473        default	{ fail "$testname: bild #0x7, ... ($x)" }
474    }
475
476    set x 0
477    expect {
478	-re ".* 143 0230 6771" { set x [expr $x+1]; exp_continue; }
479	-re ".* 144 0232 7D106770" { set x [expr $x+1]; exp_continue; }
480	-re ".* 145 0236 7F126770" { set x [expr $x+1]; exp_continue; }
481	-re ".* 146 023a 6A181234" { set x [expr $x+1]; exp_continue; }
482	-re ".* 146      6770" { set x [expr $x+1]; exp_continue; }
483	-re ".* 147 0240 6A381234" { set x [expr $x+1]; exp_continue; }
484	-re ".* 147      56786770" { set x [expr $x+1]; exp_continue; }
485	-re ".* 148              " {
486	    if [expr $x == 7] then {
487		pass "$testname: bst #0x7, ..."
488	    } else {
489		fail "$testname: bst #0x7, ... ($x)"
490	    }
491	}
492        default	{ fail "$testname: bst #0x7, ... ($x)" }
493    }
494
495    set x 0
496    expect {
497	-re ".* 149 0248 7D106777" { set x [expr $x+1]; exp_continue; }
498	-re ".* 150 024c 7F126777" { set x [expr $x+1]; exp_continue; }
499	-re ".* 151 0250 6A181234" { set x [expr $x+1]; exp_continue; }
500	-re ".* 151      6777" { set x [expr $x+1]; exp_continue; }
501	-re ".* 152 0256 6A381234" { set x [expr $x+1]; exp_continue; }
502	-re ".* 152      56786777" { set x [expr $x+1]; exp_continue; }
503	-re ".* 153              " {
504	    if [expr $x == 6] then {
505		pass "$testname: bstz #0x7, ..."
506	    } else {
507		fail "$testname: bstz #0x7, ... ($x)"
508	    }
509	}
510        default	{ fail "$testname: bstz #0x7, ... ($x)" }
511    }
512
513    set x 0
514    expect {
515	-re ".* 154 025e 67F1" { set x [expr $x+1]; exp_continue; }
516	-re ".* 155 0260 7D1067F0" { set x [expr $x+1]; exp_continue; }
517	-re ".* 156 0264 7F1267F0" { set x [expr $x+1]; exp_continue; }
518	-re ".* 157 0268 6A181234" { set x [expr $x+1]; exp_continue; }
519	-re ".* 157      67F0" { set x [expr $x+1]; exp_continue; }
520	-re ".* 158 026e 6A381234" { set x [expr $x+1]; exp_continue; }
521	-re ".* 158      567867F0" { set x [expr $x+1]; exp_continue; }
522	-re ".* 159              " {
523	    if [expr $x == 7] then {
524		pass "$testname: bist #0x7, ..."
525	    } else {
526		fail "$testname: bist #0x7, ... ($x)"
527	    }
528	}
529        default	{ fail "$testname: bist #0x7, ... ($x)" }
530    }
531
532    set x 0
533    expect {
534	-re ".* 160 0276 7D1067F7" { set x [expr $x+1]; exp_continue; }
535	-re ".* 161 027a 7F1267F7" { set x [expr $x+1]; exp_continue; }
536	-re ".* 162 027e 6A181234" { set x [expr $x+1]; exp_continue; }
537	-re ".* 162      67F7" { set x [expr $x+1]; exp_continue; }
538	-re ".* 163 0284 6A381234" { set x [expr $x+1]; exp_continue; }
539	-re ".* 163      567867F7" { set x [expr $x+1]; exp_continue; }
540	-re ".* 164              " {
541	    if [expr $x == 6] then {
542		pass "$testname: bistz #0x7, ..."
543	    } else {
544		fail "$testname: bistz #0x7, ... ($x)"
545	    }
546	}
547        default	{ fail "$testname: bistz #0x7, ... ($x)" }
548    }
549
550    set x 0
551    expect {
552	-re ".* 165 028c 7C10F334" { set x [expr $x+1]; exp_continue; }
553	-re ".* 166 0290 7E12F334" { set x [expr $x+1]; exp_continue; }
554	-re ".* 167 0294 6A101234" { set x [expr $x+1]; exp_continue; }
555	-re ".* 167      F334" { set x [expr $x+1]; exp_continue; }
556	-re ".* 168 029a 6A301234" { set x [expr $x+1]; exp_continue; }
557	-re ".* 168      5678F334" { set x [expr $x+1]; exp_continue; }
558	-re ".* 169              " {
559	    if [expr $x == 6] then {
560		pass "$testname: bfld #0x34:8, ..., r3h"
561	    } else {
562		fail "$testname: bfld #0x34:8, ..., r3h ($x)"
563	    }
564	}
565        default	{ fail "$testname: bfld #0x34:8, ..., r3h ($x)" }
566    }
567
568    set x 0
569    expect {
570	-re ".* 170 02a2 7D10F334" { set x [expr $x+1]; exp_continue; }
571	-re ".* 171 02a6 7F12F334" { set x [expr $x+1]; exp_continue; }
572	-re ".* 172 02aa 6A181234" { set x [expr $x+1]; exp_continue; }
573	-re ".* 172      F334" { set x [expr $x+1]; exp_continue; }
574	-re ".* 173 02b0 6A381234" { set x [expr $x+1]; exp_continue; }
575	-re ".* 173      5678F334" { set x [expr $x+1]; exp_continue; }
576	-re ".* 174              " {
577	    if [expr $x == 6] then {
578		pass "$testname: bfst r3h, #0x34:8, ..."
579	    } else {
580		fail "$testname: bfst r3h, #0x34:8, ... ($x)"
581	    }
582	}
583        default	{ fail "$testname: bfst r3h, #0x34:8, ... ($x)" }
584    }
585
586    # This was intended to do any cleanup necessary.
587    # It kinda looks like it isn't needed, but just
588    # in case, please keep it in for now.
589
590    gas_finish
591
592}
593
594if [istarget h8300*-*-elf] then {
595    # Test advanced h8300sx instructions.
596    do_t12_bit_test
597}
598
599