OSDN Git Service

75206ae82687327f2a8e6e1cf034a47cf30cd4b2
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / cgen-cpu / arm7t / thumb-sem.cxx
1 /* Simulator instruction semantics for thumb.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright (C) 2000-2009 Red Hat, Inc.
6
7 This file is part of the Red Hat simulators.
8
9
10 */
11
12
13 #if HAVE_CONFIG_H
14 #include "config.h"
15 #endif
16 #include "arm7f.h"
17
18 using namespace arm7f; // FIXME: namespace organization still wip
19 #define GET_ATTR(name) GET_ATTR_##name ()
20
21
22 // ********** x-invalid: --invalid--
23
24 sem_status
25 thumb_sem_x_invalid (arm7f_cpu* current_cpu, thumb_scache* sem)
26 {
27 #define FLD(f) abuf->fields.fmt_empty.f
28   sem_status status = SEM_STATUS_NORMAL;
29   thumb_scache* abuf = sem;
30   PCADDR pc = abuf->addr;
31   PCADDR npc = pc + 0;
32
33   {
34     current_cpu->invalid_insn (pc);
35     assert (0);
36     /* NOTREACHED */
37   }
38
39   current_cpu->done_insn (npc, status);
40   return status;
41 #undef FLD
42 }
43
44 // ********** lsl: lsl $rd,$rs,#$offset5
45
46 sem_status
47 thumb_sem_lsl (arm7f_cpu* current_cpu, thumb_scache* sem)
48 {
49 #define FLD(f) abuf->fields.sfmt_lsl.f
50   sem_status status = SEM_STATUS_NORMAL;
51   thumb_scache* abuf = sem;
52   PCADDR pc = abuf->addr;
53   PCADDR npc = pc + 2;
54
55 {
56   BI tmp_carry_out;
57   tmp_carry_out = current_cpu->compute_carry_out_immshift (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), SHIFT_TYPE_LSL, FLD (f_offset5), current_cpu->hardware.h_cbit);
58   {
59     SI opval = SLLSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset5));
60     if (UNLIKELY(current_cpu->trace_result_p))
61       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
62     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
63   }
64 {
65 {
66   {
67     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
68     if (UNLIKELY(current_cpu->trace_result_p))
69       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
70     current_cpu->hardware.h_zbit = opval;
71   }
72   {
73     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
74     if (UNLIKELY(current_cpu->trace_result_p))
75       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
76     current_cpu->hardware.h_nbit = opval;
77   }
78 }
79   {
80     BI opval = tmp_carry_out;
81     if (UNLIKELY(current_cpu->trace_result_p))
82       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
83     current_cpu->hardware.h_cbit = opval;
84   }
85 }
86 }
87
88   current_cpu->done_insn (npc, status);
89   return status;
90 #undef FLD
91 }
92
93 // ********** lsr: lsr $rd,$rs,#$offset5
94
95 sem_status
96 thumb_sem_lsr (arm7f_cpu* current_cpu, thumb_scache* sem)
97 {
98 #define FLD(f) abuf->fields.sfmt_lsl.f
99   sem_status status = SEM_STATUS_NORMAL;
100   thumb_scache* abuf = sem;
101   PCADDR pc = abuf->addr;
102   PCADDR npc = pc + 2;
103
104 {
105   BI tmp_carry_out;
106   tmp_carry_out = current_cpu->compute_carry_out_immshift (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), SHIFT_TYPE_LSR, FLD (f_offset5), current_cpu->hardware.h_cbit);
107   {
108     SI opval = SRLSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset5));
109     if (UNLIKELY(current_cpu->trace_result_p))
110       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
111     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
112   }
113 {
114 {
115   {
116     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
117     if (UNLIKELY(current_cpu->trace_result_p))
118       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
119     current_cpu->hardware.h_zbit = opval;
120   }
121   {
122     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
123     if (UNLIKELY(current_cpu->trace_result_p))
124       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
125     current_cpu->hardware.h_nbit = opval;
126   }
127 }
128   {
129     BI opval = tmp_carry_out;
130     if (UNLIKELY(current_cpu->trace_result_p))
131       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
132     current_cpu->hardware.h_cbit = opval;
133   }
134 }
135 }
136
137   current_cpu->done_insn (npc, status);
138   return status;
139 #undef FLD
140 }
141
142 // ********** asr: asr $rd,$rs,#$offset5
143
144 sem_status
145 thumb_sem_asr (arm7f_cpu* current_cpu, thumb_scache* sem)
146 {
147 #define FLD(f) abuf->fields.sfmt_lsl.f
148   sem_status status = SEM_STATUS_NORMAL;
149   thumb_scache* abuf = sem;
150   PCADDR pc = abuf->addr;
151   PCADDR npc = pc + 2;
152
153 {
154   BI tmp_carry_out;
155   tmp_carry_out = current_cpu->compute_carry_out_immshift (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), SHIFT_TYPE_ASR, FLD (f_offset5), current_cpu->hardware.h_cbit);
156   {
157     SI opval = SRASI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset5));
158     if (UNLIKELY(current_cpu->trace_result_p))
159       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
160     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
161   }
162 {
163 {
164   {
165     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
166     if (UNLIKELY(current_cpu->trace_result_p))
167       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
168     current_cpu->hardware.h_zbit = opval;
169   }
170   {
171     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
172     if (UNLIKELY(current_cpu->trace_result_p))
173       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
174     current_cpu->hardware.h_nbit = opval;
175   }
176 }
177   {
178     BI opval = tmp_carry_out;
179     if (UNLIKELY(current_cpu->trace_result_p))
180       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
181     current_cpu->hardware.h_cbit = opval;
182   }
183 }
184 }
185
186   current_cpu->done_insn (npc, status);
187   return status;
188 #undef FLD
189 }
190
191 // ********** add: add $rd,$rs,$rn
192
193 sem_status
194 thumb_sem_add (arm7f_cpu* current_cpu, thumb_scache* sem)
195 {
196 #define FLD(f) abuf->fields.sfmt_add.f
197   sem_status status = SEM_STATUS_NORMAL;
198   thumb_scache* abuf = sem;
199   PCADDR pc = abuf->addr;
200   PCADDR npc = pc + 2;
201
202 {
203 {
204   SI tmp_result;
205   tmp_result = ADDCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)), 0);
206 {
207   {
208     BI opval = EQSI (tmp_result, 0);
209     if (UNLIKELY(current_cpu->trace_result_p))
210       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
211     current_cpu->hardware.h_zbit = opval;
212   }
213   {
214     BI opval = LTSI (tmp_result, 0);
215     if (UNLIKELY(current_cpu->trace_result_p))
216       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
217     current_cpu->hardware.h_nbit = opval;
218   }
219 }
220   {
221     BI opval = ADDCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)), 0);
222     if (UNLIKELY(current_cpu->trace_result_p))
223       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
224     current_cpu->hardware.h_cbit = opval;
225   }
226   {
227     BI opval = ADDOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)), 0);
228     if (UNLIKELY(current_cpu->trace_result_p))
229       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
230     current_cpu->hardware.h_vbit = opval;
231   }
232 }
233   {
234     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)));
235     if (UNLIKELY(current_cpu->trace_result_p))
236       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
237     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
238   }
239 }
240
241   current_cpu->done_insn (npc, status);
242   return status;
243 #undef FLD
244 }
245
246 // ********** addi: add $rd,$rs,#$offset3
247
248 sem_status
249 thumb_sem_addi (arm7f_cpu* current_cpu, thumb_scache* sem)
250 {
251 #define FLD(f) abuf->fields.sfmt_addi.f
252   sem_status status = SEM_STATUS_NORMAL;
253   thumb_scache* abuf = sem;
254   PCADDR pc = abuf->addr;
255   PCADDR npc = pc + 2;
256
257 {
258 {
259   SI tmp_result;
260   tmp_result = ADDCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3), 0);
261 {
262   {
263     BI opval = EQSI (tmp_result, 0);
264     if (UNLIKELY(current_cpu->trace_result_p))
265       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
266     current_cpu->hardware.h_zbit = opval;
267   }
268   {
269     BI opval = LTSI (tmp_result, 0);
270     if (UNLIKELY(current_cpu->trace_result_p))
271       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
272     current_cpu->hardware.h_nbit = opval;
273   }
274 }
275   {
276     BI opval = ADDCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3), 0);
277     if (UNLIKELY(current_cpu->trace_result_p))
278       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
279     current_cpu->hardware.h_cbit = opval;
280   }
281   {
282     BI opval = ADDOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3), 0);
283     if (UNLIKELY(current_cpu->trace_result_p))
284       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
285     current_cpu->hardware.h_vbit = opval;
286   }
287 }
288   {
289     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3));
290     if (UNLIKELY(current_cpu->trace_result_p))
291       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
292     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
293   }
294 }
295
296   current_cpu->done_insn (npc, status);
297   return status;
298 #undef FLD
299 }
300
301 // ********** sub: sub $rd,$rs,$rn
302
303 sem_status
304 thumb_sem_sub (arm7f_cpu* current_cpu, thumb_scache* sem)
305 {
306 #define FLD(f) abuf->fields.sfmt_add.f
307   sem_status status = SEM_STATUS_NORMAL;
308   thumb_scache* abuf = sem;
309   PCADDR pc = abuf->addr;
310   PCADDR npc = pc + 2;
311
312 {
313 {
314   SI tmp_result;
315   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)), 0);
316 {
317   {
318     BI opval = EQSI (tmp_result, 0);
319     if (UNLIKELY(current_cpu->trace_result_p))
320       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
321     current_cpu->hardware.h_zbit = opval;
322   }
323   {
324     BI opval = LTSI (tmp_result, 0);
325     if (UNLIKELY(current_cpu->trace_result_p))
326       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
327     current_cpu->hardware.h_nbit = opval;
328   }
329 }
330   {
331     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)), 0));
332     if (UNLIKELY(current_cpu->trace_result_p))
333       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
334     current_cpu->hardware.h_cbit = opval;
335   }
336   {
337     BI opval = SUBOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)), 0);
338     if (UNLIKELY(current_cpu->trace_result_p))
339       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
340     current_cpu->hardware.h_vbit = opval;
341   }
342 }
343   {
344     SI opval = SUBSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->thumb_h_gr_t_get (FLD (f_rn)));
345     if (UNLIKELY(current_cpu->trace_result_p))
346       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
347     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
348   }
349 }
350
351   current_cpu->done_insn (npc, status);
352   return status;
353 #undef FLD
354 }
355
356 // ********** subi: sub $rd,$rs,#$offset3
357
358 sem_status
359 thumb_sem_subi (arm7f_cpu* current_cpu, thumb_scache* sem)
360 {
361 #define FLD(f) abuf->fields.sfmt_addi.f
362   sem_status status = SEM_STATUS_NORMAL;
363   thumb_scache* abuf = sem;
364   PCADDR pc = abuf->addr;
365   PCADDR npc = pc + 2;
366
367 {
368 {
369   SI tmp_result;
370   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3), 0);
371 {
372   {
373     BI opval = EQSI (tmp_result, 0);
374     if (UNLIKELY(current_cpu->trace_result_p))
375       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
376     current_cpu->hardware.h_zbit = opval;
377   }
378   {
379     BI opval = LTSI (tmp_result, 0);
380     if (UNLIKELY(current_cpu->trace_result_p))
381       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
382     current_cpu->hardware.h_nbit = opval;
383   }
384 }
385   {
386     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3), 0));
387     if (UNLIKELY(current_cpu->trace_result_p))
388       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
389     current_cpu->hardware.h_cbit = opval;
390   }
391   {
392     BI opval = SUBOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3), 0);
393     if (UNLIKELY(current_cpu->trace_result_p))
394       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
395     current_cpu->hardware.h_vbit = opval;
396   }
397 }
398   {
399     SI opval = SUBSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), FLD (f_offset3));
400     if (UNLIKELY(current_cpu->trace_result_p))
401       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
402     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
403   }
404 }
405
406   current_cpu->done_insn (npc, status);
407   return status;
408 #undef FLD
409 }
410
411 // ********** mov: mov ${bit10-rd},#$offset8
412
413 sem_status
414 thumb_sem_mov (arm7f_cpu* current_cpu, thumb_scache* sem)
415 {
416 #define FLD(f) abuf->fields.sfmt_mov.f
417   sem_status status = SEM_STATUS_NORMAL;
418   thumb_scache* abuf = sem;
419   PCADDR pc = abuf->addr;
420   PCADDR npc = pc + 2;
421
422 {
423   {
424     SI opval = FLD (f_offset8);
425     if (UNLIKELY(current_cpu->trace_result_p))
426       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
427     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rd), opval);
428   }
429 {
430   {
431     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), 0);
432     if (UNLIKELY(current_cpu->trace_result_p))
433       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
434     current_cpu->hardware.h_zbit = opval;
435   }
436   {
437     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), 0);
438     if (UNLIKELY(current_cpu->trace_result_p))
439       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
440     current_cpu->hardware.h_nbit = opval;
441   }
442 }
443 }
444
445   current_cpu->done_insn (npc, status);
446   return status;
447 #undef FLD
448 }
449
450 // ********** cmp: cmp ${bit10-rd},#$offset8
451
452 sem_status
453 thumb_sem_cmp (arm7f_cpu* current_cpu, thumb_scache* sem)
454 {
455 #define FLD(f) abuf->fields.sfmt_mov.f
456   sem_status status = SEM_STATUS_NORMAL;
457   thumb_scache* abuf = sem;
458   PCADDR pc = abuf->addr;
459   PCADDR npc = pc + 2;
460
461 {
462   SI tmp_result;
463   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0);
464 {
465   {
466     BI opval = EQSI (tmp_result, 0);
467     if (UNLIKELY(current_cpu->trace_result_p))
468       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
469     current_cpu->hardware.h_zbit = opval;
470   }
471   {
472     BI opval = LTSI (tmp_result, 0);
473     if (UNLIKELY(current_cpu->trace_result_p))
474       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
475     current_cpu->hardware.h_nbit = opval;
476   }
477 }
478   {
479     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0));
480     if (UNLIKELY(current_cpu->trace_result_p))
481       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
482     current_cpu->hardware.h_cbit = opval;
483   }
484   {
485     BI opval = SUBOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0);
486     if (UNLIKELY(current_cpu->trace_result_p))
487       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
488     current_cpu->hardware.h_vbit = opval;
489   }
490 }
491
492   current_cpu->done_insn (npc, status);
493   return status;
494 #undef FLD
495 }
496
497 // ********** addi8: add ${bit10-rd},#$offset8
498
499 sem_status
500 thumb_sem_addi8 (arm7f_cpu* current_cpu, thumb_scache* sem)
501 {
502 #define FLD(f) abuf->fields.sfmt_mov.f
503   sem_status status = SEM_STATUS_NORMAL;
504   thumb_scache* abuf = sem;
505   PCADDR pc = abuf->addr;
506   PCADDR npc = pc + 2;
507
508 {
509 {
510   SI tmp_result;
511   tmp_result = ADDCSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0);
512 {
513   {
514     BI opval = EQSI (tmp_result, 0);
515     if (UNLIKELY(current_cpu->trace_result_p))
516       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
517     current_cpu->hardware.h_zbit = opval;
518   }
519   {
520     BI opval = LTSI (tmp_result, 0);
521     if (UNLIKELY(current_cpu->trace_result_p))
522       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
523     current_cpu->hardware.h_nbit = opval;
524   }
525 }
526   {
527     BI opval = ADDCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0);
528     if (UNLIKELY(current_cpu->trace_result_p))
529       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
530     current_cpu->hardware.h_cbit = opval;
531   }
532   {
533     BI opval = ADDOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0);
534     if (UNLIKELY(current_cpu->trace_result_p))
535       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
536     current_cpu->hardware.h_vbit = opval;
537   }
538 }
539   {
540     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8));
541     if (UNLIKELY(current_cpu->trace_result_p))
542       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
543     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rd), opval);
544   }
545 }
546
547   current_cpu->done_insn (npc, status);
548   return status;
549 #undef FLD
550 }
551
552 // ********** subi8: sub ${bit10-rd},#$offset8
553
554 sem_status
555 thumb_sem_subi8 (arm7f_cpu* current_cpu, thumb_scache* sem)
556 {
557 #define FLD(f) abuf->fields.sfmt_mov.f
558   sem_status status = SEM_STATUS_NORMAL;
559   thumb_scache* abuf = sem;
560   PCADDR pc = abuf->addr;
561   PCADDR npc = pc + 2;
562
563 {
564 {
565   SI tmp_result;
566   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0);
567 {
568   {
569     BI opval = EQSI (tmp_result, 0);
570     if (UNLIKELY(current_cpu->trace_result_p))
571       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
572     current_cpu->hardware.h_zbit = opval;
573   }
574   {
575     BI opval = LTSI (tmp_result, 0);
576     if (UNLIKELY(current_cpu->trace_result_p))
577       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
578     current_cpu->hardware.h_nbit = opval;
579   }
580 }
581   {
582     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0));
583     if (UNLIKELY(current_cpu->trace_result_p))
584       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
585     current_cpu->hardware.h_cbit = opval;
586   }
587   {
588     BI opval = SUBOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8), 0);
589     if (UNLIKELY(current_cpu->trace_result_p))
590       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
591     current_cpu->hardware.h_vbit = opval;
592   }
593 }
594   {
595     SI opval = SUBSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd)), FLD (f_offset8));
596     if (UNLIKELY(current_cpu->trace_result_p))
597       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
598     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rd), opval);
599   }
600 }
601
602   current_cpu->done_insn (npc, status);
603   return status;
604 #undef FLD
605 }
606
607 // ********** alu-and: and $rd,$rs
608
609 sem_status
610 thumb_sem_alu_and (arm7f_cpu* current_cpu, thumb_scache* sem)
611 {
612 #define FLD(f) abuf->fields.sfmt_addi.f
613   sem_status status = SEM_STATUS_NORMAL;
614   thumb_scache* abuf = sem;
615   PCADDR pc = abuf->addr;
616   PCADDR npc = pc + 2;
617
618 {
619   {
620     SI opval = ANDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
621     if (UNLIKELY(current_cpu->trace_result_p))
622       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
623     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
624   }
625 {
626   {
627     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
628     if (UNLIKELY(current_cpu->trace_result_p))
629       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
630     current_cpu->hardware.h_zbit = opval;
631   }
632   {
633     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
634     if (UNLIKELY(current_cpu->trace_result_p))
635       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
636     current_cpu->hardware.h_nbit = opval;
637   }
638 }
639 }
640
641   current_cpu->done_insn (npc, status);
642   return status;
643 #undef FLD
644 }
645
646 // ********** alu-eor: eor $rd,$rs
647
648 sem_status
649 thumb_sem_alu_eor (arm7f_cpu* current_cpu, thumb_scache* sem)
650 {
651 #define FLD(f) abuf->fields.sfmt_addi.f
652   sem_status status = SEM_STATUS_NORMAL;
653   thumb_scache* abuf = sem;
654   PCADDR pc = abuf->addr;
655   PCADDR npc = pc + 2;
656
657 {
658   {
659     SI opval = XORSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
660     if (UNLIKELY(current_cpu->trace_result_p))
661       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
662     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
663   }
664 {
665   {
666     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
667     if (UNLIKELY(current_cpu->trace_result_p))
668       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
669     current_cpu->hardware.h_zbit = opval;
670   }
671   {
672     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
673     if (UNLIKELY(current_cpu->trace_result_p))
674       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
675     current_cpu->hardware.h_nbit = opval;
676   }
677 }
678 }
679
680   current_cpu->done_insn (npc, status);
681   return status;
682 #undef FLD
683 }
684
685 // ********** alu-lsl: lsl $rd,$rs
686
687 sem_status
688 thumb_sem_alu_lsl (arm7f_cpu* current_cpu, thumb_scache* sem)
689 {
690 #define FLD(f) abuf->fields.sfmt_addi.f
691   sem_status status = SEM_STATUS_NORMAL;
692   thumb_scache* abuf = sem;
693   PCADDR pc = abuf->addr;
694   PCADDR npc = pc + 2;
695
696 {
697   BI tmp_carry_out;
698   SI tmp_result;
699   tmp_carry_out = current_cpu->compute_carry_out_regshift (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), SHIFT_TYPE_LSL, current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
700   tmp_result = SLLSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
701   {
702     SI opval = tmp_result;
703     if (UNLIKELY(current_cpu->trace_result_p))
704       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
705     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
706   }
707 {
708 {
709   {
710     BI opval = EQSI (tmp_result, 0);
711     if (UNLIKELY(current_cpu->trace_result_p))
712       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
713     current_cpu->hardware.h_zbit = opval;
714   }
715   {
716     BI opval = LTSI (tmp_result, 0);
717     if (UNLIKELY(current_cpu->trace_result_p))
718       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
719     current_cpu->hardware.h_nbit = opval;
720   }
721 }
722   {
723     BI opval = tmp_carry_out;
724     if (UNLIKELY(current_cpu->trace_result_p))
725       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
726     current_cpu->hardware.h_cbit = opval;
727   }
728 }
729 }
730
731   current_cpu->done_insn (npc, status);
732   return status;
733 #undef FLD
734 }
735
736 // ********** alu-lsr: lsr $rd,$rs
737
738 sem_status
739 thumb_sem_alu_lsr (arm7f_cpu* current_cpu, thumb_scache* sem)
740 {
741 #define FLD(f) abuf->fields.sfmt_addi.f
742   sem_status status = SEM_STATUS_NORMAL;
743   thumb_scache* abuf = sem;
744   PCADDR pc = abuf->addr;
745   PCADDR npc = pc + 2;
746
747 {
748   BI tmp_carry_out;
749   SI tmp_result;
750   tmp_carry_out = current_cpu->compute_carry_out_regshift (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), SHIFT_TYPE_LSR, current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
751   tmp_result = SRLSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
752   {
753     SI opval = tmp_result;
754     if (UNLIKELY(current_cpu->trace_result_p))
755       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
756     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
757   }
758 {
759 {
760   {
761     BI opval = EQSI (tmp_result, 0);
762     if (UNLIKELY(current_cpu->trace_result_p))
763       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
764     current_cpu->hardware.h_zbit = opval;
765   }
766   {
767     BI opval = LTSI (tmp_result, 0);
768     if (UNLIKELY(current_cpu->trace_result_p))
769       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
770     current_cpu->hardware.h_nbit = opval;
771   }
772 }
773   {
774     BI opval = tmp_carry_out;
775     if (UNLIKELY(current_cpu->trace_result_p))
776       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
777     current_cpu->hardware.h_cbit = opval;
778   }
779 }
780 }
781
782   current_cpu->done_insn (npc, status);
783   return status;
784 #undef FLD
785 }
786
787 // ********** alu-asr: asr $rd,$rs
788
789 sem_status
790 thumb_sem_alu_asr (arm7f_cpu* current_cpu, thumb_scache* sem)
791 {
792 #define FLD(f) abuf->fields.sfmt_addi.f
793   sem_status status = SEM_STATUS_NORMAL;
794   thumb_scache* abuf = sem;
795   PCADDR pc = abuf->addr;
796   PCADDR npc = pc + 2;
797
798 {
799   BI tmp_carry_out;
800   SI tmp_result;
801   tmp_carry_out = current_cpu->compute_carry_out_regshift (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), SHIFT_TYPE_ASR, current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
802   tmp_result = SRASI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
803   {
804     SI opval = tmp_result;
805     if (UNLIKELY(current_cpu->trace_result_p))
806       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
807     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
808   }
809 {
810 {
811   {
812     BI opval = EQSI (tmp_result, 0);
813     if (UNLIKELY(current_cpu->trace_result_p))
814       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
815     current_cpu->hardware.h_zbit = opval;
816   }
817   {
818     BI opval = LTSI (tmp_result, 0);
819     if (UNLIKELY(current_cpu->trace_result_p))
820       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
821     current_cpu->hardware.h_nbit = opval;
822   }
823 }
824   {
825     BI opval = tmp_carry_out;
826     if (UNLIKELY(current_cpu->trace_result_p))
827       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
828     current_cpu->hardware.h_cbit = opval;
829   }
830 }
831 }
832
833   current_cpu->done_insn (npc, status);
834   return status;
835 #undef FLD
836 }
837
838 // ********** alu-ror: ror $rd,$rs
839
840 sem_status
841 thumb_sem_alu_ror (arm7f_cpu* current_cpu, thumb_scache* sem)
842 {
843 #define FLD(f) abuf->fields.sfmt_addi.f
844   sem_status status = SEM_STATUS_NORMAL;
845   thumb_scache* abuf = sem;
846   PCADDR pc = abuf->addr;
847   PCADDR npc = pc + 2;
848
849 {
850   BI tmp_carry_out;
851   SI tmp_result;
852   tmp_carry_out = current_cpu->compute_carry_out_regshift (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), SHIFT_TYPE_ROR, current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
853   tmp_result = RORSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
854   {
855     SI opval = tmp_result;
856     if (UNLIKELY(current_cpu->trace_result_p))
857       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
858     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
859   }
860 {
861 {
862   {
863     BI opval = EQSI (tmp_result, 0);
864     if (UNLIKELY(current_cpu->trace_result_p))
865       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
866     current_cpu->hardware.h_zbit = opval;
867   }
868   {
869     BI opval = LTSI (tmp_result, 0);
870     if (UNLIKELY(current_cpu->trace_result_p))
871       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
872     current_cpu->hardware.h_nbit = opval;
873   }
874 }
875   {
876     BI opval = tmp_carry_out;
877     if (UNLIKELY(current_cpu->trace_result_p))
878       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
879     current_cpu->hardware.h_cbit = opval;
880   }
881 }
882 }
883
884   current_cpu->done_insn (npc, status);
885   return status;
886 #undef FLD
887 }
888
889 // ********** alu-adc: adc $rd,$rs
890
891 sem_status
892 thumb_sem_alu_adc (arm7f_cpu* current_cpu, thumb_scache* sem)
893 {
894 #define FLD(f) abuf->fields.sfmt_addi.f
895   sem_status status = SEM_STATUS_NORMAL;
896   thumb_scache* abuf = sem;
897   PCADDR pc = abuf->addr;
898   PCADDR npc = pc + 2;
899
900 {
901   SI tmp_result;
902   tmp_result = ADDCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
903 {
904   SI tmp_result;
905   tmp_result = ADDCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
906 {
907   {
908     BI opval = EQSI (tmp_result, 0);
909     if (UNLIKELY(current_cpu->trace_result_p))
910       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
911     current_cpu->hardware.h_zbit = opval;
912   }
913   {
914     BI opval = LTSI (tmp_result, 0);
915     if (UNLIKELY(current_cpu->trace_result_p))
916       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
917     current_cpu->hardware.h_nbit = opval;
918   }
919 }
920   {
921     BI opval = ADDCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
922     if (UNLIKELY(current_cpu->trace_result_p))
923       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
924     current_cpu->hardware.h_cbit = opval;
925   }
926   {
927     BI opval = ADDOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), current_cpu->hardware.h_cbit);
928     if (UNLIKELY(current_cpu->trace_result_p))
929       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
930     current_cpu->hardware.h_vbit = opval;
931   }
932 }
933   {
934     SI opval = tmp_result;
935     if (UNLIKELY(current_cpu->trace_result_p))
936       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
937     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
938   }
939 }
940
941   current_cpu->done_insn (npc, status);
942   return status;
943 #undef FLD
944 }
945
946 // ********** alu-sbc: sbc $rd,$rs
947
948 sem_status
949 thumb_sem_alu_sbc (arm7f_cpu* current_cpu, thumb_scache* sem)
950 {
951 #define FLD(f) abuf->fields.sfmt_addi.f
952   sem_status status = SEM_STATUS_NORMAL;
953   thumb_scache* abuf = sem;
954   PCADDR pc = abuf->addr;
955   PCADDR npc = pc + 2;
956
957 {
958   SI tmp_result;
959   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), NOTBI (current_cpu->hardware.h_cbit));
960 {
961   SI tmp_result;
962   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), NOTBI (current_cpu->hardware.h_cbit));
963 {
964   {
965     BI opval = EQSI (tmp_result, 0);
966     if (UNLIKELY(current_cpu->trace_result_p))
967       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
968     current_cpu->hardware.h_zbit = opval;
969   }
970   {
971     BI opval = LTSI (tmp_result, 0);
972     if (UNLIKELY(current_cpu->trace_result_p))
973       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
974     current_cpu->hardware.h_nbit = opval;
975   }
976 }
977   {
978     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), NOTBI (current_cpu->hardware.h_cbit)));
979     if (UNLIKELY(current_cpu->trace_result_p))
980       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
981     current_cpu->hardware.h_cbit = opval;
982   }
983   {
984     BI opval = SUBOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), NOTBI (current_cpu->hardware.h_cbit));
985     if (UNLIKELY(current_cpu->trace_result_p))
986       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
987     current_cpu->hardware.h_vbit = opval;
988   }
989 }
990   {
991     SI opval = tmp_result;
992     if (UNLIKELY(current_cpu->trace_result_p))
993       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
994     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
995   }
996 }
997
998   current_cpu->done_insn (npc, status);
999   return status;
1000 #undef FLD
1001 }
1002
1003 // ********** alu-tst: tst $rd,$rs
1004
1005 sem_status
1006 thumb_sem_alu_tst (arm7f_cpu* current_cpu, thumb_scache* sem)
1007 {
1008 #define FLD(f) abuf->fields.sfmt_addi.f
1009   sem_status status = SEM_STATUS_NORMAL;
1010   thumb_scache* abuf = sem;
1011   PCADDR pc = abuf->addr;
1012   PCADDR npc = pc + 2;
1013
1014 {
1015   SI tmp_x;
1016   tmp_x = ANDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
1017 {
1018   {
1019     BI opval = EQSI (tmp_x, 0);
1020     if (UNLIKELY(current_cpu->trace_result_p))
1021       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1022     current_cpu->hardware.h_zbit = opval;
1023   }
1024   {
1025     BI opval = LTSI (tmp_x, 0);
1026     if (UNLIKELY(current_cpu->trace_result_p))
1027       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1028     current_cpu->hardware.h_nbit = opval;
1029   }
1030 }
1031 }
1032
1033   current_cpu->done_insn (npc, status);
1034   return status;
1035 #undef FLD
1036 }
1037
1038 // ********** alu-neg: neg $rd,$rs
1039
1040 sem_status
1041 thumb_sem_alu_neg (arm7f_cpu* current_cpu, thumb_scache* sem)
1042 {
1043 #define FLD(f) abuf->fields.sfmt_addi.f
1044   sem_status status = SEM_STATUS_NORMAL;
1045   thumb_scache* abuf = sem;
1046   PCADDR pc = abuf->addr;
1047   PCADDR npc = pc + 2;
1048
1049 {
1050   SI tmp_result;
1051   tmp_result = NEGSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
1052 {
1053   SI tmp_result;
1054   tmp_result = SUBCSI (0, current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1055 {
1056   {
1057     BI opval = EQSI (tmp_result, 0);
1058     if (UNLIKELY(current_cpu->trace_result_p))
1059       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1060     current_cpu->hardware.h_zbit = opval;
1061   }
1062   {
1063     BI opval = LTSI (tmp_result, 0);
1064     if (UNLIKELY(current_cpu->trace_result_p))
1065       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1066     current_cpu->hardware.h_nbit = opval;
1067   }
1068 }
1069   {
1070     BI opval = NOTBI (SUBCFSI (0, current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0));
1071     if (UNLIKELY(current_cpu->trace_result_p))
1072       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
1073     current_cpu->hardware.h_cbit = opval;
1074   }
1075   {
1076     BI opval = SUBOFSI (0, current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1077     if (UNLIKELY(current_cpu->trace_result_p))
1078       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
1079     current_cpu->hardware.h_vbit = opval;
1080   }
1081 }
1082   {
1083     SI opval = tmp_result;
1084     if (UNLIKELY(current_cpu->trace_result_p))
1085       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1086     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1087   }
1088 }
1089
1090   current_cpu->done_insn (npc, status);
1091   return status;
1092 #undef FLD
1093 }
1094
1095 // ********** alu-cmp: cmp $rd,$rs
1096
1097 sem_status
1098 thumb_sem_alu_cmp (arm7f_cpu* current_cpu, thumb_scache* sem)
1099 {
1100 #define FLD(f) abuf->fields.sfmt_addi.f
1101   sem_status status = SEM_STATUS_NORMAL;
1102   thumb_scache* abuf = sem;
1103   PCADDR pc = abuf->addr;
1104   PCADDR npc = pc + 2;
1105
1106 {
1107   SI tmp_result;
1108   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1109 {
1110   {
1111     BI opval = EQSI (tmp_result, 0);
1112     if (UNLIKELY(current_cpu->trace_result_p))
1113       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1114     current_cpu->hardware.h_zbit = opval;
1115   }
1116   {
1117     BI opval = LTSI (tmp_result, 0);
1118     if (UNLIKELY(current_cpu->trace_result_p))
1119       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1120     current_cpu->hardware.h_nbit = opval;
1121   }
1122 }
1123   {
1124     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0));
1125     if (UNLIKELY(current_cpu->trace_result_p))
1126       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
1127     current_cpu->hardware.h_cbit = opval;
1128   }
1129   {
1130     BI opval = SUBOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1131     if (UNLIKELY(current_cpu->trace_result_p))
1132       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
1133     current_cpu->hardware.h_vbit = opval;
1134   }
1135 }
1136
1137   current_cpu->done_insn (npc, status);
1138   return status;
1139 #undef FLD
1140 }
1141
1142 // ********** alu-cmn: cmn $rd,$rs
1143
1144 sem_status
1145 thumb_sem_alu_cmn (arm7f_cpu* current_cpu, thumb_scache* sem)
1146 {
1147 #define FLD(f) abuf->fields.sfmt_addi.f
1148   sem_status status = SEM_STATUS_NORMAL;
1149   thumb_scache* abuf = sem;
1150   PCADDR pc = abuf->addr;
1151   PCADDR npc = pc + 2;
1152
1153 {
1154   SI tmp_result;
1155   tmp_result = ADDCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1156 {
1157   {
1158     BI opval = EQSI (tmp_result, 0);
1159     if (UNLIKELY(current_cpu->trace_result_p))
1160       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1161     current_cpu->hardware.h_zbit = opval;
1162   }
1163   {
1164     BI opval = LTSI (tmp_result, 0);
1165     if (UNLIKELY(current_cpu->trace_result_p))
1166       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1167     current_cpu->hardware.h_nbit = opval;
1168   }
1169 }
1170   {
1171     BI opval = ADDCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1172     if (UNLIKELY(current_cpu->trace_result_p))
1173       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
1174     current_cpu->hardware.h_cbit = opval;
1175   }
1176   {
1177     BI opval = ADDOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1178     if (UNLIKELY(current_cpu->trace_result_p))
1179       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
1180     current_cpu->hardware.h_vbit = opval;
1181   }
1182 }
1183
1184   current_cpu->done_insn (npc, status);
1185   return status;
1186 #undef FLD
1187 }
1188
1189 // ********** alu-orr: orr $rd,$rs
1190
1191 sem_status
1192 thumb_sem_alu_orr (arm7f_cpu* current_cpu, thumb_scache* sem)
1193 {
1194 #define FLD(f) abuf->fields.sfmt_addi.f
1195   sem_status status = SEM_STATUS_NORMAL;
1196   thumb_scache* abuf = sem;
1197   PCADDR pc = abuf->addr;
1198   PCADDR npc = pc + 2;
1199
1200 {
1201   {
1202     SI opval = ORSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
1203     if (UNLIKELY(current_cpu->trace_result_p))
1204       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1205     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1206   }
1207 {
1208   {
1209     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1210     if (UNLIKELY(current_cpu->trace_result_p))
1211       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1212     current_cpu->hardware.h_zbit = opval;
1213   }
1214   {
1215     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1216     if (UNLIKELY(current_cpu->trace_result_p))
1217       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1218     current_cpu->hardware.h_nbit = opval;
1219   }
1220 }
1221 }
1222
1223   current_cpu->done_insn (npc, status);
1224   return status;
1225 #undef FLD
1226 }
1227
1228 // ********** alu-mul: mul $rd,$rs
1229
1230 sem_status
1231 thumb_sem_alu_mul (arm7f_cpu* current_cpu, thumb_scache* sem)
1232 {
1233 #define FLD(f) abuf->fields.sfmt_addi.f
1234   sem_status status = SEM_STATUS_NORMAL;
1235   thumb_scache* abuf = sem;
1236   PCADDR pc = abuf->addr;
1237   PCADDR npc = pc + 2;
1238
1239 {
1240   {
1241     SI opval = MULSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
1242     if (UNLIKELY(current_cpu->trace_result_p))
1243       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1244     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1245   }
1246 {
1247   {
1248     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1249     if (UNLIKELY(current_cpu->trace_result_p))
1250       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1251     current_cpu->hardware.h_zbit = opval;
1252   }
1253   {
1254     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1255     if (UNLIKELY(current_cpu->trace_result_p))
1256       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1257     current_cpu->hardware.h_nbit = opval;
1258   }
1259 }
1260 }
1261
1262   current_cpu->done_insn (npc, status);
1263   return status;
1264 #undef FLD
1265 }
1266
1267 // ********** alu-bic: bic $rd,$rs
1268
1269 sem_status
1270 thumb_sem_alu_bic (arm7f_cpu* current_cpu, thumb_scache* sem)
1271 {
1272 #define FLD(f) abuf->fields.sfmt_addi.f
1273   sem_status status = SEM_STATUS_NORMAL;
1274   thumb_scache* abuf = sem;
1275   PCADDR pc = abuf->addr;
1276   PCADDR npc = pc + 2;
1277
1278 {
1279   {
1280     SI opval = ANDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), INVSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs))));
1281     if (UNLIKELY(current_cpu->trace_result_p))
1282       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1283     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1284   }
1285 {
1286   {
1287     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1288     if (UNLIKELY(current_cpu->trace_result_p))
1289       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1290     current_cpu->hardware.h_zbit = opval;
1291   }
1292   {
1293     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1294     if (UNLIKELY(current_cpu->trace_result_p))
1295       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1296     current_cpu->hardware.h_nbit = opval;
1297   }
1298 }
1299 }
1300
1301   current_cpu->done_insn (npc, status);
1302   return status;
1303 #undef FLD
1304 }
1305
1306 // ********** alu-mvn: mvn $rd,$rs
1307
1308 sem_status
1309 thumb_sem_alu_mvn (arm7f_cpu* current_cpu, thumb_scache* sem)
1310 {
1311 #define FLD(f) abuf->fields.sfmt_addi.f
1312   sem_status status = SEM_STATUS_NORMAL;
1313   thumb_scache* abuf = sem;
1314   PCADDR pc = abuf->addr;
1315   PCADDR npc = pc + 2;
1316
1317 {
1318   {
1319     SI opval = INVSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
1320     if (UNLIKELY(current_cpu->trace_result_p))
1321       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1322     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1323   }
1324 {
1325   {
1326     BI opval = EQSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1327     if (UNLIKELY(current_cpu->trace_result_p))
1328       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1329     current_cpu->hardware.h_zbit = opval;
1330   }
1331   {
1332     BI opval = LTSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), 0);
1333     if (UNLIKELY(current_cpu->trace_result_p))
1334       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1335     current_cpu->hardware.h_nbit = opval;
1336   }
1337 }
1338 }
1339
1340   current_cpu->done_insn (npc, status);
1341   return status;
1342 #undef FLD
1343 }
1344
1345 // ********** add-rd-hs: add $rd,$hs
1346
1347 sem_status
1348 thumb_sem_add_rd_hs (arm7f_cpu* current_cpu, thumb_scache* sem)
1349 {
1350 #define FLD(f) abuf->fields.sfmt_addi.f
1351   sem_status status = SEM_STATUS_NORMAL;
1352   thumb_scache* abuf = sem;
1353   PCADDR pc = abuf->addr;
1354   PCADDR npc = pc + 2;
1355
1356   {
1357     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)));
1358     if (UNLIKELY(current_cpu->trace_result_p))
1359       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1360     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1361   }
1362
1363   current_cpu->done_insn (npc, status);
1364   return status;
1365 #undef FLD
1366 }
1367
1368 // ********** add-hd-rs: add $hd,$rs
1369
1370 sem_status
1371 thumb_sem_add_hd_rs (arm7f_cpu* current_cpu, thumb_scache* sem)
1372 {
1373 #define FLD(f) abuf->fields.sfmt_addi.f
1374   sem_status status = SEM_STATUS_NORMAL;
1375   thumb_scache* abuf = sem;
1376   PCADDR pc = abuf->addr;
1377   PCADDR npc = pc + 2;
1378
1379 if (EQSI (FLD (f_rd), 7)) {
1380   {
1381     USI opval = ADDSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
1382     if (UNLIKELY(current_cpu->trace_result_p))
1383       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1384     current_cpu->branch (opval, npc, status);
1385   }
1386 } else {
1387   {
1388     SI opval = ADDSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)));
1389     if (UNLIKELY(current_cpu->trace_result_p))
1390       current_cpu->trace_stream << "hiregs" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1391     current_cpu->thumb_h_hiregs_set (FLD (f_rd), opval);
1392   }
1393 }
1394
1395   current_cpu->done_cti_insn (npc, status);
1396   return status;
1397 #undef FLD
1398 }
1399
1400 // ********** add-hd-hs: add $hd,$hs
1401
1402 sem_status
1403 thumb_sem_add_hd_hs (arm7f_cpu* current_cpu, thumb_scache* sem)
1404 {
1405 #define FLD(f) abuf->fields.sfmt_addi.f
1406   sem_status status = SEM_STATUS_NORMAL;
1407   thumb_scache* abuf = sem;
1408   PCADDR pc = abuf->addr;
1409   PCADDR npc = pc + 2;
1410
1411 if (EQSI (FLD (f_rd), 7)) {
1412   {
1413     USI opval = ADDSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)));
1414     if (UNLIKELY(current_cpu->trace_result_p))
1415       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1416     current_cpu->branch (opval, npc, status);
1417   }
1418 } else {
1419   {
1420     SI opval = ADDSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)));
1421     if (UNLIKELY(current_cpu->trace_result_p))
1422       current_cpu->trace_stream << "hiregs" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1423     current_cpu->thumb_h_hiregs_set (FLD (f_rd), opval);
1424   }
1425 }
1426
1427   current_cpu->done_cti_insn (npc, status);
1428   return status;
1429 #undef FLD
1430 }
1431
1432 // ********** cmp-rd-hs: cmp $rd,$hs
1433
1434 sem_status
1435 thumb_sem_cmp_rd_hs (arm7f_cpu* current_cpu, thumb_scache* sem)
1436 {
1437 #define FLD(f) abuf->fields.sfmt_addi.f
1438   sem_status status = SEM_STATUS_NORMAL;
1439   thumb_scache* abuf = sem;
1440   PCADDR pc = abuf->addr;
1441   PCADDR npc = pc + 2;
1442
1443 {
1444   SI tmp_result;
1445   tmp_result = SUBCSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)), 0);
1446 {
1447   {
1448     BI opval = EQSI (tmp_result, 0);
1449     if (UNLIKELY(current_cpu->trace_result_p))
1450       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1451     current_cpu->hardware.h_zbit = opval;
1452   }
1453   {
1454     BI opval = LTSI (tmp_result, 0);
1455     if (UNLIKELY(current_cpu->trace_result_p))
1456       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1457     current_cpu->hardware.h_nbit = opval;
1458   }
1459 }
1460   {
1461     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)), 0));
1462     if (UNLIKELY(current_cpu->trace_result_p))
1463       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
1464     current_cpu->hardware.h_cbit = opval;
1465   }
1466   {
1467     BI opval = SUBOFSI (current_cpu->thumb_h_gr_t_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)), 0);
1468     if (UNLIKELY(current_cpu->trace_result_p))
1469       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
1470     current_cpu->hardware.h_vbit = opval;
1471   }
1472 }
1473
1474   current_cpu->done_insn (npc, status);
1475   return status;
1476 #undef FLD
1477 }
1478
1479 // ********** cmp-hd-rs: cmp $hd,$rs
1480
1481 sem_status
1482 thumb_sem_cmp_hd_rs (arm7f_cpu* current_cpu, thumb_scache* sem)
1483 {
1484 #define FLD(f) abuf->fields.sfmt_addi.f
1485   sem_status status = SEM_STATUS_NORMAL;
1486   thumb_scache* abuf = sem;
1487   PCADDR pc = abuf->addr;
1488   PCADDR npc = pc + 2;
1489
1490 {
1491   SI tmp_result;
1492   tmp_result = SUBCSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1493 {
1494   {
1495     BI opval = EQSI (tmp_result, 0);
1496     if (UNLIKELY(current_cpu->trace_result_p))
1497       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1498     current_cpu->hardware.h_zbit = opval;
1499   }
1500   {
1501     BI opval = LTSI (tmp_result, 0);
1502     if (UNLIKELY(current_cpu->trace_result_p))
1503       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1504     current_cpu->hardware.h_nbit = opval;
1505   }
1506 }
1507   {
1508     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0));
1509     if (UNLIKELY(current_cpu->trace_result_p))
1510       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
1511     current_cpu->hardware.h_cbit = opval;
1512   }
1513   {
1514     BI opval = SUBOFSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 0);
1515     if (UNLIKELY(current_cpu->trace_result_p))
1516       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
1517     current_cpu->hardware.h_vbit = opval;
1518   }
1519 }
1520
1521   current_cpu->done_insn (npc, status);
1522   return status;
1523 #undef FLD
1524 }
1525
1526 // ********** cmp-hd-hs: cmp $hd,$hs
1527
1528 sem_status
1529 thumb_sem_cmp_hd_hs (arm7f_cpu* current_cpu, thumb_scache* sem)
1530 {
1531 #define FLD(f) abuf->fields.sfmt_addi.f
1532   sem_status status = SEM_STATUS_NORMAL;
1533   thumb_scache* abuf = sem;
1534   PCADDR pc = abuf->addr;
1535   PCADDR npc = pc + 2;
1536
1537 {
1538   SI tmp_result;
1539   tmp_result = SUBCSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)), 0);
1540 {
1541   {
1542     BI opval = EQSI (tmp_result, 0);
1543     if (UNLIKELY(current_cpu->trace_result_p))
1544       current_cpu->trace_stream << "zbit" << ":=0x" << hex << opval << dec << "  ";
1545     current_cpu->hardware.h_zbit = opval;
1546   }
1547   {
1548     BI opval = LTSI (tmp_result, 0);
1549     if (UNLIKELY(current_cpu->trace_result_p))
1550       current_cpu->trace_stream << "nbit" << ":=0x" << hex << opval << dec << "  ";
1551     current_cpu->hardware.h_nbit = opval;
1552   }
1553 }
1554   {
1555     BI opval = NOTBI (SUBCFSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)), 0));
1556     if (UNLIKELY(current_cpu->trace_result_p))
1557       current_cpu->trace_stream << "cbit" << ":=0x" << hex << opval << dec << "  ";
1558     current_cpu->hardware.h_cbit = opval;
1559   }
1560   {
1561     BI opval = SUBOFSI (current_cpu->thumb_h_hiregs_get (FLD (f_rd)), current_cpu->thumb_h_hiregs_get (FLD (f_rs)), 0);
1562     if (UNLIKELY(current_cpu->trace_result_p))
1563       current_cpu->trace_stream << "vbit" << ":=0x" << hex << opval << dec << "  ";
1564     current_cpu->hardware.h_vbit = opval;
1565   }
1566 }
1567
1568   current_cpu->done_insn (npc, status);
1569   return status;
1570 #undef FLD
1571 }
1572
1573 // ********** mov-rd-hs: mov $rd,$hs
1574
1575 sem_status
1576 thumb_sem_mov_rd_hs (arm7f_cpu* current_cpu, thumb_scache* sem)
1577 {
1578 #define FLD(f) abuf->fields.sfmt_addi.f
1579   sem_status status = SEM_STATUS_NORMAL;
1580   thumb_scache* abuf = sem;
1581   PCADDR pc = abuf->addr;
1582   PCADDR npc = pc + 2;
1583
1584   {
1585     SI opval = current_cpu->thumb_h_hiregs_get (FLD (f_rs));
1586     if (UNLIKELY(current_cpu->trace_result_p))
1587       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1588     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1589   }
1590
1591   current_cpu->done_insn (npc, status);
1592   return status;
1593 #undef FLD
1594 }
1595
1596 // ********** mov-hd-rs: mov $hd,$rs
1597
1598 sem_status
1599 thumb_sem_mov_hd_rs (arm7f_cpu* current_cpu, thumb_scache* sem)
1600 {
1601 #define FLD(f) abuf->fields.sfmt_addi.f
1602   sem_status status = SEM_STATUS_NORMAL;
1603   thumb_scache* abuf = sem;
1604   PCADDR pc = abuf->addr;
1605   PCADDR npc = pc + 2;
1606
1607 if (EQSI (FLD (f_rd), 7)) {
1608   {
1609     USI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rs));
1610     if (UNLIKELY(current_cpu->trace_result_p))
1611       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1612     current_cpu->branch (opval, npc, status);
1613   }
1614 } else {
1615   {
1616     SI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rs));
1617     if (UNLIKELY(current_cpu->trace_result_p))
1618       current_cpu->trace_stream << "hiregs" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1619     current_cpu->thumb_h_hiregs_set (FLD (f_rd), opval);
1620   }
1621 }
1622
1623   current_cpu->done_cti_insn (npc, status);
1624   return status;
1625 #undef FLD
1626 }
1627
1628 // ********** mov-hd-hs: mov $hd,$hs
1629
1630 sem_status
1631 thumb_sem_mov_hd_hs (arm7f_cpu* current_cpu, thumb_scache* sem)
1632 {
1633 #define FLD(f) abuf->fields.sfmt_addi.f
1634   sem_status status = SEM_STATUS_NORMAL;
1635   thumb_scache* abuf = sem;
1636   PCADDR pc = abuf->addr;
1637   PCADDR npc = pc + 2;
1638
1639 if (EQSI (FLD (f_rd), 7)) {
1640   {
1641     USI opval = current_cpu->thumb_h_hiregs_get (FLD (f_rs));
1642     if (UNLIKELY(current_cpu->trace_result_p))
1643       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1644     current_cpu->branch (opval, npc, status);
1645   }
1646 } else {
1647   {
1648     SI opval = current_cpu->thumb_h_hiregs_get (FLD (f_rs));
1649     if (UNLIKELY(current_cpu->trace_result_p))
1650       current_cpu->trace_stream << "hiregs" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1651     current_cpu->thumb_h_hiregs_set (FLD (f_rd), opval);
1652   }
1653 }
1654
1655   current_cpu->done_cti_insn (npc, status);
1656   return status;
1657 #undef FLD
1658 }
1659
1660 // ********** bx-rs: bx $rs
1661
1662 sem_status
1663 thumb_sem_bx_rs (arm7f_cpu* current_cpu, thumb_scache* sem)
1664 {
1665 #define FLD(f) abuf->fields.sfmt_addi.f
1666   sem_status status = SEM_STATUS_NORMAL;
1667   thumb_scache* abuf = sem;
1668   PCADDR pc = abuf->addr;
1669   PCADDR npc = pc + 2;
1670
1671 {
1672   {
1673     USI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rs));
1674     if (UNLIKELY(current_cpu->trace_result_p))
1675       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1676     current_cpu->branch (opval, npc, status);
1677   }
1678 if (NOTSI (ANDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rs)), 1))) {
1679   {
1680     BI opval = 0;
1681     if (UNLIKELY(current_cpu->trace_result_p))
1682       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1683     current_cpu->h_tbit_set (opval);
1684   }
1685 }
1686 }
1687
1688   current_cpu->done_cti_insn (npc, status);
1689   return status;
1690 #undef FLD
1691 }
1692
1693 // ********** bx-hs: bx $hs
1694
1695 sem_status
1696 thumb_sem_bx_hs (arm7f_cpu* current_cpu, thumb_scache* sem)
1697 {
1698 #define FLD(f) abuf->fields.sfmt_addi.f
1699   sem_status status = SEM_STATUS_NORMAL;
1700   thumb_scache* abuf = sem;
1701   PCADDR pc = abuf->addr;
1702   PCADDR npc = pc + 2;
1703
1704 {
1705   {
1706     USI opval = current_cpu->thumb_h_hiregs_get (FLD (f_rs));
1707     if (UNLIKELY(current_cpu->trace_result_p))
1708       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1709     current_cpu->branch (opval, npc, status);
1710   }
1711 if (NOTSI (ANDSI (current_cpu->thumb_h_hiregs_get (FLD (f_rs)), 1))) {
1712   {
1713     BI opval = 0;
1714     if (UNLIKELY(current_cpu->trace_result_p))
1715       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1716     current_cpu->h_tbit_set (opval);
1717   }
1718 }
1719 }
1720
1721   current_cpu->done_cti_insn (npc, status);
1722   return status;
1723 #undef FLD
1724 }
1725
1726 // ********** ldr-pc: ldr ${bit10-rd},[pc,#$word8]
1727
1728 sem_status
1729 thumb_sem_ldr_pc (arm7f_cpu* current_cpu, thumb_scache* sem)
1730 {
1731 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
1732   sem_status status = SEM_STATUS_NORMAL;
1733   thumb_scache* abuf = sem;
1734   PCADDR pc = abuf->addr;
1735   PCADDR npc = pc + 2;
1736
1737   {
1738     SI opval = current_cpu->GETMEMSI (pc, ADDSI (ANDSI (ADDSI (pc, 4), -4), FLD (f_word8)));
1739     if (UNLIKELY(current_cpu->trace_result_p))
1740       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1741     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rd), opval);
1742   }
1743
1744   current_cpu->done_insn (npc, status);
1745   return status;
1746 #undef FLD
1747 }
1748
1749 // ********** str: str $rd,[$rb,$ro]
1750
1751 sem_status
1752 thumb_sem_str (arm7f_cpu* current_cpu, thumb_scache* sem)
1753 {
1754 #define FLD(f) abuf->fields.sfmt_str.f
1755   sem_status status = SEM_STATUS_NORMAL;
1756   thumb_scache* abuf = sem;
1757   PCADDR pc = abuf->addr;
1758   PCADDR npc = pc + 2;
1759
1760   {
1761     SI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rd));
1762     if (UNLIKELY(current_cpu->trace_result_p))
1763       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro))) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1764     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro))), opval);
1765   }
1766
1767   current_cpu->done_insn (npc, status);
1768   return status;
1769 #undef FLD
1770 }
1771
1772 // ********** strb: strb $rd,[$rb,$ro]
1773
1774 sem_status
1775 thumb_sem_strb (arm7f_cpu* current_cpu, thumb_scache* sem)
1776 {
1777 #define FLD(f) abuf->fields.sfmt_str.f
1778   sem_status status = SEM_STATUS_NORMAL;
1779   thumb_scache* abuf = sem;
1780   PCADDR pc = abuf->addr;
1781   PCADDR npc = pc + 2;
1782
1783   {
1784     QI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rd));
1785     if (UNLIKELY(current_cpu->trace_result_p))
1786       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro))) << dec << ']' << ":=0x" << hex << (SI) opval << dec << "  ";
1787     current_cpu->SETMEMQI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro))), opval);
1788   }
1789
1790   current_cpu->done_insn (npc, status);
1791   return status;
1792 #undef FLD
1793 }
1794
1795 // ********** ldr: ldr $rd,[$rb,$ro]
1796
1797 sem_status
1798 thumb_sem_ldr (arm7f_cpu* current_cpu, thumb_scache* sem)
1799 {
1800 #define FLD(f) abuf->fields.sfmt_str.f
1801   sem_status status = SEM_STATUS_NORMAL;
1802   thumb_scache* abuf = sem;
1803   PCADDR pc = abuf->addr;
1804   PCADDR npc = pc + 2;
1805
1806   {
1807     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro))));
1808     if (UNLIKELY(current_cpu->trace_result_p))
1809       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1810     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1811   }
1812
1813   current_cpu->done_insn (npc, status);
1814   return status;
1815 #undef FLD
1816 }
1817
1818 // ********** ldrb: ldrb $rd,[$rb,$ro]
1819
1820 sem_status
1821 thumb_sem_ldrb (arm7f_cpu* current_cpu, thumb_scache* sem)
1822 {
1823 #define FLD(f) abuf->fields.sfmt_str.f
1824   sem_status status = SEM_STATUS_NORMAL;
1825   thumb_scache* abuf = sem;
1826   PCADDR pc = abuf->addr;
1827   PCADDR npc = pc + 2;
1828
1829   {
1830     SI opval = ZEXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro)))));
1831     if (UNLIKELY(current_cpu->trace_result_p))
1832       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1833     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1834   }
1835
1836   current_cpu->done_insn (npc, status);
1837   return status;
1838 #undef FLD
1839 }
1840
1841 // ********** strh: strh $rd,[$rb,$ro]
1842
1843 sem_status
1844 thumb_sem_strh (arm7f_cpu* current_cpu, thumb_scache* sem)
1845 {
1846 #define FLD(f) abuf->fields.sfmt_str.f
1847   sem_status status = SEM_STATUS_NORMAL;
1848   thumb_scache* abuf = sem;
1849   PCADDR pc = abuf->addr;
1850   PCADDR npc = pc + 2;
1851
1852   {
1853     HI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rd));
1854     if (UNLIKELY(current_cpu->trace_result_p))
1855       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro))) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1856     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro))), opval);
1857   }
1858
1859   current_cpu->done_insn (npc, status);
1860   return status;
1861 #undef FLD
1862 }
1863
1864 // ********** ldrh: ldrh $rd,[$rb,$ro]
1865
1866 sem_status
1867 thumb_sem_ldrh (arm7f_cpu* current_cpu, thumb_scache* sem)
1868 {
1869 #define FLD(f) abuf->fields.sfmt_str.f
1870   sem_status status = SEM_STATUS_NORMAL;
1871   thumb_scache* abuf = sem;
1872   PCADDR pc = abuf->addr;
1873   PCADDR npc = pc + 2;
1874
1875   {
1876     SI opval = ZEXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro)))));
1877     if (UNLIKELY(current_cpu->trace_result_p))
1878       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1879     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1880   }
1881
1882   current_cpu->done_insn (npc, status);
1883   return status;
1884 #undef FLD
1885 }
1886
1887 // ********** ldsb: ldsb $rd,[$rb,$ro]
1888
1889 sem_status
1890 thumb_sem_ldsb (arm7f_cpu* current_cpu, thumb_scache* sem)
1891 {
1892 #define FLD(f) abuf->fields.sfmt_str.f
1893   sem_status status = SEM_STATUS_NORMAL;
1894   thumb_scache* abuf = sem;
1895   PCADDR pc = abuf->addr;
1896   PCADDR npc = pc + 2;
1897
1898   {
1899     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro)))));
1900     if (UNLIKELY(current_cpu->trace_result_p))
1901       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1902     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1903   }
1904
1905   current_cpu->done_insn (npc, status);
1906   return status;
1907 #undef FLD
1908 }
1909
1910 // ********** ldsh: ldsh $rd,[$rb,$ro]
1911
1912 sem_status
1913 thumb_sem_ldsh (arm7f_cpu* current_cpu, thumb_scache* sem)
1914 {
1915 #define FLD(f) abuf->fields.sfmt_str.f
1916   sem_status status = SEM_STATUS_NORMAL;
1917   thumb_scache* abuf = sem;
1918   PCADDR pc = abuf->addr;
1919   PCADDR npc = pc + 2;
1920
1921   {
1922     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), current_cpu->thumb_h_gr_t_get (FLD (f_ro)))));
1923     if (UNLIKELY(current_cpu->trace_result_p))
1924       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1925     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1926   }
1927
1928   current_cpu->done_insn (npc, status);
1929   return status;
1930 #undef FLD
1931 }
1932
1933 // ********** str-imm: str $rd,[$rb,#${offset5-7}]
1934
1935 sem_status
1936 thumb_sem_str_imm (arm7f_cpu* current_cpu, thumb_scache* sem)
1937 {
1938 #define FLD(f) abuf->fields.sfmt_str_imm.f
1939   sem_status status = SEM_STATUS_NORMAL;
1940   thumb_scache* abuf = sem;
1941   PCADDR pc = abuf->addr;
1942   PCADDR npc = pc + 2;
1943
1944   {
1945     SI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rd));
1946     if (UNLIKELY(current_cpu->trace_result_p))
1947       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5_7)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1948     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5_7)), opval);
1949   }
1950
1951   current_cpu->done_insn (npc, status);
1952   return status;
1953 #undef FLD
1954 }
1955
1956 // ********** ldr-imm: ldr $rd,[$rb,#${offset5-7}]
1957
1958 sem_status
1959 thumb_sem_ldr_imm (arm7f_cpu* current_cpu, thumb_scache* sem)
1960 {
1961 #define FLD(f) abuf->fields.sfmt_str_imm.f
1962   sem_status status = SEM_STATUS_NORMAL;
1963   thumb_scache* abuf = sem;
1964   PCADDR pc = abuf->addr;
1965   PCADDR npc = pc + 2;
1966
1967   {
1968     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5_7)));
1969     if (UNLIKELY(current_cpu->trace_result_p))
1970       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
1971     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
1972   }
1973
1974   current_cpu->done_insn (npc, status);
1975   return status;
1976 #undef FLD
1977 }
1978
1979 // ********** strb-imm: strb $rd,[$rb,#$offset5]
1980
1981 sem_status
1982 thumb_sem_strb_imm (arm7f_cpu* current_cpu, thumb_scache* sem)
1983 {
1984 #define FLD(f) abuf->fields.sfmt_strb_imm.f
1985   sem_status status = SEM_STATUS_NORMAL;
1986   thumb_scache* abuf = sem;
1987   PCADDR pc = abuf->addr;
1988   PCADDR npc = pc + 2;
1989
1990   {
1991     QI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rd));
1992     if (UNLIKELY(current_cpu->trace_result_p))
1993       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5)) << dec << ']' << ":=0x" << hex << (SI) opval << dec << "  ";
1994     current_cpu->SETMEMQI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5)), opval);
1995   }
1996
1997   current_cpu->done_insn (npc, status);
1998   return status;
1999 #undef FLD
2000 }
2001
2002 // ********** ldrb-imm: ldrb $rd,[$rb,#$offset5]
2003
2004 sem_status
2005 thumb_sem_ldrb_imm (arm7f_cpu* current_cpu, thumb_scache* sem)
2006 {
2007 #define FLD(f) abuf->fields.sfmt_strb_imm.f
2008   sem_status status = SEM_STATUS_NORMAL;
2009   thumb_scache* abuf = sem;
2010   PCADDR pc = abuf->addr;
2011   PCADDR npc = pc + 2;
2012
2013   {
2014     SI opval = ZEXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5))));
2015     if (UNLIKELY(current_cpu->trace_result_p))
2016       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
2017     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
2018   }
2019
2020   current_cpu->done_insn (npc, status);
2021   return status;
2022 #undef FLD
2023 }
2024
2025 // ********** strh-imm: strh $rd,[$rb,#${offset5-6}]
2026
2027 sem_status
2028 thumb_sem_strh_imm (arm7f_cpu* current_cpu, thumb_scache* sem)
2029 {
2030 #define FLD(f) abuf->fields.sfmt_strh_imm.f
2031   sem_status status = SEM_STATUS_NORMAL;
2032   thumb_scache* abuf = sem;
2033   PCADDR pc = abuf->addr;
2034   PCADDR npc = pc + 2;
2035
2036   {
2037     HI opval = current_cpu->thumb_h_gr_t_get (FLD (f_rd));
2038     if (UNLIKELY(current_cpu->trace_result_p))
2039       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5_6)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2040     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5_6)), opval);
2041   }
2042
2043   current_cpu->done_insn (npc, status);
2044   return status;
2045 #undef FLD
2046 }
2047
2048 // ********** ldrh-imm: ldrh $rd,[$rb,#${offset5-6}]
2049
2050 sem_status
2051 thumb_sem_ldrh_imm (arm7f_cpu* current_cpu, thumb_scache* sem)
2052 {
2053 #define FLD(f) abuf->fields.sfmt_strh_imm.f
2054   sem_status status = SEM_STATUS_NORMAL;
2055   thumb_scache* abuf = sem;
2056   PCADDR pc = abuf->addr;
2057   PCADDR npc = pc + 2;
2058
2059   {
2060     SI opval = ZEXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_rb)), FLD (f_offset5_6))));
2061     if (UNLIKELY(current_cpu->trace_result_p))
2062       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
2063     current_cpu->thumb_h_gr_t_set (FLD (f_rd), opval);
2064   }
2065
2066   current_cpu->done_insn (npc, status);
2067   return status;
2068 #undef FLD
2069 }
2070
2071 // ********** str-sprel: str ${bit10-rd},[sp,#$word8]
2072
2073 sem_status
2074 thumb_sem_str_sprel (arm7f_cpu* current_cpu, thumb_scache* sem)
2075 {
2076 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
2077   sem_status status = SEM_STATUS_NORMAL;
2078   thumb_scache* abuf = sem;
2079   PCADDR pc = abuf->addr;
2080   PCADDR npc = pc + 2;
2081
2082   {
2083     SI opval = current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rd));
2084     if (UNLIKELY(current_cpu->trace_result_p))
2085       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->thumb_h_sp_t_get (), FLD (f_word8)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2086     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->thumb_h_sp_t_get (), FLD (f_word8)), opval);
2087   }
2088
2089   current_cpu->done_insn (npc, status);
2090   return status;
2091 #undef FLD
2092 }
2093
2094 // ********** ldr-sprel: ldr ${bit10-rd},[sp,#$word8]
2095
2096 sem_status
2097 thumb_sem_ldr_sprel (arm7f_cpu* current_cpu, thumb_scache* sem)
2098 {
2099 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
2100   sem_status status = SEM_STATUS_NORMAL;
2101   thumb_scache* abuf = sem;
2102   PCADDR pc = abuf->addr;
2103   PCADDR npc = pc + 2;
2104
2105   {
2106     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->thumb_h_sp_t_get (), FLD (f_word8)));
2107     if (UNLIKELY(current_cpu->trace_result_p))
2108       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
2109     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rd), opval);
2110   }
2111
2112   current_cpu->done_insn (npc, status);
2113   return status;
2114 #undef FLD
2115 }
2116
2117 // ********** lda-pc: add ${bit10-rd},pc,$word8
2118
2119 sem_status
2120 thumb_sem_lda_pc (arm7f_cpu* current_cpu, thumb_scache* sem)
2121 {
2122 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
2123   sem_status status = SEM_STATUS_NORMAL;
2124   thumb_scache* abuf = sem;
2125   PCADDR pc = abuf->addr;
2126   PCADDR npc = pc + 2;
2127
2128   {
2129     SI opval = ADDSI (ANDSI (ADDSI (pc, 4), -4), FLD (f_word8));
2130     if (UNLIKELY(current_cpu->trace_result_p))
2131       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
2132     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rd), opval);
2133   }
2134
2135   current_cpu->done_insn (npc, status);
2136   return status;
2137 #undef FLD
2138 }
2139
2140 // ********** lda-sp: add ${bit10-rd},sp,$word8
2141
2142 sem_status
2143 thumb_sem_lda_sp (arm7f_cpu* current_cpu, thumb_scache* sem)
2144 {
2145 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
2146   sem_status status = SEM_STATUS_NORMAL;
2147   thumb_scache* abuf = sem;
2148   PCADDR pc = abuf->addr;
2149   PCADDR npc = pc + 2;
2150
2151   {
2152     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), FLD (f_word8));
2153     if (UNLIKELY(current_cpu->trace_result_p))
2154       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rd) << ']' << ":=0x" << hex << opval << dec << "  ";
2155     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rd), opval);
2156   }
2157
2158   current_cpu->done_insn (npc, status);
2159   return status;
2160 #undef FLD
2161 }
2162
2163 // ********** add-sp: add sp,#$sword7
2164
2165 sem_status
2166 thumb_sem_add_sp (arm7f_cpu* current_cpu, thumb_scache* sem)
2167 {
2168 #define FLD(f) abuf->fields.sfmt_add_sp.f
2169   sem_status status = SEM_STATUS_NORMAL;
2170   thumb_scache* abuf = sem;
2171   PCADDR pc = abuf->addr;
2172   PCADDR npc = pc + 2;
2173
2174   {
2175     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), FLD (f_sword7));
2176     if (UNLIKELY(current_cpu->trace_result_p))
2177       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2178     current_cpu->thumb_h_sp_t_set (opval);
2179   }
2180
2181   current_cpu->done_insn (npc, status);
2182   return status;
2183 #undef FLD
2184 }
2185
2186 // ********** sub-sp: add sp,#-$sword7
2187
2188 sem_status
2189 thumb_sem_sub_sp (arm7f_cpu* current_cpu, thumb_scache* sem)
2190 {
2191 #define FLD(f) abuf->fields.sfmt_add_sp.f
2192   sem_status status = SEM_STATUS_NORMAL;
2193   thumb_scache* abuf = sem;
2194   PCADDR pc = abuf->addr;
2195   PCADDR npc = pc + 2;
2196
2197   {
2198     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), FLD (f_sword7));
2199     if (UNLIKELY(current_cpu->trace_result_p))
2200       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2201     current_cpu->thumb_h_sp_t_set (opval);
2202   }
2203
2204   current_cpu->done_insn (npc, status);
2205   return status;
2206 #undef FLD
2207 }
2208
2209 // ********** push: push {$rlist}
2210
2211 sem_status
2212 thumb_sem_push (arm7f_cpu* current_cpu, thumb_scache* sem)
2213 {
2214 #define FLD(f) abuf->fields.sfmt_stmia.f
2215   sem_status status = SEM_STATUS_NORMAL;
2216   thumb_scache* abuf = sem;
2217   PCADDR pc = abuf->addr;
2218   PCADDR npc = pc + 2;
2219
2220 {
2221 if (ANDSI (FLD (f_rlist), SLLSI (1, 7))) {
2222 {
2223   {
2224     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2225     if (UNLIKELY(current_cpu->trace_result_p))
2226       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2227     current_cpu->thumb_h_sp_t_set (opval);
2228   }
2229   {
2230     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 7));
2231     if (UNLIKELY(current_cpu->trace_result_p))
2232       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2233     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2234   }
2235 }
2236 }
2237 if (ANDSI (FLD (f_rlist), SLLSI (1, 6))) {
2238 {
2239   {
2240     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2241     if (UNLIKELY(current_cpu->trace_result_p))
2242       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2243     current_cpu->thumb_h_sp_t_set (opval);
2244   }
2245   {
2246     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 6));
2247     if (UNLIKELY(current_cpu->trace_result_p))
2248       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2249     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2250   }
2251 }
2252 }
2253 if (ANDSI (FLD (f_rlist), SLLSI (1, 5))) {
2254 {
2255   {
2256     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2257     if (UNLIKELY(current_cpu->trace_result_p))
2258       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2259     current_cpu->thumb_h_sp_t_set (opval);
2260   }
2261   {
2262     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 5));
2263     if (UNLIKELY(current_cpu->trace_result_p))
2264       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2265     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2266   }
2267 }
2268 }
2269 if (ANDSI (FLD (f_rlist), SLLSI (1, 4))) {
2270 {
2271   {
2272     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2273     if (UNLIKELY(current_cpu->trace_result_p))
2274       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2275     current_cpu->thumb_h_sp_t_set (opval);
2276   }
2277   {
2278     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 4));
2279     if (UNLIKELY(current_cpu->trace_result_p))
2280       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2281     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2282   }
2283 }
2284 }
2285 if (ANDSI (FLD (f_rlist), SLLSI (1, 3))) {
2286 {
2287   {
2288     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2289     if (UNLIKELY(current_cpu->trace_result_p))
2290       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2291     current_cpu->thumb_h_sp_t_set (opval);
2292   }
2293   {
2294     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 3));
2295     if (UNLIKELY(current_cpu->trace_result_p))
2296       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2297     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2298   }
2299 }
2300 }
2301 if (ANDSI (FLD (f_rlist), SLLSI (1, 2))) {
2302 {
2303   {
2304     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2305     if (UNLIKELY(current_cpu->trace_result_p))
2306       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2307     current_cpu->thumb_h_sp_t_set (opval);
2308   }
2309   {
2310     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 2));
2311     if (UNLIKELY(current_cpu->trace_result_p))
2312       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2313     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2314   }
2315 }
2316 }
2317 if (ANDSI (FLD (f_rlist), SLLSI (1, 1))) {
2318 {
2319   {
2320     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2321     if (UNLIKELY(current_cpu->trace_result_p))
2322       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2323     current_cpu->thumb_h_sp_t_set (opval);
2324   }
2325   {
2326     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 1));
2327     if (UNLIKELY(current_cpu->trace_result_p))
2328       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2329     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2330   }
2331 }
2332 }
2333 if (ANDSI (FLD (f_rlist), SLLSI (1, 0))) {
2334 {
2335   {
2336     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2337     if (UNLIKELY(current_cpu->trace_result_p))
2338       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2339     current_cpu->thumb_h_sp_t_set (opval);
2340   }
2341   {
2342     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 0));
2343     if (UNLIKELY(current_cpu->trace_result_p))
2344       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2345     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2346   }
2347 }
2348 }
2349 }
2350
2351   current_cpu->done_insn (npc, status);
2352   return status;
2353 #undef FLD
2354 }
2355
2356 // ********** push-lr: push {${rlist-lr}}
2357
2358 sem_status
2359 thumb_sem_push_lr (arm7f_cpu* current_cpu, thumb_scache* sem)
2360 {
2361 #define FLD(f) abuf->fields.sfmt_stmia.f
2362   sem_status status = SEM_STATUS_NORMAL;
2363   thumb_scache* abuf = sem;
2364   PCADDR pc = abuf->addr;
2365   PCADDR npc = pc + 2;
2366
2367 {
2368   {
2369     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2370     if (UNLIKELY(current_cpu->trace_result_p))
2371       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2372     current_cpu->thumb_h_sp_t_set (opval);
2373   }
2374   {
2375     SI opval = current_cpu->thumb_h_lr_t_get ();
2376     if (UNLIKELY(current_cpu->trace_result_p))
2377       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2378     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2379   }
2380 if (ANDSI (FLD (f_rlist), SLLSI (1, 7))) {
2381 {
2382   {
2383     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2384     if (UNLIKELY(current_cpu->trace_result_p))
2385       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2386     current_cpu->thumb_h_sp_t_set (opval);
2387   }
2388   {
2389     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 7));
2390     if (UNLIKELY(current_cpu->trace_result_p))
2391       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2392     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2393   }
2394 }
2395 }
2396 if (ANDSI (FLD (f_rlist), SLLSI (1, 6))) {
2397 {
2398   {
2399     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2400     if (UNLIKELY(current_cpu->trace_result_p))
2401       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2402     current_cpu->thumb_h_sp_t_set (opval);
2403   }
2404   {
2405     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 6));
2406     if (UNLIKELY(current_cpu->trace_result_p))
2407       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2408     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2409   }
2410 }
2411 }
2412 if (ANDSI (FLD (f_rlist), SLLSI (1, 5))) {
2413 {
2414   {
2415     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2416     if (UNLIKELY(current_cpu->trace_result_p))
2417       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2418     current_cpu->thumb_h_sp_t_set (opval);
2419   }
2420   {
2421     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 5));
2422     if (UNLIKELY(current_cpu->trace_result_p))
2423       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2424     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2425   }
2426 }
2427 }
2428 if (ANDSI (FLD (f_rlist), SLLSI (1, 4))) {
2429 {
2430   {
2431     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2432     if (UNLIKELY(current_cpu->trace_result_p))
2433       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2434     current_cpu->thumb_h_sp_t_set (opval);
2435   }
2436   {
2437     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 4));
2438     if (UNLIKELY(current_cpu->trace_result_p))
2439       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2440     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2441   }
2442 }
2443 }
2444 if (ANDSI (FLD (f_rlist), SLLSI (1, 3))) {
2445 {
2446   {
2447     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2448     if (UNLIKELY(current_cpu->trace_result_p))
2449       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2450     current_cpu->thumb_h_sp_t_set (opval);
2451   }
2452   {
2453     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 3));
2454     if (UNLIKELY(current_cpu->trace_result_p))
2455       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2456     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2457   }
2458 }
2459 }
2460 if (ANDSI (FLD (f_rlist), SLLSI (1, 2))) {
2461 {
2462   {
2463     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2464     if (UNLIKELY(current_cpu->trace_result_p))
2465       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2466     current_cpu->thumb_h_sp_t_set (opval);
2467   }
2468   {
2469     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 2));
2470     if (UNLIKELY(current_cpu->trace_result_p))
2471       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2472     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2473   }
2474 }
2475 }
2476 if (ANDSI (FLD (f_rlist), SLLSI (1, 1))) {
2477 {
2478   {
2479     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2480     if (UNLIKELY(current_cpu->trace_result_p))
2481       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2482     current_cpu->thumb_h_sp_t_set (opval);
2483   }
2484   {
2485     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 1));
2486     if (UNLIKELY(current_cpu->trace_result_p))
2487       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2488     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2489   }
2490 }
2491 }
2492 if (ANDSI (FLD (f_rlist), SLLSI (1, 0))) {
2493 {
2494   {
2495     SI opval = SUBSI (current_cpu->thumb_h_sp_t_get (), 4);
2496     if (UNLIKELY(current_cpu->trace_result_p))
2497       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2498     current_cpu->thumb_h_sp_t_set (opval);
2499   }
2500   {
2501     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 0));
2502     if (UNLIKELY(current_cpu->trace_result_p))
2503       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_sp_t_get () << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2504     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_sp_t_get (), opval);
2505   }
2506 }
2507 }
2508 }
2509
2510   current_cpu->done_insn (npc, status);
2511   return status;
2512 #undef FLD
2513 }
2514
2515 // ********** pop: pop {$rlist}
2516
2517 sem_status
2518 thumb_sem_pop (arm7f_cpu* current_cpu, thumb_scache* sem)
2519 {
2520 #define FLD(f) abuf->fields.sfmt_stmia.f
2521   sem_status status = SEM_STATUS_NORMAL;
2522   thumb_scache* abuf = sem;
2523   PCADDR pc = abuf->addr;
2524   PCADDR npc = pc + 2;
2525
2526 {
2527 if (ANDSI (FLD (f_rlist), SLLSI (1, 0))) {
2528 {
2529   {
2530     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2531     if (UNLIKELY(current_cpu->trace_result_p))
2532       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2533     current_cpu->thumb_h_gr_t_set (((UINT) 0), opval);
2534   }
2535   {
2536     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2537     if (UNLIKELY(current_cpu->trace_result_p))
2538       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2539     current_cpu->thumb_h_sp_t_set (opval);
2540   }
2541 }
2542 }
2543 if (ANDSI (FLD (f_rlist), SLLSI (1, 1))) {
2544 {
2545   {
2546     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2547     if (UNLIKELY(current_cpu->trace_result_p))
2548       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 1) << ']' << ":=0x" << hex << opval << dec << "  ";
2549     current_cpu->thumb_h_gr_t_set (((UINT) 1), opval);
2550   }
2551   {
2552     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2553     if (UNLIKELY(current_cpu->trace_result_p))
2554       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2555     current_cpu->thumb_h_sp_t_set (opval);
2556   }
2557 }
2558 }
2559 if (ANDSI (FLD (f_rlist), SLLSI (1, 2))) {
2560 {
2561   {
2562     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2563     if (UNLIKELY(current_cpu->trace_result_p))
2564       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 2) << ']' << ":=0x" << hex << opval << dec << "  ";
2565     current_cpu->thumb_h_gr_t_set (((UINT) 2), opval);
2566   }
2567   {
2568     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2569     if (UNLIKELY(current_cpu->trace_result_p))
2570       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2571     current_cpu->thumb_h_sp_t_set (opval);
2572   }
2573 }
2574 }
2575 if (ANDSI (FLD (f_rlist), SLLSI (1, 3))) {
2576 {
2577   {
2578     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2579     if (UNLIKELY(current_cpu->trace_result_p))
2580       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 3) << ']' << ":=0x" << hex << opval << dec << "  ";
2581     current_cpu->thumb_h_gr_t_set (((UINT) 3), opval);
2582   }
2583   {
2584     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2585     if (UNLIKELY(current_cpu->trace_result_p))
2586       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2587     current_cpu->thumb_h_sp_t_set (opval);
2588   }
2589 }
2590 }
2591 if (ANDSI (FLD (f_rlist), SLLSI (1, 4))) {
2592 {
2593   {
2594     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2595     if (UNLIKELY(current_cpu->trace_result_p))
2596       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 4) << ']' << ":=0x" << hex << opval << dec << "  ";
2597     current_cpu->thumb_h_gr_t_set (((UINT) 4), opval);
2598   }
2599   {
2600     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2601     if (UNLIKELY(current_cpu->trace_result_p))
2602       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2603     current_cpu->thumb_h_sp_t_set (opval);
2604   }
2605 }
2606 }
2607 if (ANDSI (FLD (f_rlist), SLLSI (1, 5))) {
2608 {
2609   {
2610     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2611     if (UNLIKELY(current_cpu->trace_result_p))
2612       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 5) << ']' << ":=0x" << hex << opval << dec << "  ";
2613     current_cpu->thumb_h_gr_t_set (((UINT) 5), opval);
2614   }
2615   {
2616     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2617     if (UNLIKELY(current_cpu->trace_result_p))
2618       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2619     current_cpu->thumb_h_sp_t_set (opval);
2620   }
2621 }
2622 }
2623 if (ANDSI (FLD (f_rlist), SLLSI (1, 6))) {
2624 {
2625   {
2626     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2627     if (UNLIKELY(current_cpu->trace_result_p))
2628       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 6) << ']' << ":=0x" << hex << opval << dec << "  ";
2629     current_cpu->thumb_h_gr_t_set (((UINT) 6), opval);
2630   }
2631   {
2632     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2633     if (UNLIKELY(current_cpu->trace_result_p))
2634       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2635     current_cpu->thumb_h_sp_t_set (opval);
2636   }
2637 }
2638 }
2639 if (ANDSI (FLD (f_rlist), SLLSI (1, 7))) {
2640 {
2641   {
2642     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2643     if (UNLIKELY(current_cpu->trace_result_p))
2644       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 7) << ']' << ":=0x" << hex << opval << dec << "  ";
2645     current_cpu->thumb_h_gr_t_set (((UINT) 7), opval);
2646   }
2647   {
2648     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2649     if (UNLIKELY(current_cpu->trace_result_p))
2650       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2651     current_cpu->thumb_h_sp_t_set (opval);
2652   }
2653 }
2654 }
2655 }
2656
2657   current_cpu->done_insn (npc, status);
2658   return status;
2659 #undef FLD
2660 }
2661
2662 // ********** pop-pc: pop {${rlist-pc}}
2663
2664 sem_status
2665 thumb_sem_pop_pc (arm7f_cpu* current_cpu, thumb_scache* sem)
2666 {
2667 #define FLD(f) abuf->fields.sfmt_stmia.f
2668   sem_status status = SEM_STATUS_NORMAL;
2669   thumb_scache* abuf = sem;
2670   PCADDR pc = abuf->addr;
2671   PCADDR npc = pc + 2;
2672
2673 {
2674 if (ANDSI (FLD (f_rlist), SLLSI (1, 0))) {
2675 {
2676   {
2677     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2678     if (UNLIKELY(current_cpu->trace_result_p))
2679       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2680     current_cpu->thumb_h_gr_t_set (((UINT) 0), opval);
2681   }
2682   {
2683     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2684     if (UNLIKELY(current_cpu->trace_result_p))
2685       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2686     current_cpu->thumb_h_sp_t_set (opval);
2687   }
2688 }
2689 }
2690 if (ANDSI (FLD (f_rlist), SLLSI (1, 1))) {
2691 {
2692   {
2693     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2694     if (UNLIKELY(current_cpu->trace_result_p))
2695       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 1) << ']' << ":=0x" << hex << opval << dec << "  ";
2696     current_cpu->thumb_h_gr_t_set (((UINT) 1), opval);
2697   }
2698   {
2699     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2700     if (UNLIKELY(current_cpu->trace_result_p))
2701       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2702     current_cpu->thumb_h_sp_t_set (opval);
2703   }
2704 }
2705 }
2706 if (ANDSI (FLD (f_rlist), SLLSI (1, 2))) {
2707 {
2708   {
2709     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2710     if (UNLIKELY(current_cpu->trace_result_p))
2711       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 2) << ']' << ":=0x" << hex << opval << dec << "  ";
2712     current_cpu->thumb_h_gr_t_set (((UINT) 2), opval);
2713   }
2714   {
2715     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2716     if (UNLIKELY(current_cpu->trace_result_p))
2717       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2718     current_cpu->thumb_h_sp_t_set (opval);
2719   }
2720 }
2721 }
2722 if (ANDSI (FLD (f_rlist), SLLSI (1, 3))) {
2723 {
2724   {
2725     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2726     if (UNLIKELY(current_cpu->trace_result_p))
2727       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 3) << ']' << ":=0x" << hex << opval << dec << "  ";
2728     current_cpu->thumb_h_gr_t_set (((UINT) 3), opval);
2729   }
2730   {
2731     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2732     if (UNLIKELY(current_cpu->trace_result_p))
2733       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2734     current_cpu->thumb_h_sp_t_set (opval);
2735   }
2736 }
2737 }
2738 if (ANDSI (FLD (f_rlist), SLLSI (1, 4))) {
2739 {
2740   {
2741     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2742     if (UNLIKELY(current_cpu->trace_result_p))
2743       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 4) << ']' << ":=0x" << hex << opval << dec << "  ";
2744     current_cpu->thumb_h_gr_t_set (((UINT) 4), opval);
2745   }
2746   {
2747     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2748     if (UNLIKELY(current_cpu->trace_result_p))
2749       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2750     current_cpu->thumb_h_sp_t_set (opval);
2751   }
2752 }
2753 }
2754 if (ANDSI (FLD (f_rlist), SLLSI (1, 5))) {
2755 {
2756   {
2757     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2758     if (UNLIKELY(current_cpu->trace_result_p))
2759       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 5) << ']' << ":=0x" << hex << opval << dec << "  ";
2760     current_cpu->thumb_h_gr_t_set (((UINT) 5), opval);
2761   }
2762   {
2763     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2764     if (UNLIKELY(current_cpu->trace_result_p))
2765       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2766     current_cpu->thumb_h_sp_t_set (opval);
2767   }
2768 }
2769 }
2770 if (ANDSI (FLD (f_rlist), SLLSI (1, 6))) {
2771 {
2772   {
2773     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2774     if (UNLIKELY(current_cpu->trace_result_p))
2775       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 6) << ']' << ":=0x" << hex << opval << dec << "  ";
2776     current_cpu->thumb_h_gr_t_set (((UINT) 6), opval);
2777   }
2778   {
2779     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2780     if (UNLIKELY(current_cpu->trace_result_p))
2781       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2782     current_cpu->thumb_h_sp_t_set (opval);
2783   }
2784 }
2785 }
2786 if (ANDSI (FLD (f_rlist), SLLSI (1, 7))) {
2787 {
2788   {
2789     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2790     if (UNLIKELY(current_cpu->trace_result_p))
2791       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 7) << ']' << ":=0x" << hex << opval << dec << "  ";
2792     current_cpu->thumb_h_gr_t_set (((UINT) 7), opval);
2793   }
2794   {
2795     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2796     if (UNLIKELY(current_cpu->trace_result_p))
2797       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2798     current_cpu->thumb_h_sp_t_set (opval);
2799   }
2800 }
2801 }
2802   {
2803     USI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_sp_t_get ());
2804     if (UNLIKELY(current_cpu->trace_result_p))
2805       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
2806     current_cpu->branch (opval, npc, status);
2807   }
2808   {
2809     SI opval = ADDSI (current_cpu->thumb_h_sp_t_get (), 4);
2810     if (UNLIKELY(current_cpu->trace_result_p))
2811       current_cpu->trace_stream << "sp-t" << ":=0x" << hex << opval << dec << "  ";
2812     current_cpu->thumb_h_sp_t_set (opval);
2813   }
2814 }
2815
2816   current_cpu->done_cti_insn (npc, status);
2817   return status;
2818 #undef FLD
2819 }
2820
2821 // ********** stmia: stmia $rb!,{$rlist}
2822
2823 sem_status
2824 thumb_sem_stmia (arm7f_cpu* current_cpu, thumb_scache* sem)
2825 {
2826 #define FLD(f) abuf->fields.sfmt_stmia.f
2827   sem_status status = SEM_STATUS_NORMAL;
2828   thumb_scache* abuf = sem;
2829   PCADDR pc = abuf->addr;
2830   PCADDR npc = pc + 2;
2831
2832 {
2833 if (ANDSI (FLD (f_rlist), SLLSI (1, 0))) {
2834 {
2835   {
2836     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 0));
2837     if (UNLIKELY(current_cpu->trace_result_p))
2838       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2839     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2840   }
2841   {
2842     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2843     if (UNLIKELY(current_cpu->trace_result_p))
2844       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2845     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2846   }
2847 }
2848 }
2849 if (ANDSI (FLD (f_rlist), SLLSI (1, 1))) {
2850 {
2851   {
2852     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 1));
2853     if (UNLIKELY(current_cpu->trace_result_p))
2854       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2855     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2856   }
2857   {
2858     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2859     if (UNLIKELY(current_cpu->trace_result_p))
2860       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2861     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2862   }
2863 }
2864 }
2865 if (ANDSI (FLD (f_rlist), SLLSI (1, 2))) {
2866 {
2867   {
2868     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 2));
2869     if (UNLIKELY(current_cpu->trace_result_p))
2870       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2871     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2872   }
2873   {
2874     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2875     if (UNLIKELY(current_cpu->trace_result_p))
2876       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2877     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2878   }
2879 }
2880 }
2881 if (ANDSI (FLD (f_rlist), SLLSI (1, 3))) {
2882 {
2883   {
2884     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 3));
2885     if (UNLIKELY(current_cpu->trace_result_p))
2886       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2887     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2888   }
2889   {
2890     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2891     if (UNLIKELY(current_cpu->trace_result_p))
2892       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2893     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2894   }
2895 }
2896 }
2897 if (ANDSI (FLD (f_rlist), SLLSI (1, 4))) {
2898 {
2899   {
2900     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 4));
2901     if (UNLIKELY(current_cpu->trace_result_p))
2902       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2903     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2904   }
2905   {
2906     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2907     if (UNLIKELY(current_cpu->trace_result_p))
2908       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2909     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2910   }
2911 }
2912 }
2913 if (ANDSI (FLD (f_rlist), SLLSI (1, 5))) {
2914 {
2915   {
2916     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 5));
2917     if (UNLIKELY(current_cpu->trace_result_p))
2918       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2919     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2920   }
2921   {
2922     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2923     if (UNLIKELY(current_cpu->trace_result_p))
2924       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2925     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2926   }
2927 }
2928 }
2929 if (ANDSI (FLD (f_rlist), SLLSI (1, 6))) {
2930 {
2931   {
2932     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 6));
2933     if (UNLIKELY(current_cpu->trace_result_p))
2934       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2935     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2936   }
2937   {
2938     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2939     if (UNLIKELY(current_cpu->trace_result_p))
2940       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2941     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2942   }
2943 }
2944 }
2945 if (ANDSI (FLD (f_rlist), SLLSI (1, 7))) {
2946 {
2947   {
2948     SI opval = current_cpu->thumb_h_gr_t_get (((UINT) 7));
2949     if (UNLIKELY(current_cpu->trace_result_p))
2950       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2951     current_cpu->SETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), opval);
2952   }
2953   {
2954     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2955     if (UNLIKELY(current_cpu->trace_result_p))
2956       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2957     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2958   }
2959 }
2960 }
2961 }
2962
2963   current_cpu->done_insn (npc, status);
2964   return status;
2965 #undef FLD
2966 }
2967
2968 // ********** ldmia: ldmia $rb!,{$rlist}
2969
2970 sem_status
2971 thumb_sem_ldmia (arm7f_cpu* current_cpu, thumb_scache* sem)
2972 {
2973 #define FLD(f) abuf->fields.sfmt_stmia.f
2974   sem_status status = SEM_STATUS_NORMAL;
2975   thumb_scache* abuf = sem;
2976   PCADDR pc = abuf->addr;
2977   PCADDR npc = pc + 2;
2978
2979 {
2980 if (ANDSI (FLD (f_rlist), SLLSI (1, 0))) {
2981 {
2982   {
2983     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
2984     if (UNLIKELY(current_cpu->trace_result_p))
2985       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2986     current_cpu->thumb_h_gr_t_set (((UINT) 0), opval);
2987   }
2988   {
2989     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
2990     if (UNLIKELY(current_cpu->trace_result_p))
2991       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
2992     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
2993   }
2994 }
2995 }
2996 if (ANDSI (FLD (f_rlist), SLLSI (1, 1))) {
2997 {
2998   {
2999     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
3000     if (UNLIKELY(current_cpu->trace_result_p))
3001       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 1) << ']' << ":=0x" << hex << opval << dec << "  ";
3002     current_cpu->thumb_h_gr_t_set (((UINT) 1), opval);
3003   }
3004   {
3005     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
3006     if (UNLIKELY(current_cpu->trace_result_p))
3007       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
3008     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
3009   }
3010 }
3011 }
3012 if (ANDSI (FLD (f_rlist), SLLSI (1, 2))) {
3013 {
3014   {
3015     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
3016     if (UNLIKELY(current_cpu->trace_result_p))
3017       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 2) << ']' << ":=0x" << hex << opval << dec << "  ";
3018     current_cpu->thumb_h_gr_t_set (((UINT) 2), opval);
3019   }
3020   {
3021     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
3022     if (UNLIKELY(current_cpu->trace_result_p))
3023       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
3024     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
3025   }
3026 }
3027 }
3028 if (ANDSI (FLD (f_rlist), SLLSI (1, 3))) {
3029 {
3030   {
3031     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
3032     if (UNLIKELY(current_cpu->trace_result_p))
3033       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 3) << ']' << ":=0x" << hex << opval << dec << "  ";
3034     current_cpu->thumb_h_gr_t_set (((UINT) 3), opval);
3035   }
3036   {
3037     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
3038     if (UNLIKELY(current_cpu->trace_result_p))
3039       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
3040     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
3041   }
3042 }
3043 }
3044 if (ANDSI (FLD (f_rlist), SLLSI (1, 4))) {
3045 {
3046   {
3047     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
3048     if (UNLIKELY(current_cpu->trace_result_p))
3049       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 4) << ']' << ":=0x" << hex << opval << dec << "  ";
3050     current_cpu->thumb_h_gr_t_set (((UINT) 4), opval);
3051   }
3052   {
3053     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
3054     if (UNLIKELY(current_cpu->trace_result_p))
3055       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
3056     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
3057   }
3058 }
3059 }
3060 if (ANDSI (FLD (f_rlist), SLLSI (1, 5))) {
3061 {
3062   {
3063     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
3064     if (UNLIKELY(current_cpu->trace_result_p))
3065       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 5) << ']' << ":=0x" << hex << opval << dec << "  ";
3066     current_cpu->thumb_h_gr_t_set (((UINT) 5), opval);
3067   }
3068   {
3069     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
3070     if (UNLIKELY(current_cpu->trace_result_p))
3071       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
3072     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
3073   }
3074 }
3075 }
3076 if (ANDSI (FLD (f_rlist), SLLSI (1, 6))) {
3077 {
3078   {
3079     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
3080     if (UNLIKELY(current_cpu->trace_result_p))
3081       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 6) << ']' << ":=0x" << hex << opval << dec << "  ";
3082     current_cpu->thumb_h_gr_t_set (((UINT) 6), opval);
3083   }
3084   {
3085     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
3086     if (UNLIKELY(current_cpu->trace_result_p))
3087       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
3088     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
3089   }
3090 }
3091 }
3092 if (ANDSI (FLD (f_rlist), SLLSI (1, 7))) {
3093 {
3094   {
3095     SI opval = current_cpu->GETMEMSI (pc, current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)));
3096     if (UNLIKELY(current_cpu->trace_result_p))
3097       current_cpu->trace_stream << "gr-t" << '[' << ((UINT) 7) << ']' << ":=0x" << hex << opval << dec << "  ";
3098     current_cpu->thumb_h_gr_t_set (((UINT) 7), opval);
3099   }
3100   {
3101     SI opval = ADDSI (current_cpu->thumb_h_gr_t_get (FLD (f_bit10_rb)), 4);
3102     if (UNLIKELY(current_cpu->trace_result_p))
3103       current_cpu->trace_stream << "gr-t" << '[' << FLD (f_bit10_rb) << ']' << ":=0x" << hex << opval << dec << "  ";
3104     current_cpu->thumb_h_gr_t_set (FLD (f_bit10_rb), opval);
3105   }
3106 }
3107 }
3108 }
3109
3110   current_cpu->done_insn (npc, status);
3111   return status;
3112 #undef FLD
3113 }
3114
3115 // ********** beq: beq $soffset8
3116
3117 sem_status
3118 thumb_sem_beq (arm7f_cpu* current_cpu, thumb_scache* sem)
3119 {
3120 #define FLD(f) abuf->fields.sfmt_beq.f
3121   sem_status status = SEM_STATUS_NORMAL;
3122   thumb_scache* abuf = sem;
3123   PCADDR pc = abuf->addr;
3124   PCADDR npc = pc + 2;
3125
3126 if (current_cpu->hardware.h_zbit) {
3127   {
3128     USI opval = FLD (i_soffset8);
3129     if (UNLIKELY(current_cpu->trace_result_p))
3130       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3131     current_cpu->branch (opval, npc, status);
3132   }
3133 }
3134
3135   current_cpu->done_cti_insn (npc, status);
3136   return status;
3137 #undef FLD
3138 }
3139
3140 // ********** bne: bne $soffset8
3141
3142 sem_status
3143 thumb_sem_bne (arm7f_cpu* current_cpu, thumb_scache* sem)
3144 {
3145 #define FLD(f) abuf->fields.sfmt_beq.f
3146   sem_status status = SEM_STATUS_NORMAL;
3147   thumb_scache* abuf = sem;
3148   PCADDR pc = abuf->addr;
3149   PCADDR npc = pc + 2;
3150
3151 if (NOTBI (current_cpu->hardware.h_zbit)) {
3152   {
3153     USI opval = FLD (i_soffset8);
3154     if (UNLIKELY(current_cpu->trace_result_p))
3155       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3156     current_cpu->branch (opval, npc, status);
3157   }
3158 }
3159
3160   current_cpu->done_cti_insn (npc, status);
3161   return status;
3162 #undef FLD
3163 }
3164
3165 // ********** bcs: bcs $soffset8
3166
3167 sem_status
3168 thumb_sem_bcs (arm7f_cpu* current_cpu, thumb_scache* sem)
3169 {
3170 #define FLD(f) abuf->fields.sfmt_beq.f
3171   sem_status status = SEM_STATUS_NORMAL;
3172   thumb_scache* abuf = sem;
3173   PCADDR pc = abuf->addr;
3174   PCADDR npc = pc + 2;
3175
3176 if (current_cpu->hardware.h_cbit) {
3177   {
3178     USI opval = FLD (i_soffset8);
3179     if (UNLIKELY(current_cpu->trace_result_p))
3180       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3181     current_cpu->branch (opval, npc, status);
3182   }
3183 }
3184
3185   current_cpu->done_cti_insn (npc, status);
3186   return status;
3187 #undef FLD
3188 }
3189
3190 // ********** bcc: bcc $soffset8
3191
3192 sem_status
3193 thumb_sem_bcc (arm7f_cpu* current_cpu, thumb_scache* sem)
3194 {
3195 #define FLD(f) abuf->fields.sfmt_beq.f
3196   sem_status status = SEM_STATUS_NORMAL;
3197   thumb_scache* abuf = sem;
3198   PCADDR pc = abuf->addr;
3199   PCADDR npc = pc + 2;
3200
3201 if (NOTBI (current_cpu->hardware.h_cbit)) {
3202   {
3203     USI opval = FLD (i_soffset8);
3204     if (UNLIKELY(current_cpu->trace_result_p))
3205       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3206     current_cpu->branch (opval, npc, status);
3207   }
3208 }
3209
3210   current_cpu->done_cti_insn (npc, status);
3211   return status;
3212 #undef FLD
3213 }
3214
3215 // ********** bmi: bmi $soffset8
3216
3217 sem_status
3218 thumb_sem_bmi (arm7f_cpu* current_cpu, thumb_scache* sem)
3219 {
3220 #define FLD(f) abuf->fields.sfmt_beq.f
3221   sem_status status = SEM_STATUS_NORMAL;
3222   thumb_scache* abuf = sem;
3223   PCADDR pc = abuf->addr;
3224   PCADDR npc = pc + 2;
3225
3226 if (current_cpu->hardware.h_nbit) {
3227   {
3228     USI opval = FLD (i_soffset8);
3229     if (UNLIKELY(current_cpu->trace_result_p))
3230       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3231     current_cpu->branch (opval, npc, status);
3232   }
3233 }
3234
3235   current_cpu->done_cti_insn (npc, status);
3236   return status;
3237 #undef FLD
3238 }
3239
3240 // ********** bpl: bpl $soffset8
3241
3242 sem_status
3243 thumb_sem_bpl (arm7f_cpu* current_cpu, thumb_scache* sem)
3244 {
3245 #define FLD(f) abuf->fields.sfmt_beq.f
3246   sem_status status = SEM_STATUS_NORMAL;
3247   thumb_scache* abuf = sem;
3248   PCADDR pc = abuf->addr;
3249   PCADDR npc = pc + 2;
3250
3251 if (NOTBI (current_cpu->hardware.h_nbit)) {
3252   {
3253     USI opval = FLD (i_soffset8);
3254     if (UNLIKELY(current_cpu->trace_result_p))
3255       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3256     current_cpu->branch (opval, npc, status);
3257   }
3258 }
3259
3260   current_cpu->done_cti_insn (npc, status);
3261   return status;
3262 #undef FLD
3263 }
3264
3265 // ********** bvs: bvs $soffset8
3266
3267 sem_status
3268 thumb_sem_bvs (arm7f_cpu* current_cpu, thumb_scache* sem)
3269 {
3270 #define FLD(f) abuf->fields.sfmt_beq.f
3271   sem_status status = SEM_STATUS_NORMAL;
3272   thumb_scache* abuf = sem;
3273   PCADDR pc = abuf->addr;
3274   PCADDR npc = pc + 2;
3275
3276 if (current_cpu->hardware.h_vbit) {
3277   {
3278     USI opval = FLD (i_soffset8);
3279     if (UNLIKELY(current_cpu->trace_result_p))
3280       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3281     current_cpu->branch (opval, npc, status);
3282   }
3283 }
3284
3285   current_cpu->done_cti_insn (npc, status);
3286   return status;
3287 #undef FLD
3288 }
3289
3290 // ********** bvc: bvc $soffset8
3291
3292 sem_status
3293 thumb_sem_bvc (arm7f_cpu* current_cpu, thumb_scache* sem)
3294 {
3295 #define FLD(f) abuf->fields.sfmt_beq.f
3296   sem_status status = SEM_STATUS_NORMAL;
3297   thumb_scache* abuf = sem;
3298   PCADDR pc = abuf->addr;
3299   PCADDR npc = pc + 2;
3300
3301 if (NOTBI (current_cpu->hardware.h_vbit)) {
3302   {
3303     USI opval = FLD (i_soffset8);
3304     if (UNLIKELY(current_cpu->trace_result_p))
3305       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3306     current_cpu->branch (opval, npc, status);
3307   }
3308 }
3309
3310   current_cpu->done_cti_insn (npc, status);
3311   return status;
3312 #undef FLD
3313 }
3314
3315 // ********** bhi: bhi $soffset8
3316
3317 sem_status
3318 thumb_sem_bhi (arm7f_cpu* current_cpu, thumb_scache* sem)
3319 {
3320 #define FLD(f) abuf->fields.sfmt_beq.f
3321   sem_status status = SEM_STATUS_NORMAL;
3322   thumb_scache* abuf = sem;
3323   PCADDR pc = abuf->addr;
3324   PCADDR npc = pc + 2;
3325
3326 if (ANDBI (current_cpu->hardware.h_cbit, NOTBI (current_cpu->hardware.h_zbit))) {
3327   {
3328     USI opval = FLD (i_soffset8);
3329     if (UNLIKELY(current_cpu->trace_result_p))
3330       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3331     current_cpu->branch (opval, npc, status);
3332   }
3333 }
3334
3335   current_cpu->done_cti_insn (npc, status);
3336   return status;
3337 #undef FLD
3338 }
3339
3340 // ********** bls: bls $soffset8
3341
3342 sem_status
3343 thumb_sem_bls (arm7f_cpu* current_cpu, thumb_scache* sem)
3344 {
3345 #define FLD(f) abuf->fields.sfmt_beq.f
3346   sem_status status = SEM_STATUS_NORMAL;
3347   thumb_scache* abuf = sem;
3348   PCADDR pc = abuf->addr;
3349   PCADDR npc = pc + 2;
3350
3351 if (ORBI (NOTBI (current_cpu->hardware.h_cbit), current_cpu->hardware.h_zbit)) {
3352   {
3353     USI opval = FLD (i_soffset8);
3354     if (UNLIKELY(current_cpu->trace_result_p))
3355       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3356     current_cpu->branch (opval, npc, status);
3357   }
3358 }
3359
3360   current_cpu->done_cti_insn (npc, status);
3361   return status;
3362 #undef FLD
3363 }
3364
3365 // ********** bge: bge $soffset8
3366
3367 sem_status
3368 thumb_sem_bge (arm7f_cpu* current_cpu, thumb_scache* sem)
3369 {
3370 #define FLD(f) abuf->fields.sfmt_beq.f
3371   sem_status status = SEM_STATUS_NORMAL;
3372   thumb_scache* abuf = sem;
3373   PCADDR pc = abuf->addr;
3374   PCADDR npc = pc + 2;
3375
3376 if (NOTBI (XORBI (current_cpu->hardware.h_nbit, current_cpu->hardware.h_vbit))) {
3377   {
3378     USI opval = FLD (i_soffset8);
3379     if (UNLIKELY(current_cpu->trace_result_p))
3380       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3381     current_cpu->branch (opval, npc, status);
3382   }
3383 }
3384
3385   current_cpu->done_cti_insn (npc, status);
3386   return status;
3387 #undef FLD
3388 }
3389
3390 // ********** blt: blt $soffset8
3391
3392 sem_status
3393 thumb_sem_blt (arm7f_cpu* current_cpu, thumb_scache* sem)
3394 {
3395 #define FLD(f) abuf->fields.sfmt_beq.f
3396   sem_status status = SEM_STATUS_NORMAL;
3397   thumb_scache* abuf = sem;
3398   PCADDR pc = abuf->addr;
3399   PCADDR npc = pc + 2;
3400
3401 if (XORBI (current_cpu->hardware.h_nbit, current_cpu->hardware.h_vbit)) {
3402   {
3403     USI opval = FLD (i_soffset8);
3404     if (UNLIKELY(current_cpu->trace_result_p))
3405       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3406     current_cpu->branch (opval, npc, status);
3407   }
3408 }
3409
3410   current_cpu->done_cti_insn (npc, status);
3411   return status;
3412 #undef FLD
3413 }
3414
3415 // ********** bgt: bgt $soffset8
3416
3417 sem_status
3418 thumb_sem_bgt (arm7f_cpu* current_cpu, thumb_scache* sem)
3419 {
3420 #define FLD(f) abuf->fields.sfmt_beq.f
3421   sem_status status = SEM_STATUS_NORMAL;
3422   thumb_scache* abuf = sem;
3423   PCADDR pc = abuf->addr;
3424   PCADDR npc = pc + 2;
3425
3426 if (NOTBI (ORBI (current_cpu->hardware.h_zbit, XORBI (current_cpu->hardware.h_nbit, current_cpu->hardware.h_vbit)))) {
3427   {
3428     USI opval = FLD (i_soffset8);
3429     if (UNLIKELY(current_cpu->trace_result_p))
3430       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3431     current_cpu->branch (opval, npc, status);
3432   }
3433 }
3434
3435   current_cpu->done_cti_insn (npc, status);
3436   return status;
3437 #undef FLD
3438 }
3439
3440 // ********** ble: ble $soffset8
3441
3442 sem_status
3443 thumb_sem_ble (arm7f_cpu* current_cpu, thumb_scache* sem)
3444 {
3445 #define FLD(f) abuf->fields.sfmt_beq.f
3446   sem_status status = SEM_STATUS_NORMAL;
3447   thumb_scache* abuf = sem;
3448   PCADDR pc = abuf->addr;
3449   PCADDR npc = pc + 2;
3450
3451 if (ORBI (current_cpu->hardware.h_zbit, XORBI (current_cpu->hardware.h_nbit, current_cpu->hardware.h_vbit))) {
3452   {
3453     USI opval = FLD (i_soffset8);
3454     if (UNLIKELY(current_cpu->trace_result_p))
3455       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3456     current_cpu->branch (opval, npc, status);
3457   }
3458 }
3459
3460   current_cpu->done_cti_insn (npc, status);
3461   return status;
3462 #undef FLD
3463 }
3464
3465 // ********** swi: swi $value8
3466
3467 sem_status
3468 thumb_sem_swi (arm7f_cpu* current_cpu, thumb_scache* sem)
3469 {
3470 #define FLD(f) abuf->fields.sfmt_swi.f
3471   sem_status status = SEM_STATUS_NORMAL;
3472   thumb_scache* abuf = sem;
3473   PCADDR pc = abuf->addr;
3474   PCADDR npc = pc + 2;
3475
3476   {
3477     USI opval = current_cpu->thumb_swi (pc, FLD (f_value8));
3478     if (UNLIKELY(current_cpu->trace_result_p))
3479       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3480     current_cpu->branch (opval, npc, status);
3481   }
3482
3483   current_cpu->done_cti_insn (npc, status);
3484   return status;
3485 #undef FLD
3486 }
3487
3488 // ********** b: b $offset11
3489
3490 sem_status
3491 thumb_sem_b (arm7f_cpu* current_cpu, thumb_scache* sem)
3492 {
3493 #define FLD(f) abuf->fields.sfmt_b.f
3494   sem_status status = SEM_STATUS_NORMAL;
3495   thumb_scache* abuf = sem;
3496   PCADDR pc = abuf->addr;
3497   PCADDR npc = pc + 2;
3498
3499   {
3500     USI opval = FLD (i_offset11);
3501     if (UNLIKELY(current_cpu->trace_result_p))
3502       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3503     current_cpu->branch (opval, npc, status);
3504   }
3505
3506   current_cpu->done_cti_insn (npc, status);
3507   return status;
3508 #undef FLD
3509 }
3510
3511 // ********** bl-hi: bl-hi ${lbwl-hi}
3512
3513 sem_status
3514 thumb_sem_bl_hi (arm7f_cpu* current_cpu, thumb_scache* sem)
3515 {
3516 #define FLD(f) abuf->fields.sfmt_bl_hi.f
3517   sem_status status = SEM_STATUS_NORMAL;
3518   thumb_scache* abuf = sem;
3519   PCADDR pc = abuf->addr;
3520   PCADDR npc = pc + 2;
3521
3522   {
3523     SI opval = ADDSI (ADDSI (pc, 4), SLLSI (FLD (f_lbwl_hi), 12));
3524     if (UNLIKELY(current_cpu->trace_result_p))
3525       current_cpu->trace_stream << "lr-t" << ":=0x" << hex << opval << dec << "  ";
3526     current_cpu->thumb_h_lr_t_set (opval);
3527   }
3528
3529   current_cpu->done_insn (npc, status);
3530   return status;
3531 #undef FLD
3532 }
3533
3534 // ********** bl-lo: bl-lo ${lbwl-lo}
3535
3536 sem_status
3537 thumb_sem_bl_lo (arm7f_cpu* current_cpu, thumb_scache* sem)
3538 {
3539 #define FLD(f) abuf->fields.sfmt_bl_lo.f
3540   sem_status status = SEM_STATUS_NORMAL;
3541   thumb_scache* abuf = sem;
3542   PCADDR pc = abuf->addr;
3543   PCADDR npc = pc + 2;
3544
3545 {
3546   SI tmp_cur_pc;
3547   tmp_cur_pc = pc;
3548   {
3549     USI opval = ADDSI (current_cpu->thumb_h_lr_t_get (), SLLSI (FLD (f_lbwl_lo), 1));
3550     if (UNLIKELY(current_cpu->trace_result_p))
3551       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3552     current_cpu->branch (opval, npc, status);
3553   }
3554   {
3555     SI opval = ORSI (ADDSI (tmp_cur_pc, 2), 1);
3556     if (UNLIKELY(current_cpu->trace_result_p))
3557       current_cpu->trace_stream << "lr-t" << ":=0x" << hex << opval << dec << "  ";
3558     current_cpu->thumb_h_lr_t_set (opval);
3559   }
3560 }
3561
3562   current_cpu->done_cti_insn (npc, status);
3563   return status;
3564 #undef FLD
3565 }
3566