OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [or1ksim/] [or1ksim-0.3.0/] [build/] [cpu/] [or32/] [execgen.c] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jeremybenn
/* execgen.c -- Automatically generated decoder
2
 
3
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
4
   Copyright (C) 2008 Embecosm Limited
5
 
6
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7
 
8
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
9
 
10
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14
 
15
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19
 
20
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22
 
23
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25
 
26
/* This file was automatically generated by generate (see
27
   cpu/or32/generate.c) */
28
 
29
static void decode_execute (struct iqueue_entry *current)
30
{
31
  uint32_t insn = current->insn;
32
  switch((insn >> 26) & 0x3f) {
33
  case 0x0:
34
    /* Instruction: l.j */
35
    {
36
      uorreg_t a;
37
      /* Number of operands: 1 */
38
      a = (insn >> 0) & 0x3ffffff;
39
      if(a & 0x02000000) a |= 0xfe000000;
40
      #define PARAM0 a
41
      {         /* "l_j" */
42
        cpu_state.pc_delay = cpu_state.pc + (orreg_t)PARAM0 * 4;
43
        next_delay_insn = 1;
44
      }
45
      #undef PARAM0
46
 
47
      if (do_stats) {
48
        current->insn_index = 0;   /* "l.j" */
49
        analysis(current);
50
      }
51
    }
52
    break;
53
  case 0x1:
54
    /* Instruction: l.jal */
55
    {
56
      uorreg_t a;
57
      /* Number of operands: 1 */
58
      a = (insn >> 0) & 0x3ffffff;
59
      if(a & 0x02000000) a |= 0xfe000000;
60
      #define PARAM0 a
61
      {         /* "l_jal" */
62
        cpu_state.pc_delay = cpu_state.pc + (orreg_t)PARAM0 * 4;
63
 
64
        setsim_reg(LINK_REGNO, cpu_state.pc + 8);
65
        next_delay_insn = 1;
66
        if (config.sim.profile) {
67
          struct label_entry *tmp;
68
          if (verify_memoryarea(cpu_state.pc_delay) && (tmp = get_label (cpu_state.pc_delay)))
69
            fprintf (runtime.sim.fprof, "+%08llX %"PRIxADDR" %"PRIxADDR" %s\n",
70
                     runtime.sim.cycles, cpu_state.pc + 8, cpu_state.pc_delay,
71
                     tmp->name);
72
          else
73
            fprintf (runtime.sim.fprof, "+%08llX %"PRIxADDR" %"PRIxADDR" @%"PRIxADDR"\n",
74
                     runtime.sim.cycles, cpu_state.pc + 8, cpu_state.pc_delay,
75
                     cpu_state.pc_delay);
76
        }
77
      }
78
      #undef PARAM0
79
 
80
      if (do_stats) {
81
        current->insn_index = 1;   /* "l.jal" */
82
        analysis(current);
83
      }
84
    }
85
    break;
86
  case 0x2:
87
    /* Invalid instruction(s) */
88
    break;
89
  case 0x3:
90
    /* Instruction: l.bnf */
91
    {
92
      uorreg_t a;
93
      /* Number of operands: 1 */
94
      a = (insn >> 0) & 0x3ffffff;
95
      if(a & 0x02000000) a |= 0xfe000000;
96
      #define PARAM0 a
97
      {         /* "l_bnf" */
98
        if (config.bpb.enabled) {
99
          int fwd = (PARAM0 >= cpu_state.pc) ? 1 : 0;
100
          or1k_mstats.bnf[cpu_state.sprs[SPR_SR] & SPR_SR_F ? 0 : 1][fwd]++;
101
          bpb_update(current->insn_addr, cpu_state.sprs[SPR_SR] & SPR_SR_F ? 0 : 1);
102
        }
103
        if (!(cpu_state.sprs[SPR_SR] & SPR_SR_F)) {
104
          cpu_state.pc_delay = cpu_state.pc + (orreg_t)PARAM0 * 4;
105
          btic_update(pcnext);
106
          next_delay_insn = 1;
107
        } else {
108
          btic_update(cpu_state.pc);
109
        }
110
      }
111
      #undef PARAM0
112
 
113
      if (do_stats) {
114
        current->insn_index = 2;   /* "l.bnf" */
115
        analysis(current);
116
      }
117
    }
118
    break;
119
  case 0x4:
120
    /* Instruction: l.bf */
121
    {
122
      uorreg_t a;
123
      /* Number of operands: 1 */
124
      a = (insn >> 0) & 0x3ffffff;
125
      if(a & 0x02000000) a |= 0xfe000000;
126
      #define PARAM0 a
127
      {         /* "l_bf" */
128
        if (config.bpb.enabled) {
129
          int fwd = (PARAM0 >= cpu_state.pc) ? 1 : 0;
130
          or1k_mstats.bf[cpu_state.sprs[SPR_SR] & SPR_SR_F ? 1 : 0][fwd]++;
131
          bpb_update(current->insn_addr, cpu_state.sprs[SPR_SR] & SPR_SR_F ? 1 : 0);
132
        }
133
        if(cpu_state.sprs[SPR_SR] & SPR_SR_F) {
134
          cpu_state.pc_delay = cpu_state.pc + (orreg_t)PARAM0 * 4;
135
          btic_update(pcnext);
136
          next_delay_insn = 1;
137
        } else {
138
          btic_update(cpu_state.pc);
139
        }
140
      }
141
      #undef PARAM0
142
 
143
      if (do_stats) {
144
        current->insn_index = 3;   /* "l.bf" */
145
        analysis(current);
146
      }
147
    }
148
    break;
149
  case 0x5:
150
    /* Not unique: real mask ff000000 and current mask fc000000 differ - do final check */
151
    if((insn & 0xff000000) == 0x15000000) {
152
      /* Instruction: l.nop */
153
      {
154
        uorreg_t a;
155
        /* Number of operands: 1 */
156
        a = (insn >> 0) & 0xffff;
157
        #define PARAM0 a
158
        {           /* "l_nop" */
159
          oraddr_t stackaddr;
160
          uint32_t k = PARAM0;
161
          switch (k) {
162
            case NOP_NOP:
163
              break;
164
            case NOP_EXIT:
165
              PRINTF("exit(%"PRIdREG")\n", evalsim_reg (3));
166
              fprintf(stderr, "@reset : cycles %lld, insn #%lld\n",
167
                      runtime.sim.reset_cycles, runtime.cpu.reset_instructions);
168
              fprintf(stderr, "@exit  : cycles %lld, insn #%lld\n", runtime.sim.cycles,
169
                      runtime.cpu.instructions);
170
              fprintf(stderr, " diff  : cycles %lld, insn #%lld\n",
171
                      runtime.sim.cycles - runtime.sim.reset_cycles,
172
                      runtime.cpu.instructions - runtime.cpu.reset_instructions);
173
              if (config.debug.gdb_enabled)
174
                set_stall_state (1);
175
              else
176
                sim_done();
177
              break;
178
            case NOP_CNT_RESET:
179
              PRINTF("****************** counters reset ******************\n");
180
              PRINTF("cycles %lld, insn #%lld\n", runtime.sim.cycles, runtime.cpu.instructions);
181
              PRINTF("****************** counters reset ******************\n");
182
              runtime.sim.reset_cycles = runtime.sim.cycles;
183
              runtime.cpu.reset_instructions = runtime.cpu.instructions;
184
              break;
185
            case NOP_PRINTF:
186
              stackaddr = evalsim_reg(4);
187
              simprintf(stackaddr, evalsim_reg(3));
188
              break;
189
            case NOP_PUTC:              /*JPB */
190
              printf( "%c", evalsim_reg( 3 ));
191
              fflush( stdout );
192
              break;
193
            case NOP_REPORT:
194
              PRINTF("report(0x%"PRIxREG");\n", evalsim_reg(3));
195
            default:
196
              if (k >= NOP_REPORT_FIRST && k <= NOP_REPORT_LAST)
197
              PRINTF("report %i (0x%"PRIxREG");\n", k - NOP_REPORT_FIRST,
198
                     evalsim_reg(3));
199
              break;
200
          }
201
        }
202
        #undef PARAM0
203
 
204
        if (do_stats) {
205
          current->insn_index = 4;   /* "l.nop" */
206
          analysis(current);
207
        }
208
      }
209
    } else {
210
      /* Invalid insn */
211
      {
212
        l_invalid ();
213
 
214
        if (do_stats) {
215
          current->insn_index = -1;   /* "???" */
216
          analysis(current);
217
        }
218
      }
219
    }
220
    break;
221
  case 0x6:
222
    switch((insn >> 16) & 0x1) {
223
    case 0x0:
224
      /* Instruction: l.movhi */
225
      {
226
        uorreg_t a, b;
227
        /* Number of operands: 2 */
228
        a = (insn >> 21) & 0x1f;
229
        #define SET_PARAM0(val) cpu_state.reg[a] = val
230
        #define PARAM0 cpu_state.reg[a]
231
        b = (insn >> 0) & 0xffff;
232
        #define PARAM1 b
233
        {           /* "l_movhi" */
234
          SET_PARAM0(PARAM1 << 16);
235
        }
236
        #undef SET_PARAM
237
        #undef PARAM0
238
        #undef PARAM1
239
 
240
        if (do_stats) {
241
          current->insn_index = 5;   /* "l.movhi" */
242
          analysis(current);
243
        }
244
        cpu_state.reg[0] = 0; /* Repair in case we changed it */
245
      }
246
      break;
247
    case 0x1:
248
      /* Not unique: real mask fc01ffff and current mask fc010000 differ - do final check */
249
      if((insn & 0xfc01ffff) == 0x18010000) {
250
        /* Instruction: l.macrc */
251
        {
252
          uorreg_t a;
253
          /* Number of operands: 1 */
254
          a = (insn >> 21) & 0x1f;
255
          #define SET_PARAM0(val) cpu_state.reg[a] = val
256
          #define PARAM0 cpu_state.reg[a]
257
          {             /* "l_macrc" */
258
            uorreg_t lo, hi;
259
            LONGEST l;
260
            /* No need for synchronization here -- all MAC instructions are 1 cycle long.  */
261
            lo =  cpu_state.sprs[SPR_MACLO];
262
            hi =  cpu_state.sprs[SPR_MACHI];
263
            l = (ULONGEST) lo | ((LONGEST)hi << 32);
264
            l >>= 28;
265
            //PRINTF ("<%08x>\n", (unsigned long)l);
266
            SET_PARAM0((orreg_t)l);
267
            cpu_state.sprs[SPR_MACLO] = 0;
268
            cpu_state.sprs[SPR_MACHI] = 0;
269
          }
270
          #undef SET_PARAM
271
          #undef PARAM0
272
 
273
          if (do_stats) {
274
            current->insn_index = 6;   /* "l.macrc" */
275
            analysis(current);
276
          }
277
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
278
        }
279
      } else {
280
        /* Invalid insn */
281
        {
282
          l_invalid ();
283
 
284
          if (do_stats) {
285
            current->insn_index = -1;   /* "???" */
286
            analysis(current);
287
          }
288
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
289
        }
290
      }
291
      break;
292
    }
293
    break;
294
  case 0x7:
295
    /* Invalid instruction(s) */
296
    break;
297
  case 0x8:
298
    switch((insn >> 16) & 0x7f) {
299
    case 0x0:
300
      switch((insn >> 23) & 0x7) {
301
      case 0x0:
302
        /* Instruction: l.sys */
303
        {
304
          uorreg_t a;
305
          /* Number of operands: 1 */
306
          a = (insn >> 0) & 0xffff;
307
          #define PARAM0 a
308
          {             /* "l_sys" */
309
            except_handle(EXCEPT_SYSCALL, cpu_state.sprs[SPR_EEAR_BASE]);
310
          }
311
          #undef PARAM0
312
 
313
          if (do_stats) {
314
            current->insn_index = 7;   /* "l.sys" */
315
            analysis(current);
316
          }
317
        }
318
        break;
319
      case 0x1:
320
        /* Invalid instruction(s) */
321
        break;
322
      case 0x2:
323
        /* Instruction: l.trap */
324
        {
325
          uorreg_t a;
326
          /* Number of operands: 1 */
327
          a = (insn >> 0) & 0xffff;
328
          #define PARAM0 a
329
          {             /* "l_trap" */
330
            /* TODO: some SR related code here! */
331
            except_handle(EXCEPT_TRAP, cpu_state.sprs[SPR_EEAR_BASE]);
332
          }
333
          #undef PARAM0
334
 
335
          if (do_stats) {
336
            current->insn_index = 8;   /* "l.trap" */
337
            analysis(current);
338
          }
339
        }
340
        break;
341
      case 0x3:
342
        /* Invalid instruction(s) */
343
        break;
344
      case 0x4:
345
        /* Not unique: real mask ffffffff and current mask ffff0000 differ - do final check */
346
        if((insn & 0xffffffff) == 0x22000000) {
347
          /* Instruction: l.msync */
348
          {
349
            uorreg_t a;
350
            /* Number of operands: 1 */
351
            a = (insn >> 0) & 0x0;
352
            #define SET_PARAM0(val) cpu_state.reg[a] = val
353
            #define PARAM0 cpu_state.reg[a]
354
            l_none ();
355
            #undef SET_PARAM
356
            #undef PARAM0
357
 
358
            if (do_stats) {
359
              current->insn_index = 9;   /* "l.msync" */
360
              analysis(current);
361
            }
362
          }
363
        } else {
364
          /* Invalid insn */
365
          {
366
            l_invalid ();
367
 
368
            if (do_stats) {
369
              current->insn_index = -1;   /* "???" */
370
              analysis(current);
371
            }
372
          }
373
        }
374
        break;
375
      case 0x5:
376
        /* Not unique: real mask ffffffff and current mask ffff0000 differ - do final check */
377
        if((insn & 0xffffffff) == 0x22800000) {
378
          /* Instruction: l.psync */
379
          {
380
            uorreg_t a;
381
            /* Number of operands: 1 */
382
            a = (insn >> 0) & 0x0;
383
            #define SET_PARAM0(val) cpu_state.reg[a] = val
384
            #define PARAM0 cpu_state.reg[a]
385
            l_none ();
386
            #undef SET_PARAM
387
            #undef PARAM0
388
 
389
            if (do_stats) {
390
              current->insn_index = 10;   /* "l.psync" */
391
              analysis(current);
392
            }
393
          }
394
        } else {
395
          /* Invalid insn */
396
          {
397
            l_invalid ();
398
 
399
            if (do_stats) {
400
              current->insn_index = -1;   /* "???" */
401
              analysis(current);
402
            }
403
          }
404
        }
405
        break;
406
      case 0x6:
407
        /* Not unique: real mask ffffffff and current mask ffff0000 differ - do final check */
408
        if((insn & 0xffffffff) == 0x23000000) {
409
          /* Instruction: l.csync */
410
          {
411
            uorreg_t a;
412
            /* Number of operands: 1 */
413
            a = (insn >> 0) & 0x0;
414
            #define SET_PARAM0(val) cpu_state.reg[a] = val
415
            #define PARAM0 cpu_state.reg[a]
416
            l_none ();
417
            #undef SET_PARAM
418
            #undef PARAM0
419
 
420
            if (do_stats) {
421
              current->insn_index = 11;   /* "l.csync" */
422
              analysis(current);
423
            }
424
          }
425
        } else {
426
          /* Invalid insn */
427
          {
428
            l_invalid ();
429
 
430
            if (do_stats) {
431
              current->insn_index = -1;   /* "???" */
432
              analysis(current);
433
            }
434
          }
435
        }
436
        break;
437
      case 0x7:
438
        /* Invalid instruction(s) */
439
        break;
440
      }
441
      break;
442
    case 0x1:
443
    case 0x2:
444
    case 0x3:
445
    case 0x4:
446
    case 0x5:
447
    case 0x6:
448
    case 0x7:
449
    case 0x8:
450
    case 0x9:
451
    case 0xa:
452
    case 0xb:
453
    case 0xc:
454
    case 0xd:
455
    case 0xe:
456
    case 0xf:
457
    case 0x10:
458
    case 0x11:
459
    case 0x12:
460
    case 0x13:
461
    case 0x14:
462
    case 0x15:
463
    case 0x16:
464
    case 0x17:
465
    case 0x18:
466
    case 0x19:
467
    case 0x1a:
468
    case 0x1b:
469
    case 0x1c:
470
    case 0x1d:
471
    case 0x1e:
472
    case 0x1f:
473
    case 0x20:
474
    case 0x21:
475
    case 0x22:
476
    case 0x23:
477
    case 0x24:
478
    case 0x25:
479
    case 0x26:
480
    case 0x27:
481
    case 0x28:
482
    case 0x29:
483
    case 0x2a:
484
    case 0x2b:
485
    case 0x2c:
486
    case 0x2d:
487
    case 0x2e:
488
    case 0x2f:
489
    case 0x30:
490
    case 0x31:
491
    case 0x32:
492
    case 0x33:
493
    case 0x34:
494
    case 0x35:
495
    case 0x36:
496
    case 0x37:
497
    case 0x38:
498
    case 0x39:
499
    case 0x3a:
500
    case 0x3b:
501
    case 0x3c:
502
    case 0x3d:
503
    case 0x3e:
504
    case 0x3f:
505
    case 0x40:
506
    case 0x41:
507
    case 0x42:
508
    case 0x43:
509
    case 0x44:
510
    case 0x45:
511
    case 0x46:
512
    case 0x47:
513
    case 0x48:
514
    case 0x49:
515
    case 0x4a:
516
    case 0x4b:
517
    case 0x4c:
518
    case 0x4d:
519
    case 0x4e:
520
    case 0x4f:
521
    case 0x50:
522
    case 0x51:
523
    case 0x52:
524
    case 0x53:
525
    case 0x54:
526
    case 0x55:
527
    case 0x56:
528
    case 0x57:
529
    case 0x58:
530
    case 0x59:
531
    case 0x5a:
532
    case 0x5b:
533
    case 0x5c:
534
    case 0x5d:
535
    case 0x5e:
536
    case 0x5f:
537
    case 0x60:
538
    case 0x61:
539
    case 0x62:
540
    case 0x63:
541
    case 0x64:
542
    case 0x65:
543
    case 0x66:
544
    case 0x67:
545
    case 0x68:
546
    case 0x69:
547
    case 0x6a:
548
    case 0x6b:
549
    case 0x6c:
550
    case 0x6d:
551
    case 0x6e:
552
    case 0x6f:
553
    case 0x70:
554
    case 0x71:
555
    case 0x72:
556
    case 0x73:
557
    case 0x74:
558
    case 0x75:
559
    case 0x76:
560
    case 0x77:
561
    case 0x78:
562
    case 0x79:
563
    case 0x7a:
564
    case 0x7b:
565
    case 0x7c:
566
    case 0x7d:
567
    case 0x7e:
568
    case 0x7f:
569
      /* Invalid instruction(s) */
570
      break;
571
    }
572
    break;
573
  case 0x9:
574
    /* Instruction: l.rfe */
575
    {
576
      uorreg_t a;
577
      /* Number of operands: 1 */
578
      a = (insn >> 0) & 0x0;
579
      #define SET_PARAM0(val) cpu_state.reg[a] = val
580
      #define PARAM0 cpu_state.reg[a]
581
      {         /* "l_rfe" */
582
        pcnext = cpu_state.sprs[SPR_EPCR_BASE];
583
        mtspr(SPR_SR, cpu_state.sprs[SPR_ESR_BASE]);
584
      }
585
      #undef SET_PARAM
586
      #undef PARAM0
587
 
588
      if (do_stats) {
589
        current->insn_index = 12;   /* "l.rfe" */
590
        analysis(current);
591
      }
592
    }
593
    break;
594
  case 0xa:
595
    switch((insn >> 4) & 0xf) {
596
    case 0x0:
597
      /* Invalid instruction(s) */
598
      break;
599
    case 0x1:
600
      switch((insn >> 0) & 0xf) {
601
      case 0x0:
602
        /* Instruction: lv.all_eq.b */
603
        {
604
          uorreg_t a, b, c;
605
          /* Number of operands: 3 */
606
          a = (insn >> 21) & 0x1f;
607
          #define SET_PARAM0(val) cpu_state.reg[a] = val
608
          #define PARAM0 cpu_state.reg[a]
609
          b = (insn >> 16) & 0x1f;
610
          #define PARAM1 cpu_state.reg[b]
611
          c = (insn >> 11) & 0x1f;
612
          #define PARAM2 cpu_state.reg[c]
613
          l_invalid ();
614
          #undef SET_PARAM
615
          #undef PARAM0
616
          #undef PARAM1
617
          #undef PARAM2
618
 
619
          if (do_stats) {
620
            current->insn_index = 13;   /* "lv.all_eq.b" */
621
            analysis(current);
622
          }
623
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
624
        }
625
        break;
626
      case 0x1:
627
        /* Instruction: lv.all_eq.h */
628
        {
629
          uorreg_t a, b, c;
630
          /* Number of operands: 3 */
631
          a = (insn >> 21) & 0x1f;
632
          #define SET_PARAM0(val) cpu_state.reg[a] = val
633
          #define PARAM0 cpu_state.reg[a]
634
          b = (insn >> 16) & 0x1f;
635
          #define PARAM1 cpu_state.reg[b]
636
          c = (insn >> 11) & 0x1f;
637
          #define PARAM2 cpu_state.reg[c]
638
          l_invalid ();
639
          #undef SET_PARAM
640
          #undef PARAM0
641
          #undef PARAM1
642
          #undef PARAM2
643
 
644
          if (do_stats) {
645
            current->insn_index = 14;   /* "lv.all_eq.h" */
646
            analysis(current);
647
          }
648
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
649
        }
650
        break;
651
      case 0x2:
652
        /* Instruction: lv.all_ge.b */
653
        {
654
          uorreg_t a, b, c;
655
          /* Number of operands: 3 */
656
          a = (insn >> 21) & 0x1f;
657
          #define SET_PARAM0(val) cpu_state.reg[a] = val
658
          #define PARAM0 cpu_state.reg[a]
659
          b = (insn >> 16) & 0x1f;
660
          #define PARAM1 cpu_state.reg[b]
661
          c = (insn >> 11) & 0x1f;
662
          #define PARAM2 cpu_state.reg[c]
663
          l_invalid ();
664
          #undef SET_PARAM
665
          #undef PARAM0
666
          #undef PARAM1
667
          #undef PARAM2
668
 
669
          if (do_stats) {
670
            current->insn_index = 15;   /* "lv.all_ge.b" */
671
            analysis(current);
672
          }
673
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
674
        }
675
        break;
676
      case 0x3:
677
        /* Instruction: lv.all_ge.h */
678
        {
679
          uorreg_t a, b, c;
680
          /* Number of operands: 3 */
681
          a = (insn >> 21) & 0x1f;
682
          #define SET_PARAM0(val) cpu_state.reg[a] = val
683
          #define PARAM0 cpu_state.reg[a]
684
          b = (insn >> 16) & 0x1f;
685
          #define PARAM1 cpu_state.reg[b]
686
          c = (insn >> 11) & 0x1f;
687
          #define PARAM2 cpu_state.reg[c]
688
          l_invalid ();
689
          #undef SET_PARAM
690
          #undef PARAM0
691
          #undef PARAM1
692
          #undef PARAM2
693
 
694
          if (do_stats) {
695
            current->insn_index = 16;   /* "lv.all_ge.h" */
696
            analysis(current);
697
          }
698
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
699
        }
700
        break;
701
      case 0x4:
702
        /* Instruction: lv.all_gt.b */
703
        {
704
          uorreg_t a, b, c;
705
          /* Number of operands: 3 */
706
          a = (insn >> 21) & 0x1f;
707
          #define SET_PARAM0(val) cpu_state.reg[a] = val
708
          #define PARAM0 cpu_state.reg[a]
709
          b = (insn >> 16) & 0x1f;
710
          #define PARAM1 cpu_state.reg[b]
711
          c = (insn >> 11) & 0x1f;
712
          #define PARAM2 cpu_state.reg[c]
713
          l_invalid ();
714
          #undef SET_PARAM
715
          #undef PARAM0
716
          #undef PARAM1
717
          #undef PARAM2
718
 
719
          if (do_stats) {
720
            current->insn_index = 17;   /* "lv.all_gt.b" */
721
            analysis(current);
722
          }
723
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
724
        }
725
        break;
726
      case 0x5:
727
        /* Instruction: lv.all_gt.h */
728
        {
729
          uorreg_t a, b, c;
730
          /* Number of operands: 3 */
731
          a = (insn >> 21) & 0x1f;
732
          #define SET_PARAM0(val) cpu_state.reg[a] = val
733
          #define PARAM0 cpu_state.reg[a]
734
          b = (insn >> 16) & 0x1f;
735
          #define PARAM1 cpu_state.reg[b]
736
          c = (insn >> 11) & 0x1f;
737
          #define PARAM2 cpu_state.reg[c]
738
          l_invalid ();
739
          #undef SET_PARAM
740
          #undef PARAM0
741
          #undef PARAM1
742
          #undef PARAM2
743
 
744
          if (do_stats) {
745
            current->insn_index = 18;   /* "lv.all_gt.h" */
746
            analysis(current);
747
          }
748
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
749
        }
750
        break;
751
      case 0x6:
752
        /* Instruction: lv.all_le.b */
753
        {
754
          uorreg_t a, b, c;
755
          /* Number of operands: 3 */
756
          a = (insn >> 21) & 0x1f;
757
          #define SET_PARAM0(val) cpu_state.reg[a] = val
758
          #define PARAM0 cpu_state.reg[a]
759
          b = (insn >> 16) & 0x1f;
760
          #define PARAM1 cpu_state.reg[b]
761
          c = (insn >> 11) & 0x1f;
762
          #define PARAM2 cpu_state.reg[c]
763
          l_invalid ();
764
          #undef SET_PARAM
765
          #undef PARAM0
766
          #undef PARAM1
767
          #undef PARAM2
768
 
769
          if (do_stats) {
770
            current->insn_index = 19;   /* "lv.all_le.b" */
771
            analysis(current);
772
          }
773
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
774
        }
775
        break;
776
      case 0x7:
777
        /* Instruction: lv.all_le.h */
778
        {
779
          uorreg_t a, b, c;
780
          /* Number of operands: 3 */
781
          a = (insn >> 21) & 0x1f;
782
          #define SET_PARAM0(val) cpu_state.reg[a] = val
783
          #define PARAM0 cpu_state.reg[a]
784
          b = (insn >> 16) & 0x1f;
785
          #define PARAM1 cpu_state.reg[b]
786
          c = (insn >> 11) & 0x1f;
787
          #define PARAM2 cpu_state.reg[c]
788
          l_invalid ();
789
          #undef SET_PARAM
790
          #undef PARAM0
791
          #undef PARAM1
792
          #undef PARAM2
793
 
794
          if (do_stats) {
795
            current->insn_index = 20;   /* "lv.all_le.h" */
796
            analysis(current);
797
          }
798
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
799
        }
800
        break;
801
      case 0x8:
802
        /* Instruction: lv.all_lt.b */
803
        {
804
          uorreg_t a, b, c;
805
          /* Number of operands: 3 */
806
          a = (insn >> 21) & 0x1f;
807
          #define SET_PARAM0(val) cpu_state.reg[a] = val
808
          #define PARAM0 cpu_state.reg[a]
809
          b = (insn >> 16) & 0x1f;
810
          #define PARAM1 cpu_state.reg[b]
811
          c = (insn >> 11) & 0x1f;
812
          #define PARAM2 cpu_state.reg[c]
813
          l_invalid ();
814
          #undef SET_PARAM
815
          #undef PARAM0
816
          #undef PARAM1
817
          #undef PARAM2
818
 
819
          if (do_stats) {
820
            current->insn_index = 21;   /* "lv.all_lt.b" */
821
            analysis(current);
822
          }
823
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
824
        }
825
        break;
826
      case 0x9:
827
        /* Instruction: lv.all_lt.h */
828
        {
829
          uorreg_t a, b, c;
830
          /* Number of operands: 3 */
831
          a = (insn >> 21) & 0x1f;
832
          #define SET_PARAM0(val) cpu_state.reg[a] = val
833
          #define PARAM0 cpu_state.reg[a]
834
          b = (insn >> 16) & 0x1f;
835
          #define PARAM1 cpu_state.reg[b]
836
          c = (insn >> 11) & 0x1f;
837
          #define PARAM2 cpu_state.reg[c]
838
          l_invalid ();
839
          #undef SET_PARAM
840
          #undef PARAM0
841
          #undef PARAM1
842
          #undef PARAM2
843
 
844
          if (do_stats) {
845
            current->insn_index = 22;   /* "lv.all_lt.h" */
846
            analysis(current);
847
          }
848
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
849
        }
850
        break;
851
      case 0xa:
852
        /* Instruction: lv.all_ne.b */
853
        {
854
          uorreg_t a, b, c;
855
          /* Number of operands: 3 */
856
          a = (insn >> 21) & 0x1f;
857
          #define SET_PARAM0(val) cpu_state.reg[a] = val
858
          #define PARAM0 cpu_state.reg[a]
859
          b = (insn >> 16) & 0x1f;
860
          #define PARAM1 cpu_state.reg[b]
861
          c = (insn >> 11) & 0x1f;
862
          #define PARAM2 cpu_state.reg[c]
863
          l_invalid ();
864
          #undef SET_PARAM
865
          #undef PARAM0
866
          #undef PARAM1
867
          #undef PARAM2
868
 
869
          if (do_stats) {
870
            current->insn_index = 23;   /* "lv.all_ne.b" */
871
            analysis(current);
872
          }
873
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
874
        }
875
        break;
876
      case 0xb:
877
        /* Instruction: lv.all_ne.h */
878
        {
879
          uorreg_t a, b, c;
880
          /* Number of operands: 3 */
881
          a = (insn >> 21) & 0x1f;
882
          #define SET_PARAM0(val) cpu_state.reg[a] = val
883
          #define PARAM0 cpu_state.reg[a]
884
          b = (insn >> 16) & 0x1f;
885
          #define PARAM1 cpu_state.reg[b]
886
          c = (insn >> 11) & 0x1f;
887
          #define PARAM2 cpu_state.reg[c]
888
          l_invalid ();
889
          #undef SET_PARAM
890
          #undef PARAM0
891
          #undef PARAM1
892
          #undef PARAM2
893
 
894
          if (do_stats) {
895
            current->insn_index = 24;   /* "lv.all_ne.h" */
896
            analysis(current);
897
          }
898
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
899
        }
900
        break;
901
      case 0xc:
902
      case 0xd:
903
      case 0xe:
904
      case 0xf:
905
        /* Invalid instruction(s) */
906
        break;
907
      }
908
      break;
909
    case 0x2:
910
      switch((insn >> 0) & 0xf) {
911
      case 0x0:
912
        /* Instruction: lv.any_eq.b */
913
        {
914
          uorreg_t a, b, c;
915
          /* Number of operands: 3 */
916
          a = (insn >> 21) & 0x1f;
917
          #define SET_PARAM0(val) cpu_state.reg[a] = val
918
          #define PARAM0 cpu_state.reg[a]
919
          b = (insn >> 16) & 0x1f;
920
          #define PARAM1 cpu_state.reg[b]
921
          c = (insn >> 11) & 0x1f;
922
          #define PARAM2 cpu_state.reg[c]
923
          l_invalid ();
924
          #undef SET_PARAM
925
          #undef PARAM0
926
          #undef PARAM1
927
          #undef PARAM2
928
 
929
          if (do_stats) {
930
            current->insn_index = 25;   /* "lv.any_eq.b" */
931
            analysis(current);
932
          }
933
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
934
        }
935
        break;
936
      case 0x1:
937
        /* Instruction: lv.any_eq.h */
938
        {
939
          uorreg_t a, b, c;
940
          /* Number of operands: 3 */
941
          a = (insn >> 21) & 0x1f;
942
          #define SET_PARAM0(val) cpu_state.reg[a] = val
943
          #define PARAM0 cpu_state.reg[a]
944
          b = (insn >> 16) & 0x1f;
945
          #define PARAM1 cpu_state.reg[b]
946
          c = (insn >> 11) & 0x1f;
947
          #define PARAM2 cpu_state.reg[c]
948
          l_invalid ();
949
          #undef SET_PARAM
950
          #undef PARAM0
951
          #undef PARAM1
952
          #undef PARAM2
953
 
954
          if (do_stats) {
955
            current->insn_index = 26;   /* "lv.any_eq.h" */
956
            analysis(current);
957
          }
958
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
959
        }
960
        break;
961
      case 0x2:
962
        /* Instruction: lv.any_ge.b */
963
        {
964
          uorreg_t a, b, c;
965
          /* Number of operands: 3 */
966
          a = (insn >> 21) & 0x1f;
967
          #define SET_PARAM0(val) cpu_state.reg[a] = val
968
          #define PARAM0 cpu_state.reg[a]
969
          b = (insn >> 16) & 0x1f;
970
          #define PARAM1 cpu_state.reg[b]
971
          c = (insn >> 11) & 0x1f;
972
          #define PARAM2 cpu_state.reg[c]
973
          l_invalid ();
974
          #undef SET_PARAM
975
          #undef PARAM0
976
          #undef PARAM1
977
          #undef PARAM2
978
 
979
          if (do_stats) {
980
            current->insn_index = 27;   /* "lv.any_ge.b" */
981
            analysis(current);
982
          }
983
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
984
        }
985
        break;
986
      case 0x3:
987
        /* Instruction: lv.any_ge.h */
988
        {
989
          uorreg_t a, b, c;
990
          /* Number of operands: 3 */
991
          a = (insn >> 21) & 0x1f;
992
          #define SET_PARAM0(val) cpu_state.reg[a] = val
993
          #define PARAM0 cpu_state.reg[a]
994
          b = (insn >> 16) & 0x1f;
995
          #define PARAM1 cpu_state.reg[b]
996
          c = (insn >> 11) & 0x1f;
997
          #define PARAM2 cpu_state.reg[c]
998
          l_invalid ();
999
          #undef SET_PARAM
1000
          #undef PARAM0
1001
          #undef PARAM1
1002
          #undef PARAM2
1003
 
1004
          if (do_stats) {
1005
            current->insn_index = 28;   /* "lv.any_ge.h" */
1006
            analysis(current);
1007
          }
1008
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1009
        }
1010
        break;
1011
      case 0x4:
1012
        /* Instruction: lv.any_gt.b */
1013
        {
1014
          uorreg_t a, b, c;
1015
          /* Number of operands: 3 */
1016
          a = (insn >> 21) & 0x1f;
1017
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1018
          #define PARAM0 cpu_state.reg[a]
1019
          b = (insn >> 16) & 0x1f;
1020
          #define PARAM1 cpu_state.reg[b]
1021
          c = (insn >> 11) & 0x1f;
1022
          #define PARAM2 cpu_state.reg[c]
1023
          l_invalid ();
1024
          #undef SET_PARAM
1025
          #undef PARAM0
1026
          #undef PARAM1
1027
          #undef PARAM2
1028
 
1029
          if (do_stats) {
1030
            current->insn_index = 29;   /* "lv.any_gt.b" */
1031
            analysis(current);
1032
          }
1033
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1034
        }
1035
        break;
1036
      case 0x5:
1037
        /* Instruction: lv.any_gt.h */
1038
        {
1039
          uorreg_t a, b, c;
1040
          /* Number of operands: 3 */
1041
          a = (insn >> 21) & 0x1f;
1042
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1043
          #define PARAM0 cpu_state.reg[a]
1044
          b = (insn >> 16) & 0x1f;
1045
          #define PARAM1 cpu_state.reg[b]
1046
          c = (insn >> 11) & 0x1f;
1047
          #define PARAM2 cpu_state.reg[c]
1048
          l_invalid ();
1049
          #undef SET_PARAM
1050
          #undef PARAM0
1051
          #undef PARAM1
1052
          #undef PARAM2
1053
 
1054
          if (do_stats) {
1055
            current->insn_index = 30;   /* "lv.any_gt.h" */
1056
            analysis(current);
1057
          }
1058
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1059
        }
1060
        break;
1061
      case 0x6:
1062
        /* Instruction: lv.any_le.b */
1063
        {
1064
          uorreg_t a, b, c;
1065
          /* Number of operands: 3 */
1066
          a = (insn >> 21) & 0x1f;
1067
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1068
          #define PARAM0 cpu_state.reg[a]
1069
          b = (insn >> 16) & 0x1f;
1070
          #define PARAM1 cpu_state.reg[b]
1071
          c = (insn >> 11) & 0x1f;
1072
          #define PARAM2 cpu_state.reg[c]
1073
          l_invalid ();
1074
          #undef SET_PARAM
1075
          #undef PARAM0
1076
          #undef PARAM1
1077
          #undef PARAM2
1078
 
1079
          if (do_stats) {
1080
            current->insn_index = 31;   /* "lv.any_le.b" */
1081
            analysis(current);
1082
          }
1083
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1084
        }
1085
        break;
1086
      case 0x7:
1087
        /* Instruction: lv.any_le.h */
1088
        {
1089
          uorreg_t a, b, c;
1090
          /* Number of operands: 3 */
1091
          a = (insn >> 21) & 0x1f;
1092
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1093
          #define PARAM0 cpu_state.reg[a]
1094
          b = (insn >> 16) & 0x1f;
1095
          #define PARAM1 cpu_state.reg[b]
1096
          c = (insn >> 11) & 0x1f;
1097
          #define PARAM2 cpu_state.reg[c]
1098
          l_invalid ();
1099
          #undef SET_PARAM
1100
          #undef PARAM0
1101
          #undef PARAM1
1102
          #undef PARAM2
1103
 
1104
          if (do_stats) {
1105
            current->insn_index = 32;   /* "lv.any_le.h" */
1106
            analysis(current);
1107
          }
1108
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1109
        }
1110
        break;
1111
      case 0x8:
1112
        /* Instruction: lv.any_lt.b */
1113
        {
1114
          uorreg_t a, b, c;
1115
          /* Number of operands: 3 */
1116
          a = (insn >> 21) & 0x1f;
1117
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1118
          #define PARAM0 cpu_state.reg[a]
1119
          b = (insn >> 16) & 0x1f;
1120
          #define PARAM1 cpu_state.reg[b]
1121
          c = (insn >> 11) & 0x1f;
1122
          #define PARAM2 cpu_state.reg[c]
1123
          l_invalid ();
1124
          #undef SET_PARAM
1125
          #undef PARAM0
1126
          #undef PARAM1
1127
          #undef PARAM2
1128
 
1129
          if (do_stats) {
1130
            current->insn_index = 33;   /* "lv.any_lt.b" */
1131
            analysis(current);
1132
          }
1133
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1134
        }
1135
        break;
1136
      case 0x9:
1137
        /* Instruction: lv.any_lt.h */
1138
        {
1139
          uorreg_t a, b, c;
1140
          /* Number of operands: 3 */
1141
          a = (insn >> 21) & 0x1f;
1142
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1143
          #define PARAM0 cpu_state.reg[a]
1144
          b = (insn >> 16) & 0x1f;
1145
          #define PARAM1 cpu_state.reg[b]
1146
          c = (insn >> 11) & 0x1f;
1147
          #define PARAM2 cpu_state.reg[c]
1148
          l_invalid ();
1149
          #undef SET_PARAM
1150
          #undef PARAM0
1151
          #undef PARAM1
1152
          #undef PARAM2
1153
 
1154
          if (do_stats) {
1155
            current->insn_index = 34;   /* "lv.any_lt.h" */
1156
            analysis(current);
1157
          }
1158
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1159
        }
1160
        break;
1161
      case 0xa:
1162
        /* Instruction: lv.any_ne.b */
1163
        {
1164
          uorreg_t a, b, c;
1165
          /* Number of operands: 3 */
1166
          a = (insn >> 21) & 0x1f;
1167
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1168
          #define PARAM0 cpu_state.reg[a]
1169
          b = (insn >> 16) & 0x1f;
1170
          #define PARAM1 cpu_state.reg[b]
1171
          c = (insn >> 11) & 0x1f;
1172
          #define PARAM2 cpu_state.reg[c]
1173
          l_invalid ();
1174
          #undef SET_PARAM
1175
          #undef PARAM0
1176
          #undef PARAM1
1177
          #undef PARAM2
1178
 
1179
          if (do_stats) {
1180
            current->insn_index = 35;   /* "lv.any_ne.b" */
1181
            analysis(current);
1182
          }
1183
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1184
        }
1185
        break;
1186
      case 0xb:
1187
        /* Instruction: lv.any_ne.h */
1188
        {
1189
          uorreg_t a, b, c;
1190
          /* Number of operands: 3 */
1191
          a = (insn >> 21) & 0x1f;
1192
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1193
          #define PARAM0 cpu_state.reg[a]
1194
          b = (insn >> 16) & 0x1f;
1195
          #define PARAM1 cpu_state.reg[b]
1196
          c = (insn >> 11) & 0x1f;
1197
          #define PARAM2 cpu_state.reg[c]
1198
          l_invalid ();
1199
          #undef SET_PARAM
1200
          #undef PARAM0
1201
          #undef PARAM1
1202
          #undef PARAM2
1203
 
1204
          if (do_stats) {
1205
            current->insn_index = 36;   /* "lv.any_ne.h" */
1206
            analysis(current);
1207
          }
1208
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1209
        }
1210
        break;
1211
      case 0xc:
1212
      case 0xd:
1213
      case 0xe:
1214
      case 0xf:
1215
        /* Invalid instruction(s) */
1216
        break;
1217
      }
1218
      break;
1219
    case 0x3:
1220
      switch((insn >> 0) & 0xf) {
1221
      case 0x0:
1222
        /* Instruction: lv.add.b */
1223
        {
1224
          uorreg_t a, b, c;
1225
          /* Number of operands: 3 */
1226
          a = (insn >> 21) & 0x1f;
1227
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1228
          #define PARAM0 cpu_state.reg[a]
1229
          b = (insn >> 16) & 0x1f;
1230
          #define PARAM1 cpu_state.reg[b]
1231
          c = (insn >> 11) & 0x1f;
1232
          #define PARAM2 cpu_state.reg[c]
1233
          l_invalid ();
1234
          #undef SET_PARAM
1235
          #undef PARAM0
1236
          #undef PARAM1
1237
          #undef PARAM2
1238
 
1239
          if (do_stats) {
1240
            current->insn_index = 37;   /* "lv.add.b" */
1241
            analysis(current);
1242
          }
1243
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1244
        }
1245
        break;
1246
      case 0x1:
1247
        /* Instruction: lv.add.h */
1248
        {
1249
          uorreg_t a, b, c;
1250
          /* Number of operands: 3 */
1251
          a = (insn >> 21) & 0x1f;
1252
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1253
          #define PARAM0 cpu_state.reg[a]
1254
          b = (insn >> 16) & 0x1f;
1255
          #define PARAM1 cpu_state.reg[b]
1256
          c = (insn >> 11) & 0x1f;
1257
          #define PARAM2 cpu_state.reg[c]
1258
          l_invalid ();
1259
          #undef SET_PARAM
1260
          #undef PARAM0
1261
          #undef PARAM1
1262
          #undef PARAM2
1263
 
1264
          if (do_stats) {
1265
            current->insn_index = 38;   /* "lv.add.h" */
1266
            analysis(current);
1267
          }
1268
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1269
        }
1270
        break;
1271
      case 0x2:
1272
        /* Instruction: lv.adds.b */
1273
        {
1274
          uorreg_t a, b, c;
1275
          /* Number of operands: 3 */
1276
          a = (insn >> 21) & 0x1f;
1277
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1278
          #define PARAM0 cpu_state.reg[a]
1279
          b = (insn >> 16) & 0x1f;
1280
          #define PARAM1 cpu_state.reg[b]
1281
          c = (insn >> 11) & 0x1f;
1282
          #define PARAM2 cpu_state.reg[c]
1283
          l_invalid ();
1284
          #undef SET_PARAM
1285
          #undef PARAM0
1286
          #undef PARAM1
1287
          #undef PARAM2
1288
 
1289
          if (do_stats) {
1290
            current->insn_index = 39;   /* "lv.adds.b" */
1291
            analysis(current);
1292
          }
1293
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1294
        }
1295
        break;
1296
      case 0x3:
1297
        /* Instruction: lv.adds.h */
1298
        {
1299
          uorreg_t a, b, c;
1300
          /* Number of operands: 3 */
1301
          a = (insn >> 21) & 0x1f;
1302
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1303
          #define PARAM0 cpu_state.reg[a]
1304
          b = (insn >> 16) & 0x1f;
1305
          #define PARAM1 cpu_state.reg[b]
1306
          c = (insn >> 11) & 0x1f;
1307
          #define PARAM2 cpu_state.reg[c]
1308
          l_invalid ();
1309
          #undef SET_PARAM
1310
          #undef PARAM0
1311
          #undef PARAM1
1312
          #undef PARAM2
1313
 
1314
          if (do_stats) {
1315
            current->insn_index = 40;   /* "lv.adds.h" */
1316
            analysis(current);
1317
          }
1318
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1319
        }
1320
        break;
1321
      case 0x4:
1322
        /* Instruction: lv.addu.b */
1323
        {
1324
          uorreg_t a, b, c;
1325
          /* Number of operands: 3 */
1326
          a = (insn >> 21) & 0x1f;
1327
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1328
          #define PARAM0 cpu_state.reg[a]
1329
          b = (insn >> 16) & 0x1f;
1330
          #define PARAM1 cpu_state.reg[b]
1331
          c = (insn >> 11) & 0x1f;
1332
          #define PARAM2 cpu_state.reg[c]
1333
          l_invalid ();
1334
          #undef SET_PARAM
1335
          #undef PARAM0
1336
          #undef PARAM1
1337
          #undef PARAM2
1338
 
1339
          if (do_stats) {
1340
            current->insn_index = 41;   /* "lv.addu.b" */
1341
            analysis(current);
1342
          }
1343
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1344
        }
1345
        break;
1346
      case 0x5:
1347
        /* Instruction: lv.addu.h */
1348
        {
1349
          uorreg_t a, b, c;
1350
          /* Number of operands: 3 */
1351
          a = (insn >> 21) & 0x1f;
1352
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1353
          #define PARAM0 cpu_state.reg[a]
1354
          b = (insn >> 16) & 0x1f;
1355
          #define PARAM1 cpu_state.reg[b]
1356
          c = (insn >> 11) & 0x1f;
1357
          #define PARAM2 cpu_state.reg[c]
1358
          l_invalid ();
1359
          #undef SET_PARAM
1360
          #undef PARAM0
1361
          #undef PARAM1
1362
          #undef PARAM2
1363
 
1364
          if (do_stats) {
1365
            current->insn_index = 42;   /* "lv.addu.h" */
1366
            analysis(current);
1367
          }
1368
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1369
        }
1370
        break;
1371
      case 0x6:
1372
        /* Instruction: lv.addus.b */
1373
        {
1374
          uorreg_t a, b, c;
1375
          /* Number of operands: 3 */
1376
          a = (insn >> 21) & 0x1f;
1377
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1378
          #define PARAM0 cpu_state.reg[a]
1379
          b = (insn >> 16) & 0x1f;
1380
          #define PARAM1 cpu_state.reg[b]
1381
          c = (insn >> 11) & 0x1f;
1382
          #define PARAM2 cpu_state.reg[c]
1383
          l_invalid ();
1384
          #undef SET_PARAM
1385
          #undef PARAM0
1386
          #undef PARAM1
1387
          #undef PARAM2
1388
 
1389
          if (do_stats) {
1390
            current->insn_index = 43;   /* "lv.addus.b" */
1391
            analysis(current);
1392
          }
1393
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1394
        }
1395
        break;
1396
      case 0x7:
1397
        /* Instruction: lv.addus.h */
1398
        {
1399
          uorreg_t a, b, c;
1400
          /* Number of operands: 3 */
1401
          a = (insn >> 21) & 0x1f;
1402
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1403
          #define PARAM0 cpu_state.reg[a]
1404
          b = (insn >> 16) & 0x1f;
1405
          #define PARAM1 cpu_state.reg[b]
1406
          c = (insn >> 11) & 0x1f;
1407
          #define PARAM2 cpu_state.reg[c]
1408
          l_invalid ();
1409
          #undef SET_PARAM
1410
          #undef PARAM0
1411
          #undef PARAM1
1412
          #undef PARAM2
1413
 
1414
          if (do_stats) {
1415
            current->insn_index = 44;   /* "lv.addus.h" */
1416
            analysis(current);
1417
          }
1418
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1419
        }
1420
        break;
1421
      case 0x8:
1422
        /* Instruction: lv.and */
1423
        {
1424
          uorreg_t a, b, c;
1425
          /* Number of operands: 3 */
1426
          a = (insn >> 21) & 0x1f;
1427
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1428
          #define PARAM0 cpu_state.reg[a]
1429
          b = (insn >> 16) & 0x1f;
1430
          #define PARAM1 cpu_state.reg[b]
1431
          c = (insn >> 11) & 0x1f;
1432
          #define PARAM2 cpu_state.reg[c]
1433
          l_invalid ();
1434
          #undef SET_PARAM
1435
          #undef PARAM0
1436
          #undef PARAM1
1437
          #undef PARAM2
1438
 
1439
          if (do_stats) {
1440
            current->insn_index = 45;   /* "lv.and" */
1441
            analysis(current);
1442
          }
1443
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1444
        }
1445
        break;
1446
      case 0x9:
1447
        /* Instruction: lv.avg.b */
1448
        {
1449
          uorreg_t a, b, c;
1450
          /* Number of operands: 3 */
1451
          a = (insn >> 21) & 0x1f;
1452
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1453
          #define PARAM0 cpu_state.reg[a]
1454
          b = (insn >> 16) & 0x1f;
1455
          #define PARAM1 cpu_state.reg[b]
1456
          c = (insn >> 11) & 0x1f;
1457
          #define PARAM2 cpu_state.reg[c]
1458
          l_invalid ();
1459
          #undef SET_PARAM
1460
          #undef PARAM0
1461
          #undef PARAM1
1462
          #undef PARAM2
1463
 
1464
          if (do_stats) {
1465
            current->insn_index = 46;   /* "lv.avg.b" */
1466
            analysis(current);
1467
          }
1468
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1469
        }
1470
        break;
1471
      case 0xa:
1472
        /* Instruction: lv.avg.h */
1473
        {
1474
          uorreg_t a, b, c;
1475
          /* Number of operands: 3 */
1476
          a = (insn >> 21) & 0x1f;
1477
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1478
          #define PARAM0 cpu_state.reg[a]
1479
          b = (insn >> 16) & 0x1f;
1480
          #define PARAM1 cpu_state.reg[b]
1481
          c = (insn >> 11) & 0x1f;
1482
          #define PARAM2 cpu_state.reg[c]
1483
          l_invalid ();
1484
          #undef SET_PARAM
1485
          #undef PARAM0
1486
          #undef PARAM1
1487
          #undef PARAM2
1488
 
1489
          if (do_stats) {
1490
            current->insn_index = 47;   /* "lv.avg.h" */
1491
            analysis(current);
1492
          }
1493
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1494
        }
1495
        break;
1496
      case 0xb:
1497
      case 0xc:
1498
      case 0xd:
1499
      case 0xe:
1500
      case 0xf:
1501
        /* Invalid instruction(s) */
1502
        break;
1503
      }
1504
      break;
1505
    case 0x4:
1506
      switch((insn >> 0) & 0xf) {
1507
      case 0x0:
1508
        /* Instruction: lv.cmp_eq.b */
1509
        {
1510
          uorreg_t a, b, c;
1511
          /* Number of operands: 3 */
1512
          a = (insn >> 21) & 0x1f;
1513
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1514
          #define PARAM0 cpu_state.reg[a]
1515
          b = (insn >> 16) & 0x1f;
1516
          #define PARAM1 cpu_state.reg[b]
1517
          c = (insn >> 11) & 0x1f;
1518
          #define PARAM2 cpu_state.reg[c]
1519
          l_invalid ();
1520
          #undef SET_PARAM
1521
          #undef PARAM0
1522
          #undef PARAM1
1523
          #undef PARAM2
1524
 
1525
          if (do_stats) {
1526
            current->insn_index = 48;   /* "lv.cmp_eq.b" */
1527
            analysis(current);
1528
          }
1529
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1530
        }
1531
        break;
1532
      case 0x1:
1533
        /* Instruction: lv.cmp_eq.h */
1534
        {
1535
          uorreg_t a, b, c;
1536
          /* Number of operands: 3 */
1537
          a = (insn >> 21) & 0x1f;
1538
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1539
          #define PARAM0 cpu_state.reg[a]
1540
          b = (insn >> 16) & 0x1f;
1541
          #define PARAM1 cpu_state.reg[b]
1542
          c = (insn >> 11) & 0x1f;
1543
          #define PARAM2 cpu_state.reg[c]
1544
          l_invalid ();
1545
          #undef SET_PARAM
1546
          #undef PARAM0
1547
          #undef PARAM1
1548
          #undef PARAM2
1549
 
1550
          if (do_stats) {
1551
            current->insn_index = 49;   /* "lv.cmp_eq.h" */
1552
            analysis(current);
1553
          }
1554
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1555
        }
1556
        break;
1557
      case 0x2:
1558
        /* Instruction: lv.cmp_ge.b */
1559
        {
1560
          uorreg_t a, b, c;
1561
          /* Number of operands: 3 */
1562
          a = (insn >> 21) & 0x1f;
1563
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1564
          #define PARAM0 cpu_state.reg[a]
1565
          b = (insn >> 16) & 0x1f;
1566
          #define PARAM1 cpu_state.reg[b]
1567
          c = (insn >> 11) & 0x1f;
1568
          #define PARAM2 cpu_state.reg[c]
1569
          l_invalid ();
1570
          #undef SET_PARAM
1571
          #undef PARAM0
1572
          #undef PARAM1
1573
          #undef PARAM2
1574
 
1575
          if (do_stats) {
1576
            current->insn_index = 50;   /* "lv.cmp_ge.b" */
1577
            analysis(current);
1578
          }
1579
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1580
        }
1581
        break;
1582
      case 0x3:
1583
        /* Instruction: lv.cmp_ge.h */
1584
        {
1585
          uorreg_t a, b, c;
1586
          /* Number of operands: 3 */
1587
          a = (insn >> 21) & 0x1f;
1588
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1589
          #define PARAM0 cpu_state.reg[a]
1590
          b = (insn >> 16) & 0x1f;
1591
          #define PARAM1 cpu_state.reg[b]
1592
          c = (insn >> 11) & 0x1f;
1593
          #define PARAM2 cpu_state.reg[c]
1594
          l_invalid ();
1595
          #undef SET_PARAM
1596
          #undef PARAM0
1597
          #undef PARAM1
1598
          #undef PARAM2
1599
 
1600
          if (do_stats) {
1601
            current->insn_index = 51;   /* "lv.cmp_ge.h" */
1602
            analysis(current);
1603
          }
1604
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1605
        }
1606
        break;
1607
      case 0x4:
1608
        /* Instruction: lv.cmp_gt.b */
1609
        {
1610
          uorreg_t a, b, c;
1611
          /* Number of operands: 3 */
1612
          a = (insn >> 21) & 0x1f;
1613
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1614
          #define PARAM0 cpu_state.reg[a]
1615
          b = (insn >> 16) & 0x1f;
1616
          #define PARAM1 cpu_state.reg[b]
1617
          c = (insn >> 11) & 0x1f;
1618
          #define PARAM2 cpu_state.reg[c]
1619
          l_invalid ();
1620
          #undef SET_PARAM
1621
          #undef PARAM0
1622
          #undef PARAM1
1623
          #undef PARAM2
1624
 
1625
          if (do_stats) {
1626
            current->insn_index = 52;   /* "lv.cmp_gt.b" */
1627
            analysis(current);
1628
          }
1629
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1630
        }
1631
        break;
1632
      case 0x5:
1633
        /* Instruction: lv.cmp_gt.h */
1634
        {
1635
          uorreg_t a, b, c;
1636
          /* Number of operands: 3 */
1637
          a = (insn >> 21) & 0x1f;
1638
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1639
          #define PARAM0 cpu_state.reg[a]
1640
          b = (insn >> 16) & 0x1f;
1641
          #define PARAM1 cpu_state.reg[b]
1642
          c = (insn >> 11) & 0x1f;
1643
          #define PARAM2 cpu_state.reg[c]
1644
          l_invalid ();
1645
          #undef SET_PARAM
1646
          #undef PARAM0
1647
          #undef PARAM1
1648
          #undef PARAM2
1649
 
1650
          if (do_stats) {
1651
            current->insn_index = 53;   /* "lv.cmp_gt.h" */
1652
            analysis(current);
1653
          }
1654
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1655
        }
1656
        break;
1657
      case 0x6:
1658
        /* Instruction: lv.cmp_le.b */
1659
        {
1660
          uorreg_t a, b, c;
1661
          /* Number of operands: 3 */
1662
          a = (insn >> 21) & 0x1f;
1663
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1664
          #define PARAM0 cpu_state.reg[a]
1665
          b = (insn >> 16) & 0x1f;
1666
          #define PARAM1 cpu_state.reg[b]
1667
          c = (insn >> 11) & 0x1f;
1668
          #define PARAM2 cpu_state.reg[c]
1669
          l_invalid ();
1670
          #undef SET_PARAM
1671
          #undef PARAM0
1672
          #undef PARAM1
1673
          #undef PARAM2
1674
 
1675
          if (do_stats) {
1676
            current->insn_index = 54;   /* "lv.cmp_le.b" */
1677
            analysis(current);
1678
          }
1679
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1680
        }
1681
        break;
1682
      case 0x7:
1683
        /* Instruction: lv.cmp_le.h */
1684
        {
1685
          uorreg_t a, b, c;
1686
          /* Number of operands: 3 */
1687
          a = (insn >> 21) & 0x1f;
1688
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1689
          #define PARAM0 cpu_state.reg[a]
1690
          b = (insn >> 16) & 0x1f;
1691
          #define PARAM1 cpu_state.reg[b]
1692
          c = (insn >> 11) & 0x1f;
1693
          #define PARAM2 cpu_state.reg[c]
1694
          l_invalid ();
1695
          #undef SET_PARAM
1696
          #undef PARAM0
1697
          #undef PARAM1
1698
          #undef PARAM2
1699
 
1700
          if (do_stats) {
1701
            current->insn_index = 55;   /* "lv.cmp_le.h" */
1702
            analysis(current);
1703
          }
1704
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1705
        }
1706
        break;
1707
      case 0x8:
1708
        /* Instruction: lv.cmp_lt.b */
1709
        {
1710
          uorreg_t a, b, c;
1711
          /* Number of operands: 3 */
1712
          a = (insn >> 21) & 0x1f;
1713
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1714
          #define PARAM0 cpu_state.reg[a]
1715
          b = (insn >> 16) & 0x1f;
1716
          #define PARAM1 cpu_state.reg[b]
1717
          c = (insn >> 11) & 0x1f;
1718
          #define PARAM2 cpu_state.reg[c]
1719
          l_invalid ();
1720
          #undef SET_PARAM
1721
          #undef PARAM0
1722
          #undef PARAM1
1723
          #undef PARAM2
1724
 
1725
          if (do_stats) {
1726
            current->insn_index = 56;   /* "lv.cmp_lt.b" */
1727
            analysis(current);
1728
          }
1729
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1730
        }
1731
        break;
1732
      case 0x9:
1733
        /* Instruction: lv.cmp_lt.h */
1734
        {
1735
          uorreg_t a, b, c;
1736
          /* Number of operands: 3 */
1737
          a = (insn >> 21) & 0x1f;
1738
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1739
          #define PARAM0 cpu_state.reg[a]
1740
          b = (insn >> 16) & 0x1f;
1741
          #define PARAM1 cpu_state.reg[b]
1742
          c = (insn >> 11) & 0x1f;
1743
          #define PARAM2 cpu_state.reg[c]
1744
          l_invalid ();
1745
          #undef SET_PARAM
1746
          #undef PARAM0
1747
          #undef PARAM1
1748
          #undef PARAM2
1749
 
1750
          if (do_stats) {
1751
            current->insn_index = 57;   /* "lv.cmp_lt.h" */
1752
            analysis(current);
1753
          }
1754
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1755
        }
1756
        break;
1757
      case 0xa:
1758
        /* Instruction: lv.cmp_ne.b */
1759
        {
1760
          uorreg_t a, b, c;
1761
          /* Number of operands: 3 */
1762
          a = (insn >> 21) & 0x1f;
1763
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1764
          #define PARAM0 cpu_state.reg[a]
1765
          b = (insn >> 16) & 0x1f;
1766
          #define PARAM1 cpu_state.reg[b]
1767
          c = (insn >> 11) & 0x1f;
1768
          #define PARAM2 cpu_state.reg[c]
1769
          l_invalid ();
1770
          #undef SET_PARAM
1771
          #undef PARAM0
1772
          #undef PARAM1
1773
          #undef PARAM2
1774
 
1775
          if (do_stats) {
1776
            current->insn_index = 58;   /* "lv.cmp_ne.b" */
1777
            analysis(current);
1778
          }
1779
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1780
        }
1781
        break;
1782
      case 0xb:
1783
        /* Instruction: lv.cmp_ne.h */
1784
        {
1785
          uorreg_t a, b, c;
1786
          /* Number of operands: 3 */
1787
          a = (insn >> 21) & 0x1f;
1788
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1789
          #define PARAM0 cpu_state.reg[a]
1790
          b = (insn >> 16) & 0x1f;
1791
          #define PARAM1 cpu_state.reg[b]
1792
          c = (insn >> 11) & 0x1f;
1793
          #define PARAM2 cpu_state.reg[c]
1794
          l_invalid ();
1795
          #undef SET_PARAM
1796
          #undef PARAM0
1797
          #undef PARAM1
1798
          #undef PARAM2
1799
 
1800
          if (do_stats) {
1801
            current->insn_index = 59;   /* "lv.cmp_ne.h" */
1802
            analysis(current);
1803
          }
1804
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1805
        }
1806
        break;
1807
      case 0xc:
1808
      case 0xd:
1809
      case 0xe:
1810
      case 0xf:
1811
        /* Invalid instruction(s) */
1812
        break;
1813
      }
1814
      break;
1815
    case 0x5:
1816
      switch((insn >> 0) & 0xf) {
1817
      case 0x0:
1818
      case 0x1:
1819
      case 0x2:
1820
      case 0x3:
1821
        /* Invalid instruction(s) */
1822
        break;
1823
      case 0x4:
1824
        /* Instruction: lv.madds.h */
1825
        {
1826
          uorreg_t a, b, c;
1827
          /* Number of operands: 3 */
1828
          a = (insn >> 21) & 0x1f;
1829
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1830
          #define PARAM0 cpu_state.reg[a]
1831
          b = (insn >> 16) & 0x1f;
1832
          #define PARAM1 cpu_state.reg[b]
1833
          c = (insn >> 11) & 0x1f;
1834
          #define PARAM2 cpu_state.reg[c]
1835
          l_invalid ();
1836
          #undef SET_PARAM
1837
          #undef PARAM0
1838
          #undef PARAM1
1839
          #undef PARAM2
1840
 
1841
          if (do_stats) {
1842
            current->insn_index = 60;   /* "lv.madds.h" */
1843
            analysis(current);
1844
          }
1845
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1846
        }
1847
        break;
1848
      case 0x5:
1849
        /* Instruction: lv.max.b */
1850
        {
1851
          uorreg_t a, b, c;
1852
          /* Number of operands: 3 */
1853
          a = (insn >> 21) & 0x1f;
1854
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1855
          #define PARAM0 cpu_state.reg[a]
1856
          b = (insn >> 16) & 0x1f;
1857
          #define PARAM1 cpu_state.reg[b]
1858
          c = (insn >> 11) & 0x1f;
1859
          #define PARAM2 cpu_state.reg[c]
1860
          l_invalid ();
1861
          #undef SET_PARAM
1862
          #undef PARAM0
1863
          #undef PARAM1
1864
          #undef PARAM2
1865
 
1866
          if (do_stats) {
1867
            current->insn_index = 61;   /* "lv.max.b" */
1868
            analysis(current);
1869
          }
1870
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1871
        }
1872
        break;
1873
      case 0x6:
1874
        /* Instruction: lv.max.h */
1875
        {
1876
          uorreg_t a, b, c;
1877
          /* Number of operands: 3 */
1878
          a = (insn >> 21) & 0x1f;
1879
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1880
          #define PARAM0 cpu_state.reg[a]
1881
          b = (insn >> 16) & 0x1f;
1882
          #define PARAM1 cpu_state.reg[b]
1883
          c = (insn >> 11) & 0x1f;
1884
          #define PARAM2 cpu_state.reg[c]
1885
          l_invalid ();
1886
          #undef SET_PARAM
1887
          #undef PARAM0
1888
          #undef PARAM1
1889
          #undef PARAM2
1890
 
1891
          if (do_stats) {
1892
            current->insn_index = 62;   /* "lv.max.h" */
1893
            analysis(current);
1894
          }
1895
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1896
        }
1897
        break;
1898
      case 0x7:
1899
        /* Instruction: lv.merge.b */
1900
        {
1901
          uorreg_t a, b, c;
1902
          /* Number of operands: 3 */
1903
          a = (insn >> 21) & 0x1f;
1904
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1905
          #define PARAM0 cpu_state.reg[a]
1906
          b = (insn >> 16) & 0x1f;
1907
          #define PARAM1 cpu_state.reg[b]
1908
          c = (insn >> 11) & 0x1f;
1909
          #define PARAM2 cpu_state.reg[c]
1910
          l_invalid ();
1911
          #undef SET_PARAM
1912
          #undef PARAM0
1913
          #undef PARAM1
1914
          #undef PARAM2
1915
 
1916
          if (do_stats) {
1917
            current->insn_index = 63;   /* "lv.merge.b" */
1918
            analysis(current);
1919
          }
1920
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1921
        }
1922
        break;
1923
      case 0x8:
1924
        /* Instruction: lv.merge.h */
1925
        {
1926
          uorreg_t a, b, c;
1927
          /* Number of operands: 3 */
1928
          a = (insn >> 21) & 0x1f;
1929
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1930
          #define PARAM0 cpu_state.reg[a]
1931
          b = (insn >> 16) & 0x1f;
1932
          #define PARAM1 cpu_state.reg[b]
1933
          c = (insn >> 11) & 0x1f;
1934
          #define PARAM2 cpu_state.reg[c]
1935
          l_invalid ();
1936
          #undef SET_PARAM
1937
          #undef PARAM0
1938
          #undef PARAM1
1939
          #undef PARAM2
1940
 
1941
          if (do_stats) {
1942
            current->insn_index = 64;   /* "lv.merge.h" */
1943
            analysis(current);
1944
          }
1945
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1946
        }
1947
        break;
1948
      case 0x9:
1949
        /* Instruction: lv.min.b */
1950
        {
1951
          uorreg_t a, b, c;
1952
          /* Number of operands: 3 */
1953
          a = (insn >> 21) & 0x1f;
1954
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1955
          #define PARAM0 cpu_state.reg[a]
1956
          b = (insn >> 16) & 0x1f;
1957
          #define PARAM1 cpu_state.reg[b]
1958
          c = (insn >> 11) & 0x1f;
1959
          #define PARAM2 cpu_state.reg[c]
1960
          l_invalid ();
1961
          #undef SET_PARAM
1962
          #undef PARAM0
1963
          #undef PARAM1
1964
          #undef PARAM2
1965
 
1966
          if (do_stats) {
1967
            current->insn_index = 65;   /* "lv.min.b" */
1968
            analysis(current);
1969
          }
1970
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1971
        }
1972
        break;
1973
      case 0xa:
1974
        /* Instruction: lv.min.h */
1975
        {
1976
          uorreg_t a, b, c;
1977
          /* Number of operands: 3 */
1978
          a = (insn >> 21) & 0x1f;
1979
          #define SET_PARAM0(val) cpu_state.reg[a] = val
1980
          #define PARAM0 cpu_state.reg[a]
1981
          b = (insn >> 16) & 0x1f;
1982
          #define PARAM1 cpu_state.reg[b]
1983
          c = (insn >> 11) & 0x1f;
1984
          #define PARAM2 cpu_state.reg[c]
1985
          l_invalid ();
1986
          #undef SET_PARAM
1987
          #undef PARAM0
1988
          #undef PARAM1
1989
          #undef PARAM2
1990
 
1991
          if (do_stats) {
1992
            current->insn_index = 66;   /* "lv.min.h" */
1993
            analysis(current);
1994
          }
1995
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
1996
        }
1997
        break;
1998
      case 0xb:
1999
        /* Instruction: lv.msubs.h */
2000
        {
2001
          uorreg_t a, b, c;
2002
          /* Number of operands: 3 */
2003
          a = (insn >> 21) & 0x1f;
2004
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2005
          #define PARAM0 cpu_state.reg[a]
2006
          b = (insn >> 16) & 0x1f;
2007
          #define PARAM1 cpu_state.reg[b]
2008
          c = (insn >> 11) & 0x1f;
2009
          #define PARAM2 cpu_state.reg[c]
2010
          l_invalid ();
2011
          #undef SET_PARAM
2012
          #undef PARAM0
2013
          #undef PARAM1
2014
          #undef PARAM2
2015
 
2016
          if (do_stats) {
2017
            current->insn_index = 67;   /* "lv.msubs.h" */
2018
            analysis(current);
2019
          }
2020
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2021
        }
2022
        break;
2023
      case 0xc:
2024
        /* Instruction: lv.muls.h */
2025
        {
2026
          uorreg_t a, b, c;
2027
          /* Number of operands: 3 */
2028
          a = (insn >> 21) & 0x1f;
2029
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2030
          #define PARAM0 cpu_state.reg[a]
2031
          b = (insn >> 16) & 0x1f;
2032
          #define PARAM1 cpu_state.reg[b]
2033
          c = (insn >> 11) & 0x1f;
2034
          #define PARAM2 cpu_state.reg[c]
2035
          l_invalid ();
2036
          #undef SET_PARAM
2037
          #undef PARAM0
2038
          #undef PARAM1
2039
          #undef PARAM2
2040
 
2041
          if (do_stats) {
2042
            current->insn_index = 68;   /* "lv.muls.h" */
2043
            analysis(current);
2044
          }
2045
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2046
        }
2047
        break;
2048
      case 0xd:
2049
        /* Instruction: lv.nand */
2050
        {
2051
          uorreg_t a, b, c;
2052
          /* Number of operands: 3 */
2053
          a = (insn >> 21) & 0x1f;
2054
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2055
          #define PARAM0 cpu_state.reg[a]
2056
          b = (insn >> 16) & 0x1f;
2057
          #define PARAM1 cpu_state.reg[b]
2058
          c = (insn >> 11) & 0x1f;
2059
          #define PARAM2 cpu_state.reg[c]
2060
          l_invalid ();
2061
          #undef SET_PARAM
2062
          #undef PARAM0
2063
          #undef PARAM1
2064
          #undef PARAM2
2065
 
2066
          if (do_stats) {
2067
            current->insn_index = 69;   /* "lv.nand" */
2068
            analysis(current);
2069
          }
2070
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2071
        }
2072
        break;
2073
      case 0xe:
2074
        /* Instruction: lv.nor */
2075
        {
2076
          uorreg_t a, b, c;
2077
          /* Number of operands: 3 */
2078
          a = (insn >> 21) & 0x1f;
2079
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2080
          #define PARAM0 cpu_state.reg[a]
2081
          b = (insn >> 16) & 0x1f;
2082
          #define PARAM1 cpu_state.reg[b]
2083
          c = (insn >> 11) & 0x1f;
2084
          #define PARAM2 cpu_state.reg[c]
2085
          l_invalid ();
2086
          #undef SET_PARAM
2087
          #undef PARAM0
2088
          #undef PARAM1
2089
          #undef PARAM2
2090
 
2091
          if (do_stats) {
2092
            current->insn_index = 70;   /* "lv.nor" */
2093
            analysis(current);
2094
          }
2095
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2096
        }
2097
        break;
2098
      case 0xf:
2099
        /* Instruction: lv.or */
2100
        {
2101
          uorreg_t a, b, c;
2102
          /* Number of operands: 3 */
2103
          a = (insn >> 21) & 0x1f;
2104
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2105
          #define PARAM0 cpu_state.reg[a]
2106
          b = (insn >> 16) & 0x1f;
2107
          #define PARAM1 cpu_state.reg[b]
2108
          c = (insn >> 11) & 0x1f;
2109
          #define PARAM2 cpu_state.reg[c]
2110
          l_invalid ();
2111
          #undef SET_PARAM
2112
          #undef PARAM0
2113
          #undef PARAM1
2114
          #undef PARAM2
2115
 
2116
          if (do_stats) {
2117
            current->insn_index = 71;   /* "lv.or" */
2118
            analysis(current);
2119
          }
2120
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2121
        }
2122
        break;
2123
      }
2124
      break;
2125
    case 0x6:
2126
      switch((insn >> 0) & 0xf) {
2127
      case 0x0:
2128
        /* Instruction: lv.pack.b */
2129
        {
2130
          uorreg_t a, b, c;
2131
          /* Number of operands: 3 */
2132
          a = (insn >> 21) & 0x1f;
2133
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2134
          #define PARAM0 cpu_state.reg[a]
2135
          b = (insn >> 16) & 0x1f;
2136
          #define PARAM1 cpu_state.reg[b]
2137
          c = (insn >> 11) & 0x1f;
2138
          #define PARAM2 cpu_state.reg[c]
2139
          l_invalid ();
2140
          #undef SET_PARAM
2141
          #undef PARAM0
2142
          #undef PARAM1
2143
          #undef PARAM2
2144
 
2145
          if (do_stats) {
2146
            current->insn_index = 72;   /* "lv.pack.b" */
2147
            analysis(current);
2148
          }
2149
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2150
        }
2151
        break;
2152
      case 0x1:
2153
        /* Instruction: lv.pack.h */
2154
        {
2155
          uorreg_t a, b, c;
2156
          /* Number of operands: 3 */
2157
          a = (insn >> 21) & 0x1f;
2158
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2159
          #define PARAM0 cpu_state.reg[a]
2160
          b = (insn >> 16) & 0x1f;
2161
          #define PARAM1 cpu_state.reg[b]
2162
          c = (insn >> 11) & 0x1f;
2163
          #define PARAM2 cpu_state.reg[c]
2164
          l_invalid ();
2165
          #undef SET_PARAM
2166
          #undef PARAM0
2167
          #undef PARAM1
2168
          #undef PARAM2
2169
 
2170
          if (do_stats) {
2171
            current->insn_index = 73;   /* "lv.pack.h" */
2172
            analysis(current);
2173
          }
2174
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2175
        }
2176
        break;
2177
      case 0x2:
2178
        /* Instruction: lv.packs.b */
2179
        {
2180
          uorreg_t a, b, c;
2181
          /* Number of operands: 3 */
2182
          a = (insn >> 21) & 0x1f;
2183
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2184
          #define PARAM0 cpu_state.reg[a]
2185
          b = (insn >> 16) & 0x1f;
2186
          #define PARAM1 cpu_state.reg[b]
2187
          c = (insn >> 11) & 0x1f;
2188
          #define PARAM2 cpu_state.reg[c]
2189
          l_invalid ();
2190
          #undef SET_PARAM
2191
          #undef PARAM0
2192
          #undef PARAM1
2193
          #undef PARAM2
2194
 
2195
          if (do_stats) {
2196
            current->insn_index = 74;   /* "lv.packs.b" */
2197
            analysis(current);
2198
          }
2199
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2200
        }
2201
        break;
2202
      case 0x3:
2203
        /* Instruction: lv.packs.h */
2204
        {
2205
          uorreg_t a, b, c;
2206
          /* Number of operands: 3 */
2207
          a = (insn >> 21) & 0x1f;
2208
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2209
          #define PARAM0 cpu_state.reg[a]
2210
          b = (insn >> 16) & 0x1f;
2211
          #define PARAM1 cpu_state.reg[b]
2212
          c = (insn >> 11) & 0x1f;
2213
          #define PARAM2 cpu_state.reg[c]
2214
          l_invalid ();
2215
          #undef SET_PARAM
2216
          #undef PARAM0
2217
          #undef PARAM1
2218
          #undef PARAM2
2219
 
2220
          if (do_stats) {
2221
            current->insn_index = 75;   /* "lv.packs.h" */
2222
            analysis(current);
2223
          }
2224
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2225
        }
2226
        break;
2227
      case 0x4:
2228
        /* Instruction: lv.packus.b */
2229
        {
2230
          uorreg_t a, b, c;
2231
          /* Number of operands: 3 */
2232
          a = (insn >> 21) & 0x1f;
2233
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2234
          #define PARAM0 cpu_state.reg[a]
2235
          b = (insn >> 16) & 0x1f;
2236
          #define PARAM1 cpu_state.reg[b]
2237
          c = (insn >> 11) & 0x1f;
2238
          #define PARAM2 cpu_state.reg[c]
2239
          l_invalid ();
2240
          #undef SET_PARAM
2241
          #undef PARAM0
2242
          #undef PARAM1
2243
          #undef PARAM2
2244
 
2245
          if (do_stats) {
2246
            current->insn_index = 76;   /* "lv.packus.b" */
2247
            analysis(current);
2248
          }
2249
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2250
        }
2251
        break;
2252
      case 0x5:
2253
        /* Instruction: lv.packus.h */
2254
        {
2255
          uorreg_t a, b, c;
2256
          /* Number of operands: 3 */
2257
          a = (insn >> 21) & 0x1f;
2258
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2259
          #define PARAM0 cpu_state.reg[a]
2260
          b = (insn >> 16) & 0x1f;
2261
          #define PARAM1 cpu_state.reg[b]
2262
          c = (insn >> 11) & 0x1f;
2263
          #define PARAM2 cpu_state.reg[c]
2264
          l_invalid ();
2265
          #undef SET_PARAM
2266
          #undef PARAM0
2267
          #undef PARAM1
2268
          #undef PARAM2
2269
 
2270
          if (do_stats) {
2271
            current->insn_index = 77;   /* "lv.packus.h" */
2272
            analysis(current);
2273
          }
2274
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2275
        }
2276
        break;
2277
      case 0x6:
2278
        /* Instruction: lv.perm.n */
2279
        {
2280
          uorreg_t a, b, c;
2281
          /* Number of operands: 3 */
2282
          a = (insn >> 21) & 0x1f;
2283
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2284
          #define PARAM0 cpu_state.reg[a]
2285
          b = (insn >> 16) & 0x1f;
2286
          #define PARAM1 cpu_state.reg[b]
2287
          c = (insn >> 11) & 0x1f;
2288
          #define PARAM2 cpu_state.reg[c]
2289
          l_invalid ();
2290
          #undef SET_PARAM
2291
          #undef PARAM0
2292
          #undef PARAM1
2293
          #undef PARAM2
2294
 
2295
          if (do_stats) {
2296
            current->insn_index = 78;   /* "lv.perm.n" */
2297
            analysis(current);
2298
          }
2299
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2300
        }
2301
        break;
2302
      case 0x7:
2303
        /* Instruction: lv.rl.b */
2304
        {
2305
          uorreg_t a, b, c;
2306
          /* Number of operands: 3 */
2307
          a = (insn >> 21) & 0x1f;
2308
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2309
          #define PARAM0 cpu_state.reg[a]
2310
          b = (insn >> 16) & 0x1f;
2311
          #define PARAM1 cpu_state.reg[b]
2312
          c = (insn >> 11) & 0x1f;
2313
          #define PARAM2 cpu_state.reg[c]
2314
          l_invalid ();
2315
          #undef SET_PARAM
2316
          #undef PARAM0
2317
          #undef PARAM1
2318
          #undef PARAM2
2319
 
2320
          if (do_stats) {
2321
            current->insn_index = 79;   /* "lv.rl.b" */
2322
            analysis(current);
2323
          }
2324
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2325
        }
2326
        break;
2327
      case 0x8:
2328
        /* Instruction: lv.rl.h */
2329
        {
2330
          uorreg_t a, b, c;
2331
          /* Number of operands: 3 */
2332
          a = (insn >> 21) & 0x1f;
2333
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2334
          #define PARAM0 cpu_state.reg[a]
2335
          b = (insn >> 16) & 0x1f;
2336
          #define PARAM1 cpu_state.reg[b]
2337
          c = (insn >> 11) & 0x1f;
2338
          #define PARAM2 cpu_state.reg[c]
2339
          l_invalid ();
2340
          #undef SET_PARAM
2341
          #undef PARAM0
2342
          #undef PARAM1
2343
          #undef PARAM2
2344
 
2345
          if (do_stats) {
2346
            current->insn_index = 80;   /* "lv.rl.h" */
2347
            analysis(current);
2348
          }
2349
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2350
        }
2351
        break;
2352
      case 0x9:
2353
        /* Instruction: lv.sll.b */
2354
        {
2355
          uorreg_t a, b, c;
2356
          /* Number of operands: 3 */
2357
          a = (insn >> 21) & 0x1f;
2358
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2359
          #define PARAM0 cpu_state.reg[a]
2360
          b = (insn >> 16) & 0x1f;
2361
          #define PARAM1 cpu_state.reg[b]
2362
          c = (insn >> 11) & 0x1f;
2363
          #define PARAM2 cpu_state.reg[c]
2364
          l_invalid ();
2365
          #undef SET_PARAM
2366
          #undef PARAM0
2367
          #undef PARAM1
2368
          #undef PARAM2
2369
 
2370
          if (do_stats) {
2371
            current->insn_index = 81;   /* "lv.sll.b" */
2372
            analysis(current);
2373
          }
2374
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2375
        }
2376
        break;
2377
      case 0xa:
2378
        /* Instruction: lv.sll.h */
2379
        {
2380
          uorreg_t a, b, c;
2381
          /* Number of operands: 3 */
2382
          a = (insn >> 21) & 0x1f;
2383
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2384
          #define PARAM0 cpu_state.reg[a]
2385
          b = (insn >> 16) & 0x1f;
2386
          #define PARAM1 cpu_state.reg[b]
2387
          c = (insn >> 11) & 0x1f;
2388
          #define PARAM2 cpu_state.reg[c]
2389
          l_invalid ();
2390
          #undef SET_PARAM
2391
          #undef PARAM0
2392
          #undef PARAM1
2393
          #undef PARAM2
2394
 
2395
          if (do_stats) {
2396
            current->insn_index = 82;   /* "lv.sll.h" */
2397
            analysis(current);
2398
          }
2399
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2400
        }
2401
        break;
2402
      case 0xb:
2403
        /* Instruction: lv.sll */
2404
        {
2405
          uorreg_t a, b, c;
2406
          /* Number of operands: 3 */
2407
          a = (insn >> 21) & 0x1f;
2408
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2409
          #define PARAM0 cpu_state.reg[a]
2410
          b = (insn >> 16) & 0x1f;
2411
          #define PARAM1 cpu_state.reg[b]
2412
          c = (insn >> 11) & 0x1f;
2413
          #define PARAM2 cpu_state.reg[c]
2414
          l_invalid ();
2415
          #undef SET_PARAM
2416
          #undef PARAM0
2417
          #undef PARAM1
2418
          #undef PARAM2
2419
 
2420
          if (do_stats) {
2421
            current->insn_index = 83;   /* "lv.sll" */
2422
            analysis(current);
2423
          }
2424
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2425
        }
2426
        break;
2427
      case 0xc:
2428
        /* Instruction: lv.srl.b */
2429
        {
2430
          uorreg_t a, b, c;
2431
          /* Number of operands: 3 */
2432
          a = (insn >> 21) & 0x1f;
2433
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2434
          #define PARAM0 cpu_state.reg[a]
2435
          b = (insn >> 16) & 0x1f;
2436
          #define PARAM1 cpu_state.reg[b]
2437
          c = (insn >> 11) & 0x1f;
2438
          #define PARAM2 cpu_state.reg[c]
2439
          l_invalid ();
2440
          #undef SET_PARAM
2441
          #undef PARAM0
2442
          #undef PARAM1
2443
          #undef PARAM2
2444
 
2445
          if (do_stats) {
2446
            current->insn_index = 84;   /* "lv.srl.b" */
2447
            analysis(current);
2448
          }
2449
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2450
        }
2451
        break;
2452
      case 0xd:
2453
        /* Instruction: lv.srl.h */
2454
        {
2455
          uorreg_t a, b, c;
2456
          /* Number of operands: 3 */
2457
          a = (insn >> 21) & 0x1f;
2458
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2459
          #define PARAM0 cpu_state.reg[a]
2460
          b = (insn >> 16) & 0x1f;
2461
          #define PARAM1 cpu_state.reg[b]
2462
          c = (insn >> 11) & 0x1f;
2463
          #define PARAM2 cpu_state.reg[c]
2464
          l_invalid ();
2465
          #undef SET_PARAM
2466
          #undef PARAM0
2467
          #undef PARAM1
2468
          #undef PARAM2
2469
 
2470
          if (do_stats) {
2471
            current->insn_index = 85;   /* "lv.srl.h" */
2472
            analysis(current);
2473
          }
2474
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2475
        }
2476
        break;
2477
      case 0xe:
2478
        /* Instruction: lv.sra.b */
2479
        {
2480
          uorreg_t a, b, c;
2481
          /* Number of operands: 3 */
2482
          a = (insn >> 21) & 0x1f;
2483
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2484
          #define PARAM0 cpu_state.reg[a]
2485
          b = (insn >> 16) & 0x1f;
2486
          #define PARAM1 cpu_state.reg[b]
2487
          c = (insn >> 11) & 0x1f;
2488
          #define PARAM2 cpu_state.reg[c]
2489
          l_invalid ();
2490
          #undef SET_PARAM
2491
          #undef PARAM0
2492
          #undef PARAM1
2493
          #undef PARAM2
2494
 
2495
          if (do_stats) {
2496
            current->insn_index = 86;   /* "lv.sra.b" */
2497
            analysis(current);
2498
          }
2499
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2500
        }
2501
        break;
2502
      case 0xf:
2503
        /* Instruction: lv.sra.h */
2504
        {
2505
          uorreg_t a, b, c;
2506
          /* Number of operands: 3 */
2507
          a = (insn >> 21) & 0x1f;
2508
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2509
          #define PARAM0 cpu_state.reg[a]
2510
          b = (insn >> 16) & 0x1f;
2511
          #define PARAM1 cpu_state.reg[b]
2512
          c = (insn >> 11) & 0x1f;
2513
          #define PARAM2 cpu_state.reg[c]
2514
          l_invalid ();
2515
          #undef SET_PARAM
2516
          #undef PARAM0
2517
          #undef PARAM1
2518
          #undef PARAM2
2519
 
2520
          if (do_stats) {
2521
            current->insn_index = 87;   /* "lv.sra.h" */
2522
            analysis(current);
2523
          }
2524
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2525
        }
2526
        break;
2527
      }
2528
      break;
2529
    case 0x7:
2530
      switch((insn >> 0) & 0xf) {
2531
      case 0x0:
2532
        /* Instruction: lv.srl */
2533
        {
2534
          uorreg_t a, b, c;
2535
          /* Number of operands: 3 */
2536
          a = (insn >> 21) & 0x1f;
2537
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2538
          #define PARAM0 cpu_state.reg[a]
2539
          b = (insn >> 16) & 0x1f;
2540
          #define PARAM1 cpu_state.reg[b]
2541
          c = (insn >> 11) & 0x1f;
2542
          #define PARAM2 cpu_state.reg[c]
2543
          l_invalid ();
2544
          #undef SET_PARAM
2545
          #undef PARAM0
2546
          #undef PARAM1
2547
          #undef PARAM2
2548
 
2549
          if (do_stats) {
2550
            current->insn_index = 88;   /* "lv.srl" */
2551
            analysis(current);
2552
          }
2553
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2554
        }
2555
        break;
2556
      case 0x1:
2557
        /* Instruction: lv.sub.b */
2558
        {
2559
          uorreg_t a, b, c;
2560
          /* Number of operands: 3 */
2561
          a = (insn >> 21) & 0x1f;
2562
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2563
          #define PARAM0 cpu_state.reg[a]
2564
          b = (insn >> 16) & 0x1f;
2565
          #define PARAM1 cpu_state.reg[b]
2566
          c = (insn >> 11) & 0x1f;
2567
          #define PARAM2 cpu_state.reg[c]
2568
          l_invalid ();
2569
          #undef SET_PARAM
2570
          #undef PARAM0
2571
          #undef PARAM1
2572
          #undef PARAM2
2573
 
2574
          if (do_stats) {
2575
            current->insn_index = 89;   /* "lv.sub.b" */
2576
            analysis(current);
2577
          }
2578
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2579
        }
2580
        break;
2581
      case 0x2:
2582
        /* Instruction: lv.sub.h */
2583
        {
2584
          uorreg_t a, b, c;
2585
          /* Number of operands: 3 */
2586
          a = (insn >> 21) & 0x1f;
2587
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2588
          #define PARAM0 cpu_state.reg[a]
2589
          b = (insn >> 16) & 0x1f;
2590
          #define PARAM1 cpu_state.reg[b]
2591
          c = (insn >> 11) & 0x1f;
2592
          #define PARAM2 cpu_state.reg[c]
2593
          l_invalid ();
2594
          #undef SET_PARAM
2595
          #undef PARAM0
2596
          #undef PARAM1
2597
          #undef PARAM2
2598
 
2599
          if (do_stats) {
2600
            current->insn_index = 90;   /* "lv.sub.h" */
2601
            analysis(current);
2602
          }
2603
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2604
        }
2605
        break;
2606
      case 0x3:
2607
        /* Instruction: lv.subs.b */
2608
        {
2609
          uorreg_t a, b, c;
2610
          /* Number of operands: 3 */
2611
          a = (insn >> 21) & 0x1f;
2612
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2613
          #define PARAM0 cpu_state.reg[a]
2614
          b = (insn >> 16) & 0x1f;
2615
          #define PARAM1 cpu_state.reg[b]
2616
          c = (insn >> 11) & 0x1f;
2617
          #define PARAM2 cpu_state.reg[c]
2618
          l_invalid ();
2619
          #undef SET_PARAM
2620
          #undef PARAM0
2621
          #undef PARAM1
2622
          #undef PARAM2
2623
 
2624
          if (do_stats) {
2625
            current->insn_index = 91;   /* "lv.subs.b" */
2626
            analysis(current);
2627
          }
2628
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2629
        }
2630
        break;
2631
      case 0x4:
2632
        /* Instruction: lv.subs.h */
2633
        {
2634
          uorreg_t a, b, c;
2635
          /* Number of operands: 3 */
2636
          a = (insn >> 21) & 0x1f;
2637
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2638
          #define PARAM0 cpu_state.reg[a]
2639
          b = (insn >> 16) & 0x1f;
2640
          #define PARAM1 cpu_state.reg[b]
2641
          c = (insn >> 11) & 0x1f;
2642
          #define PARAM2 cpu_state.reg[c]
2643
          l_invalid ();
2644
          #undef SET_PARAM
2645
          #undef PARAM0
2646
          #undef PARAM1
2647
          #undef PARAM2
2648
 
2649
          if (do_stats) {
2650
            current->insn_index = 92;   /* "lv.subs.h" */
2651
            analysis(current);
2652
          }
2653
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2654
        }
2655
        break;
2656
      case 0x5:
2657
        /* Instruction: lv.subu.b */
2658
        {
2659
          uorreg_t a, b, c;
2660
          /* Number of operands: 3 */
2661
          a = (insn >> 21) & 0x1f;
2662
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2663
          #define PARAM0 cpu_state.reg[a]
2664
          b = (insn >> 16) & 0x1f;
2665
          #define PARAM1 cpu_state.reg[b]
2666
          c = (insn >> 11) & 0x1f;
2667
          #define PARAM2 cpu_state.reg[c]
2668
          l_invalid ();
2669
          #undef SET_PARAM
2670
          #undef PARAM0
2671
          #undef PARAM1
2672
          #undef PARAM2
2673
 
2674
          if (do_stats) {
2675
            current->insn_index = 93;   /* "lv.subu.b" */
2676
            analysis(current);
2677
          }
2678
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2679
        }
2680
        break;
2681
      case 0x6:
2682
        /* Instruction: lv.subu.h */
2683
        {
2684
          uorreg_t a, b, c;
2685
          /* Number of operands: 3 */
2686
          a = (insn >> 21) & 0x1f;
2687
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2688
          #define PARAM0 cpu_state.reg[a]
2689
          b = (insn >> 16) & 0x1f;
2690
          #define PARAM1 cpu_state.reg[b]
2691
          c = (insn >> 11) & 0x1f;
2692
          #define PARAM2 cpu_state.reg[c]
2693
          l_invalid ();
2694
          #undef SET_PARAM
2695
          #undef PARAM0
2696
          #undef PARAM1
2697
          #undef PARAM2
2698
 
2699
          if (do_stats) {
2700
            current->insn_index = 94;   /* "lv.subu.h" */
2701
            analysis(current);
2702
          }
2703
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2704
        }
2705
        break;
2706
      case 0x7:
2707
        /* Instruction: lv.subus.b */
2708
        {
2709
          uorreg_t a, b, c;
2710
          /* Number of operands: 3 */
2711
          a = (insn >> 21) & 0x1f;
2712
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2713
          #define PARAM0 cpu_state.reg[a]
2714
          b = (insn >> 16) & 0x1f;
2715
          #define PARAM1 cpu_state.reg[b]
2716
          c = (insn >> 11) & 0x1f;
2717
          #define PARAM2 cpu_state.reg[c]
2718
          l_invalid ();
2719
          #undef SET_PARAM
2720
          #undef PARAM0
2721
          #undef PARAM1
2722
          #undef PARAM2
2723
 
2724
          if (do_stats) {
2725
            current->insn_index = 95;   /* "lv.subus.b" */
2726
            analysis(current);
2727
          }
2728
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2729
        }
2730
        break;
2731
      case 0x8:
2732
        /* Instruction: lv.subus.h */
2733
        {
2734
          uorreg_t a, b, c;
2735
          /* Number of operands: 3 */
2736
          a = (insn >> 21) & 0x1f;
2737
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2738
          #define PARAM0 cpu_state.reg[a]
2739
          b = (insn >> 16) & 0x1f;
2740
          #define PARAM1 cpu_state.reg[b]
2741
          c = (insn >> 11) & 0x1f;
2742
          #define PARAM2 cpu_state.reg[c]
2743
          l_invalid ();
2744
          #undef SET_PARAM
2745
          #undef PARAM0
2746
          #undef PARAM1
2747
          #undef PARAM2
2748
 
2749
          if (do_stats) {
2750
            current->insn_index = 96;   /* "lv.subus.h" */
2751
            analysis(current);
2752
          }
2753
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2754
        }
2755
        break;
2756
      case 0x9:
2757
        /* Instruction: lv.unpack.b */
2758
        {
2759
          uorreg_t a, b, c;
2760
          /* Number of operands: 3 */
2761
          a = (insn >> 21) & 0x1f;
2762
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2763
          #define PARAM0 cpu_state.reg[a]
2764
          b = (insn >> 16) & 0x1f;
2765
          #define PARAM1 cpu_state.reg[b]
2766
          c = (insn >> 11) & 0x1f;
2767
          #define PARAM2 cpu_state.reg[c]
2768
          l_invalid ();
2769
          #undef SET_PARAM
2770
          #undef PARAM0
2771
          #undef PARAM1
2772
          #undef PARAM2
2773
 
2774
          if (do_stats) {
2775
            current->insn_index = 97;   /* "lv.unpack.b" */
2776
            analysis(current);
2777
          }
2778
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2779
        }
2780
        break;
2781
      case 0xa:
2782
        /* Instruction: lv.unpack.h */
2783
        {
2784
          uorreg_t a, b, c;
2785
          /* Number of operands: 3 */
2786
          a = (insn >> 21) & 0x1f;
2787
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2788
          #define PARAM0 cpu_state.reg[a]
2789
          b = (insn >> 16) & 0x1f;
2790
          #define PARAM1 cpu_state.reg[b]
2791
          c = (insn >> 11) & 0x1f;
2792
          #define PARAM2 cpu_state.reg[c]
2793
          l_invalid ();
2794
          #undef SET_PARAM
2795
          #undef PARAM0
2796
          #undef PARAM1
2797
          #undef PARAM2
2798
 
2799
          if (do_stats) {
2800
            current->insn_index = 98;   /* "lv.unpack.h" */
2801
            analysis(current);
2802
          }
2803
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2804
        }
2805
        break;
2806
      case 0xb:
2807
        /* Instruction: lv.xor */
2808
        {
2809
          uorreg_t a, b, c;
2810
          /* Number of operands: 3 */
2811
          a = (insn >> 21) & 0x1f;
2812
          #define SET_PARAM0(val) cpu_state.reg[a] = val
2813
          #define PARAM0 cpu_state.reg[a]
2814
          b = (insn >> 16) & 0x1f;
2815
          #define PARAM1 cpu_state.reg[b]
2816
          c = (insn >> 11) & 0x1f;
2817
          #define PARAM2 cpu_state.reg[c]
2818
          l_invalid ();
2819
          #undef SET_PARAM
2820
          #undef PARAM0
2821
          #undef PARAM1
2822
          #undef PARAM2
2823
 
2824
          if (do_stats) {
2825
            current->insn_index = 99;   /* "lv.xor" */
2826
            analysis(current);
2827
          }
2828
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
2829
        }
2830
        break;
2831
      case 0xc:
2832
      case 0xd:
2833
      case 0xe:
2834
      case 0xf:
2835
        /* Invalid instruction(s) */
2836
        break;
2837
      }
2838
      break;
2839
    case 0x8:
2840
    case 0x9:
2841
    case 0xa:
2842
    case 0xb:
2843
      /* Invalid instruction(s) */
2844
      break;
2845
    case 0xc:
2846
      /* Instruction: lv.cust1 */
2847
      {
2848
        uorreg_t a;
2849
        /* Number of operands: 1 */
2850
        a = (insn >> 0) & 0x0;
2851
        #define SET_PARAM0(val) cpu_state.reg[a] = val
2852
        #define PARAM0 cpu_state.reg[a]
2853
        l_invalid ();
2854
        #undef SET_PARAM
2855
        #undef PARAM0
2856
 
2857
        if (do_stats) {
2858
          current->insn_index = 100;   /* "lv.cust1" */
2859
          analysis(current);
2860
        }
2861
      }
2862
      break;
2863
    case 0xd:
2864
      /* Instruction: lv.cust2 */
2865
      {
2866
        uorreg_t a;
2867
        /* Number of operands: 1 */
2868
        a = (insn >> 0) & 0x0;
2869
        #define SET_PARAM0(val) cpu_state.reg[a] = val
2870
        #define PARAM0 cpu_state.reg[a]
2871
        l_invalid ();
2872
        #undef SET_PARAM
2873
        #undef PARAM0
2874
 
2875
        if (do_stats) {
2876
          current->insn_index = 101;   /* "lv.cust2" */
2877
          analysis(current);
2878
        }
2879
      }
2880
      break;
2881
    case 0xe:
2882
      /* Instruction: lv.cust3 */
2883
      {
2884
        uorreg_t a;
2885
        /* Number of operands: 1 */
2886
        a = (insn >> 0) & 0x0;
2887
        #define SET_PARAM0(val) cpu_state.reg[a] = val
2888
        #define PARAM0 cpu_state.reg[a]
2889
        l_invalid ();
2890
        #undef SET_PARAM
2891
        #undef PARAM0
2892
 
2893
        if (do_stats) {
2894
          current->insn_index = 102;   /* "lv.cust3" */
2895
          analysis(current);
2896
        }
2897
      }
2898
      break;
2899
    case 0xf:
2900
      /* Instruction: lv.cust4 */
2901
      {
2902
        uorreg_t a;
2903
        /* Number of operands: 1 */
2904
        a = (insn >> 0) & 0x0;
2905
        #define SET_PARAM0(val) cpu_state.reg[a] = val
2906
        #define PARAM0 cpu_state.reg[a]
2907
        l_invalid ();
2908
        #undef SET_PARAM
2909
        #undef PARAM0
2910
 
2911
        if (do_stats) {
2912
          current->insn_index = 103;   /* "lv.cust4" */
2913
          analysis(current);
2914
        }
2915
      }
2916
      break;
2917
    }
2918
    break;
2919
  case 0xb:
2920
  case 0xc:
2921
  case 0xd:
2922
  case 0xe:
2923
  case 0xf:
2924
  case 0x10:
2925
    /* Invalid instruction(s) */
2926
    break;
2927
  case 0x11:
2928
    /* Instruction: l.jr */
2929
    {
2930
      uorreg_t a;
2931
      /* Number of operands: 1 */
2932
      a = (insn >> 11) & 0x1f;
2933
      #define SET_PARAM0(val) cpu_state.reg[a] = val
2934
      #define PARAM0 cpu_state.reg[a]
2935
      {         /* "l_jr" */
2936
        cpu_state.pc_delay = PARAM0;
2937
        next_delay_insn = 1;
2938
        if (config.sim.profile)
2939
          fprintf (runtime.sim.fprof, "-%08llX %"PRIxADDR"\n", runtime.sim.cycles,
2940
                   cpu_state.pc_delay);
2941
      }
2942
      #undef SET_PARAM
2943
      #undef PARAM0
2944
 
2945
      if (do_stats) {
2946
        current->insn_index = 104;   /* "l.jr" */
2947
        analysis(current);
2948
      }
2949
    }
2950
    break;
2951
  case 0x12:
2952
    /* Instruction: l.jalr */
2953
    {
2954
      uorreg_t a;
2955
      /* Number of operands: 1 */
2956
      a = (insn >> 11) & 0x1f;
2957
      #define SET_PARAM0(val) cpu_state.reg[a] = val
2958
      #define PARAM0 cpu_state.reg[a]
2959
      {         /* "l_jalr" */
2960
        cpu_state.pc_delay = PARAM0;
2961
        setsim_reg(LINK_REGNO, cpu_state.pc + 8);
2962
        next_delay_insn = 1;
2963
      }
2964
      #undef SET_PARAM
2965
      #undef PARAM0
2966
 
2967
      if (do_stats) {
2968
        current->insn_index = 105;   /* "l.jalr" */
2969
        analysis(current);
2970
      }
2971
    }
2972
    break;
2973
  case 0x13:
2974
    /* Instruction: l.maci */
2975
    {
2976
      uorreg_t a, b;
2977
      /* Number of operands: 2 */
2978
      a = (insn >> 16) & 0x1f;
2979
      #define SET_PARAM0(val) cpu_state.reg[a] = val
2980
      #define PARAM0 cpu_state.reg[a]
2981
      b = (insn >> 0) & 0x7ff;
2982
      b |= ((insn >> 21) & 0x1f) << 11;
2983
      if(b & 0x00008000) b |= 0xffff8000;
2984
      #define PARAM1 b
2985
      {         /* "l_mac" */
2986
        uorreg_t lo, hi;
2987
        LONGEST l;
2988
        orreg_t x, y;
2989
 
2990
        lo = cpu_state.sprs[SPR_MACLO];
2991
        hi = cpu_state.sprs[SPR_MACHI];
2992
        x = PARAM0;
2993
        y = PARAM1;
2994
        PRINTF ("[%"PRIxREG",%"PRIxREG"]\t", x, y);
2995
        l = (ULONGEST)lo | ((LONGEST)hi << 32);
2996
        l += (LONGEST) x * (LONGEST) y;
2997
 
2998
        /* This implementation is very fast - it needs only one cycle for mac.  */
2999
        lo = ((ULONGEST)l) & 0xFFFFFFFF;
3000
        hi = ((LONGEST)l) >> 32;
3001
        cpu_state.sprs[SPR_MACLO] = lo;
3002
        cpu_state.sprs[SPR_MACHI] = hi;
3003
        PRINTF ("(%"PRIxREG",%"PRIxREG"\n", hi, lo);
3004
      }
3005
      #undef SET_PARAM
3006
      #undef PARAM0
3007
      #undef PARAM1
3008
 
3009
      if (do_stats) {
3010
        current->insn_index = 106;   /* "l.maci" */
3011
        analysis(current);
3012
      }
3013
    }
3014
    break;
3015
  case 0x14:
3016
  case 0x15:
3017
  case 0x16:
3018
  case 0x17:
3019
  case 0x18:
3020
  case 0x19:
3021
  case 0x1a:
3022
  case 0x1b:
3023
    /* Invalid instruction(s) */
3024
    break;
3025
  case 0x1c:
3026
    /* Instruction: l.cust1 */
3027
    {
3028
      uorreg_t a;
3029
      /* Number of operands: 1 */
3030
      a = (insn >> 0) & 0x0;
3031
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3032
      #define PARAM0 cpu_state.reg[a]
3033
      {         /* "l_cust1" */
3034
        /*int destr = current->insn >> 21;
3035
          int src1r = current->insn >> 15;
3036
          int src2r = current->insn >> 9;*/
3037
      }
3038
      #undef SET_PARAM
3039
      #undef PARAM0
3040
 
3041
      if (do_stats) {
3042
        current->insn_index = 107;   /* "l.cust1" */
3043
        analysis(current);
3044
      }
3045
    }
3046
    break;
3047
  case 0x1d:
3048
    /* Instruction: l.cust2 */
3049
    {
3050
      uorreg_t a;
3051
      /* Number of operands: 1 */
3052
      a = (insn >> 0) & 0x0;
3053
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3054
      #define PARAM0 cpu_state.reg[a]
3055
      {         /* "l_cust2" */
3056
      }
3057
      #undef SET_PARAM
3058
      #undef PARAM0
3059
 
3060
      if (do_stats) {
3061
        current->insn_index = 108;   /* "l.cust2" */
3062
        analysis(current);
3063
      }
3064
    }
3065
    break;
3066
  case 0x1e:
3067
    /* Instruction: l.cust3 */
3068
    {
3069
      uorreg_t a;
3070
      /* Number of operands: 1 */
3071
      a = (insn >> 0) & 0x0;
3072
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3073
      #define PARAM0 cpu_state.reg[a]
3074
      {         /* "l_cust3" */
3075
      }
3076
      #undef SET_PARAM
3077
      #undef PARAM0
3078
 
3079
      if (do_stats) {
3080
        current->insn_index = 109;   /* "l.cust3" */
3081
        analysis(current);
3082
      }
3083
    }
3084
    break;
3085
  case 0x1f:
3086
    /* Instruction: l.cust4 */
3087
    {
3088
      uorreg_t a;
3089
      /* Number of operands: 1 */
3090
      a = (insn >> 0) & 0x0;
3091
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3092
      #define PARAM0 cpu_state.reg[a]
3093
      {         /* "l_cust4" */
3094
      }
3095
      #undef SET_PARAM
3096
      #undef PARAM0
3097
 
3098
      if (do_stats) {
3099
        current->insn_index = 110;   /* "l.cust4" */
3100
        analysis(current);
3101
      }
3102
    }
3103
    break;
3104
  case 0x20:
3105
    /* Instruction: l.ld */
3106
    {
3107
      uorreg_t a, b;
3108
      /* Number of operands: 2 */
3109
      a = (insn >> 21) & 0x1f;
3110
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3111
      #define PARAM0 cpu_state.reg[a]
3112
      b = (insn >> 0) & 0xffff;
3113
      if(b & 0x00008000) b |= 0xffff8000;
3114
      *(orreg_t *)&b += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
3115
      #define PARAM1 b
3116
      l_invalid ();
3117
      #undef SET_PARAM
3118
      #undef PARAM0
3119
      #undef PARAM1
3120
 
3121
      if (do_stats) {
3122
        cpu_state.insn_ea = b;
3123
        current->insn_index = 111;   /* "l.ld" */
3124
        analysis(current);
3125
      }
3126
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3127
    }
3128
    break;
3129
  case 0x21:
3130
    /* Instruction: l.lwz */
3131
    {
3132
      uorreg_t a, b;
3133
      /* Number of operands: 2 */
3134
      a = (insn >> 21) & 0x1f;
3135
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3136
      #define PARAM0 cpu_state.reg[a]
3137
      b = (insn >> 0) & 0xffff;
3138
      if(b & 0x00008000) b |= 0xffff8000;
3139
      *(orreg_t *)&b += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
3140
      #define PARAM1 b
3141
      {         /* "l_lwz" */
3142
        uint32_t val;
3143
        if (config.cpu.sbuf_len) sbuf_load ();
3144
        val = eval_mem32(PARAM1, &breakpoint);
3145
        /* If eval operand produced exception don't set anything. JPB changed to
3146
           trigger on breakpoint, as well as except_pending (seemed to be a bug). */
3147
        if (!(except_pending || breakpoint))
3148
          SET_PARAM0(val);
3149
      }
3150
      #undef SET_PARAM
3151
      #undef PARAM0
3152
      #undef PARAM1
3153
 
3154
      if (do_stats) {
3155
        cpu_state.insn_ea = b;
3156
        current->insn_index = 112;   /* "l.lwz" */
3157
        analysis(current);
3158
      }
3159
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3160
    }
3161
    break;
3162
  case 0x22:
3163
    /* Instruction: l.lws */
3164
    {
3165
      uorreg_t a, b;
3166
      /* Number of operands: 2 */
3167
      a = (insn >> 21) & 0x1f;
3168
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3169
      #define PARAM0 cpu_state.reg[a]
3170
      b = (insn >> 0) & 0xffff;
3171
      if(b & 0x00008000) b |= 0xffff8000;
3172
      *(orreg_t *)&b += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
3173
      #define PARAM1 b
3174
      l_invalid ();
3175
      #undef SET_PARAM
3176
      #undef PARAM0
3177
      #undef PARAM1
3178
 
3179
      if (do_stats) {
3180
        cpu_state.insn_ea = b;
3181
        current->insn_index = 113;   /* "l.lws" */
3182
        analysis(current);
3183
      }
3184
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3185
    }
3186
    break;
3187
  case 0x23:
3188
    /* Instruction: l.lbz */
3189
    {
3190
      uorreg_t a, b;
3191
      /* Number of operands: 2 */
3192
      a = (insn >> 21) & 0x1f;
3193
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3194
      #define PARAM0 cpu_state.reg[a]
3195
      b = (insn >> 0) & 0xffff;
3196
      if(b & 0x00008000) b |= 0xffff8000;
3197
      *(orreg_t *)&b += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
3198
      #define PARAM1 b
3199
      {         /* "l_lbz" */
3200
        uint8_t val;
3201
        if (config.cpu.sbuf_len) sbuf_load ();
3202
        val = eval_mem8(PARAM1, &breakpoint);
3203
        /* If eval operand produced exception don't set anything. JPB changed to
3204
           trigger on breakpoint, as well as except_pending (seemed to be a bug). */
3205
        if (!(except_pending || breakpoint))
3206
          SET_PARAM0(val);
3207
      }
3208
      #undef SET_PARAM
3209
      #undef PARAM0
3210
      #undef PARAM1
3211
 
3212
      if (do_stats) {
3213
        cpu_state.insn_ea = b;
3214
        current->insn_index = 114;   /* "l.lbz" */
3215
        analysis(current);
3216
      }
3217
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3218
    }
3219
    break;
3220
  case 0x24:
3221
    /* Instruction: l.lbs */
3222
    {
3223
      uorreg_t a, b;
3224
      /* Number of operands: 2 */
3225
      a = (insn >> 21) & 0x1f;
3226
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3227
      #define PARAM0 cpu_state.reg[a]
3228
      b = (insn >> 0) & 0xffff;
3229
      if(b & 0x00008000) b |= 0xffff8000;
3230
      *(orreg_t *)&b += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
3231
      #define PARAM1 b
3232
      {         /* "l_lbs" */
3233
        int8_t val;
3234
        if (config.cpu.sbuf_len) sbuf_load ();
3235
        val = eval_mem8(PARAM1, &breakpoint);
3236
        /* If eval operand produced exception don't set anything. JPB changed to
3237
           trigger on breakpoint, as well as except_pending (seemed to be a bug). */
3238
        if (!(except_pending || breakpoint))
3239
          SET_PARAM0(val);
3240
      }
3241
      #undef SET_PARAM
3242
      #undef PARAM0
3243
      #undef PARAM1
3244
 
3245
      if (do_stats) {
3246
        cpu_state.insn_ea = b;
3247
        current->insn_index = 115;   /* "l.lbs" */
3248
        analysis(current);
3249
      }
3250
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3251
    }
3252
    break;
3253
  case 0x25:
3254
    /* Instruction: l.lhz */
3255
    {
3256
      uorreg_t a, b;
3257
      /* Number of operands: 2 */
3258
      a = (insn >> 21) & 0x1f;
3259
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3260
      #define PARAM0 cpu_state.reg[a]
3261
      b = (insn >> 0) & 0xffff;
3262
      if(b & 0x00008000) b |= 0xffff8000;
3263
      *(orreg_t *)&b += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
3264
      #define PARAM1 b
3265
      {         /* "l_lhz" */
3266
        uint16_t val;
3267
        if (config.cpu.sbuf_len) sbuf_load ();
3268
        val = eval_mem16(PARAM1, &breakpoint);
3269
        /* If eval operand produced exception don't set anything. JPB changed to
3270
           trigger on breakpoint, as well as except_pending (seemed to be a bug). */
3271
        if (!(except_pending || breakpoint))
3272
          SET_PARAM0(val);
3273
      }
3274
      #undef SET_PARAM
3275
      #undef PARAM0
3276
      #undef PARAM1
3277
 
3278
      if (do_stats) {
3279
        cpu_state.insn_ea = b;
3280
        current->insn_index = 116;   /* "l.lhz" */
3281
        analysis(current);
3282
      }
3283
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3284
    }
3285
    break;
3286
  case 0x26:
3287
    /* Instruction: l.lhs */
3288
    {
3289
      uorreg_t a, b;
3290
      /* Number of operands: 2 */
3291
      a = (insn >> 21) & 0x1f;
3292
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3293
      #define PARAM0 cpu_state.reg[a]
3294
      b = (insn >> 0) & 0xffff;
3295
      if(b & 0x00008000) b |= 0xffff8000;
3296
      *(orreg_t *)&b += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
3297
      #define PARAM1 b
3298
      {         /* "l_lhs" */
3299
        int16_t val;
3300
        if (config.cpu.sbuf_len) sbuf_load ();
3301
        val = eval_mem16(PARAM1, &breakpoint);
3302
        /* If eval operand produced exception don't set anything. JPB changed to
3303
           trigger on breakpoint, as well as except_pending (seemed to be a bug). */
3304
        if (!(except_pending || breakpoint))
3305
          SET_PARAM0(val);
3306
      }
3307
      #undef SET_PARAM
3308
      #undef PARAM0
3309
      #undef PARAM1
3310
 
3311
      if (do_stats) {
3312
        cpu_state.insn_ea = b;
3313
        current->insn_index = 117;   /* "l.lhs" */
3314
        analysis(current);
3315
      }
3316
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3317
    }
3318
    break;
3319
  case 0x27:
3320
    /* Instruction: l.addi */
3321
    {
3322
      uorreg_t a, b, c;
3323
      /* Number of operands: 3 */
3324
      a = (insn >> 21) & 0x1f;
3325
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3326
      #define PARAM0 cpu_state.reg[a]
3327
      b = (insn >> 16) & 0x1f;
3328
      #define PARAM1 cpu_state.reg[b]
3329
      c = (insn >> 0) & 0xffff;
3330
      if(c & 0x00008000) c |= 0xffff8000;
3331
      #define PARAM2 c
3332
      {         /* "l_add" */
3333
        orreg_t temp1, temp2, temp3;
3334
        int8_t temp4;
3335
 
3336
        temp2 = (orreg_t)PARAM2;
3337
        temp3 = (orreg_t)PARAM1;
3338
        temp1 = temp2 + temp3;
3339
        SET_PARAM0(temp1);
3340
        SET_OV_FLAG_FN (temp1);
3341
        if (ARITH_SET_FLAG) {
3342
          if(!temp1)
3343
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3344
          else
3345
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3346
        }
3347
        if ((uorreg_t) temp1 < (uorreg_t) temp2)
3348
          cpu_state.sprs[SPR_SR] |= SPR_SR_CY;
3349
        else
3350
          cpu_state.sprs[SPR_SR] &= ~SPR_SR_CY;
3351
 
3352
        temp4 = temp1;
3353
        if (temp4 == temp1)
3354
          or1k_mstats.byteadd++;
3355
      }
3356
      #undef SET_PARAM
3357
      #undef PARAM0
3358
      #undef PARAM1
3359
      #undef PARAM2
3360
 
3361
      if (do_stats) {
3362
        current->insn_index = 118;   /* "l.addi" */
3363
        analysis(current);
3364
      }
3365
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3366
    }
3367
    break;
3368
  case 0x28:
3369
    /* Instruction: l.addic */
3370
    {
3371
      uorreg_t a, b, c;
3372
      /* Number of operands: 3 */
3373
      a = (insn >> 21) & 0x1f;
3374
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3375
      #define PARAM0 cpu_state.reg[a]
3376
      b = (insn >> 16) & 0x1f;
3377
      #define PARAM1 cpu_state.reg[b]
3378
      c = (insn >> 0) & 0xffff;
3379
      if(c & 0x00008000) c |= 0xffff8000;
3380
      #define PARAM2 c
3381
      l_invalid ();
3382
      #undef SET_PARAM
3383
      #undef PARAM0
3384
      #undef PARAM1
3385
      #undef PARAM2
3386
 
3387
      if (do_stats) {
3388
        current->insn_index = 119;   /* "l.addic" */
3389
        analysis(current);
3390
      }
3391
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3392
    }
3393
    break;
3394
  case 0x29:
3395
    /* Instruction: l.andi */
3396
    {
3397
      uorreg_t a, b, c;
3398
      /* Number of operands: 3 */
3399
      a = (insn >> 21) & 0x1f;
3400
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3401
      #define PARAM0 cpu_state.reg[a]
3402
      b = (insn >> 16) & 0x1f;
3403
      #define PARAM1 cpu_state.reg[b]
3404
      c = (insn >> 0) & 0xffff;
3405
      #define PARAM2 c
3406
      {         /* "l_and" */
3407
        uorreg_t temp1;
3408
        temp1 = PARAM1 & PARAM2;
3409
        SET_OV_FLAG_FN (temp1);
3410
        SET_PARAM0(temp1);
3411
        if (ARITH_SET_FLAG) {
3412
          if(!temp1)
3413
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3414
          else
3415
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3416
        }
3417
      }
3418
      #undef SET_PARAM
3419
      #undef PARAM0
3420
      #undef PARAM1
3421
      #undef PARAM2
3422
 
3423
      if (do_stats) {
3424
        current->insn_index = 120;   /* "l.andi" */
3425
        analysis(current);
3426
      }
3427
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3428
    }
3429
    break;
3430
  case 0x2a:
3431
    /* Instruction: l.ori */
3432
    {
3433
      uorreg_t a, b, c;
3434
      /* Number of operands: 3 */
3435
      a = (insn >> 21) & 0x1f;
3436
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3437
      #define PARAM0 cpu_state.reg[a]
3438
      b = (insn >> 16) & 0x1f;
3439
      #define PARAM1 cpu_state.reg[b]
3440
      c = (insn >> 0) & 0xffff;
3441
      #define PARAM2 c
3442
      {         /* "l_or" */
3443
        uorreg_t temp1;
3444
        temp1 = PARAM1 | PARAM2;
3445
        SET_OV_FLAG_FN (temp1);
3446
        SET_PARAM0(temp1);
3447
      }
3448
      #undef SET_PARAM
3449
      #undef PARAM0
3450
      #undef PARAM1
3451
      #undef PARAM2
3452
 
3453
      if (do_stats) {
3454
        current->insn_index = 121;   /* "l.ori" */
3455
        analysis(current);
3456
      }
3457
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3458
    }
3459
    break;
3460
  case 0x2b:
3461
    /* Instruction: l.xori */
3462
    {
3463
      uorreg_t a, b, c;
3464
      /* Number of operands: 3 */
3465
      a = (insn >> 21) & 0x1f;
3466
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3467
      #define PARAM0 cpu_state.reg[a]
3468
      b = (insn >> 16) & 0x1f;
3469
      #define PARAM1 cpu_state.reg[b]
3470
      c = (insn >> 0) & 0xffff;
3471
      if(c & 0x00008000) c |= 0xffff8000;
3472
      #define PARAM2 c
3473
      {         /* "l_xor" */
3474
        uorreg_t temp1;
3475
        temp1 = PARAM1 ^ PARAM2;
3476
        SET_OV_FLAG_FN (temp1);
3477
        SET_PARAM0(temp1);
3478
      }
3479
      #undef SET_PARAM
3480
      #undef PARAM0
3481
      #undef PARAM1
3482
      #undef PARAM2
3483
 
3484
      if (do_stats) {
3485
        current->insn_index = 122;   /* "l.xori" */
3486
        analysis(current);
3487
      }
3488
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3489
    }
3490
    break;
3491
  case 0x2c:
3492
    /* Instruction: l.muli */
3493
    {
3494
      uorreg_t a, b, c;
3495
      /* Number of operands: 3 */
3496
      a = (insn >> 21) & 0x1f;
3497
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3498
      #define PARAM0 cpu_state.reg[a]
3499
      b = (insn >> 16) & 0x1f;
3500
      #define PARAM1 cpu_state.reg[b]
3501
      c = (insn >> 0) & 0xffff;
3502
      if(c & 0x00008000) c |= 0xffff8000;
3503
      #define PARAM2 c
3504
      {         /* "l_mul" */
3505
        orreg_t temp1;
3506
 
3507
        temp1 = (orreg_t)PARAM1 * (orreg_t)PARAM2;
3508
        SET_OV_FLAG_FN (temp1);
3509
        SET_PARAM0(temp1);
3510
        /*if (!(mcount++ & 1023)) {
3511
          PRINTF ("[%i]\n",mcount);
3512
          }*/
3513
      }
3514
      #undef SET_PARAM
3515
      #undef PARAM0
3516
      #undef PARAM1
3517
      #undef PARAM2
3518
 
3519
      if (do_stats) {
3520
        current->insn_index = 123;   /* "l.muli" */
3521
        analysis(current);
3522
      }
3523
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3524
    }
3525
    break;
3526
  case 0x2d:
3527
    /* Instruction: l.mfspr */
3528
    {
3529
      uorreg_t a, b, c;
3530
      /* Number of operands: 3 */
3531
      a = (insn >> 21) & 0x1f;
3532
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3533
      #define PARAM0 cpu_state.reg[a]
3534
      b = (insn >> 16) & 0x1f;
3535
      #define PARAM1 cpu_state.reg[b]
3536
      c = (insn >> 0) & 0xffff;
3537
      #define PARAM2 c
3538
      {         /* "l_mfspr" */
3539
        uint16_t regno = PARAM1 + PARAM2;
3540
        uorreg_t value = mfspr(regno);
3541
 
3542
        if (cpu_state.sprs[SPR_SR] & SPR_SR_SM)
3543
          SET_PARAM0(value);
3544
        else {
3545
          SET_PARAM0(0);
3546
          PRINTF("WARNING: trying to read SPR while SR[SUPV] is cleared.\n");
3547
          sim_done();
3548
        }
3549
      }
3550
      #undef SET_PARAM
3551
      #undef PARAM0
3552
      #undef PARAM1
3553
      #undef PARAM2
3554
 
3555
      if (do_stats) {
3556
        current->insn_index = 124;   /* "l.mfspr" */
3557
        analysis(current);
3558
      }
3559
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
3560
    }
3561
    break;
3562
  case 0x2e:
3563
    switch((insn >> 6) & 0x3) {
3564
    case 0x0:
3565
      /* Instruction: l.slli */
3566
      {
3567
        uorreg_t a, b, c;
3568
        /* Number of operands: 3 */
3569
        a = (insn >> 21) & 0x1f;
3570
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3571
        #define PARAM0 cpu_state.reg[a]
3572
        b = (insn >> 16) & 0x1f;
3573
        #define PARAM1 cpu_state.reg[b]
3574
        c = (insn >> 0) & 0x3f;
3575
        #define PARAM2 c
3576
        {           /* "l_sll" */
3577
          uorreg_t temp1;
3578
 
3579
          temp1 = PARAM1 << PARAM2;
3580
          SET_OV_FLAG_FN (temp1);
3581
          SET_PARAM0(temp1);
3582
          /* runtime.sim.cycles += 2; */
3583
        }
3584
        #undef SET_PARAM
3585
        #undef PARAM0
3586
        #undef PARAM1
3587
        #undef PARAM2
3588
 
3589
        if (do_stats) {
3590
          current->insn_index = 125;   /* "l.slli" */
3591
          analysis(current);
3592
        }
3593
        cpu_state.reg[0] = 0; /* Repair in case we changed it */
3594
      }
3595
      break;
3596
    case 0x1:
3597
      /* Instruction: l.srli */
3598
      {
3599
        uorreg_t a, b, c;
3600
        /* Number of operands: 3 */
3601
        a = (insn >> 21) & 0x1f;
3602
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3603
        #define PARAM0 cpu_state.reg[a]
3604
        b = (insn >> 16) & 0x1f;
3605
        #define PARAM1 cpu_state.reg[b]
3606
        c = (insn >> 0) & 0x3f;
3607
        #define PARAM2 c
3608
        {           /* "l_srl" */
3609
          uorreg_t temp1;
3610
          temp1 = PARAM1 >> PARAM2;
3611
          SET_OV_FLAG_FN (temp1);
3612
          SET_PARAM0(temp1);
3613
          /* runtime.sim.cycles += 2; */
3614
        }
3615
        #undef SET_PARAM
3616
        #undef PARAM0
3617
        #undef PARAM1
3618
        #undef PARAM2
3619
 
3620
        if (do_stats) {
3621
          current->insn_index = 126;   /* "l.srli" */
3622
          analysis(current);
3623
        }
3624
        cpu_state.reg[0] = 0; /* Repair in case we changed it */
3625
      }
3626
      break;
3627
    case 0x2:
3628
      /* Instruction: l.srai */
3629
      {
3630
        uorreg_t a, b, c;
3631
        /* Number of operands: 3 */
3632
        a = (insn >> 21) & 0x1f;
3633
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3634
        #define PARAM0 cpu_state.reg[a]
3635
        b = (insn >> 16) & 0x1f;
3636
        #define PARAM1 cpu_state.reg[b]
3637
        c = (insn >> 0) & 0x3f;
3638
        #define PARAM2 c
3639
        {           /* "l_sra" */
3640
          orreg_t temp1;
3641
 
3642
          temp1 = (orreg_t)PARAM1 >> PARAM2;
3643
          SET_OV_FLAG_FN (temp1);
3644
          SET_PARAM0(temp1);
3645
          /* runtime.sim.cycles += 2; */
3646
        }
3647
        #undef SET_PARAM
3648
        #undef PARAM0
3649
        #undef PARAM1
3650
        #undef PARAM2
3651
 
3652
        if (do_stats) {
3653
          current->insn_index = 127;   /* "l.srai" */
3654
          analysis(current);
3655
        }
3656
        cpu_state.reg[0] = 0; /* Repair in case we changed it */
3657
      }
3658
      break;
3659
    case 0x3:
3660
      /* Instruction: l.rori */
3661
      {
3662
        uorreg_t a, b, c;
3663
        /* Number of operands: 3 */
3664
        a = (insn >> 21) & 0x1f;
3665
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3666
        #define PARAM0 cpu_state.reg[a]
3667
        b = (insn >> 16) & 0x1f;
3668
        #define PARAM1 cpu_state.reg[b]
3669
        c = (insn >> 0) & 0x3f;
3670
        #define PARAM2 c
3671
        l_invalid ();
3672
        #undef SET_PARAM
3673
        #undef PARAM0
3674
        #undef PARAM1
3675
        #undef PARAM2
3676
 
3677
        if (do_stats) {
3678
          current->insn_index = 128;   /* "l.rori" */
3679
          analysis(current);
3680
        }
3681
        cpu_state.reg[0] = 0; /* Repair in case we changed it */
3682
      }
3683
      break;
3684
    }
3685
    break;
3686
  case 0x2f:
3687
    switch((insn >> 21) & 0x1f) {
3688
    case 0x0:
3689
      /* Instruction: l.sfeqi */
3690
      {
3691
        uorreg_t a, b;
3692
        /* Number of operands: 2 */
3693
        a = (insn >> 16) & 0x1f;
3694
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3695
        #define PARAM0 cpu_state.reg[a]
3696
        b = (insn >> 0) & 0xffff;
3697
        if(b & 0x00008000) b |= 0xffff8000;
3698
        #define PARAM1 b
3699
        {           /* "l_sfeq" */
3700
          if(PARAM0 == PARAM1)
3701
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3702
          else
3703
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3704
        }
3705
        #undef SET_PARAM
3706
        #undef PARAM0
3707
        #undef PARAM1
3708
 
3709
        if (do_stats) {
3710
          current->insn_index = 129;   /* "l.sfeqi" */
3711
          analysis(current);
3712
        }
3713
      }
3714
      break;
3715
    case 0x1:
3716
      /* Instruction: l.sfnei */
3717
      {
3718
        uorreg_t a, b;
3719
        /* Number of operands: 2 */
3720
        a = (insn >> 16) & 0x1f;
3721
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3722
        #define PARAM0 cpu_state.reg[a]
3723
        b = (insn >> 0) & 0xffff;
3724
        if(b & 0x00008000) b |= 0xffff8000;
3725
        #define PARAM1 b
3726
        {           /* "l_sfne" */
3727
          if(PARAM0 != PARAM1)
3728
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3729
          else
3730
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3731
        }
3732
        #undef SET_PARAM
3733
        #undef PARAM0
3734
        #undef PARAM1
3735
 
3736
        if (do_stats) {
3737
          current->insn_index = 130;   /* "l.sfnei" */
3738
          analysis(current);
3739
        }
3740
      }
3741
      break;
3742
    case 0x2:
3743
      /* Instruction: l.sfgtui */
3744
      {
3745
        uorreg_t a, b;
3746
        /* Number of operands: 2 */
3747
        a = (insn >> 16) & 0x1f;
3748
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3749
        #define PARAM0 cpu_state.reg[a]
3750
        b = (insn >> 0) & 0xffff;
3751
        if(b & 0x00008000) b |= 0xffff8000;
3752
        #define PARAM1 b
3753
        {           /* "l_sfgtu" */
3754
          if(PARAM0 > PARAM1)
3755
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3756
          else
3757
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3758
        }
3759
        #undef SET_PARAM
3760
        #undef PARAM0
3761
        #undef PARAM1
3762
 
3763
        if (do_stats) {
3764
          current->insn_index = 131;   /* "l.sfgtui" */
3765
          analysis(current);
3766
        }
3767
      }
3768
      break;
3769
    case 0x3:
3770
      /* Instruction: l.sfgeui */
3771
      {
3772
        uorreg_t a, b;
3773
        /* Number of operands: 2 */
3774
        a = (insn >> 16) & 0x1f;
3775
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3776
        #define PARAM0 cpu_state.reg[a]
3777
        b = (insn >> 0) & 0xffff;
3778
        if(b & 0x00008000) b |= 0xffff8000;
3779
        #define PARAM1 b
3780
        {           /* "l_sfgeu" */
3781
          if(PARAM0 >= PARAM1)
3782
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3783
          else
3784
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3785
        }
3786
        #undef SET_PARAM
3787
        #undef PARAM0
3788
        #undef PARAM1
3789
 
3790
        if (do_stats) {
3791
          current->insn_index = 132;   /* "l.sfgeui" */
3792
          analysis(current);
3793
        }
3794
      }
3795
      break;
3796
    case 0x4:
3797
      /* Instruction: l.sfltui */
3798
      {
3799
        uorreg_t a, b;
3800
        /* Number of operands: 2 */
3801
        a = (insn >> 16) & 0x1f;
3802
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3803
        #define PARAM0 cpu_state.reg[a]
3804
        b = (insn >> 0) & 0xffff;
3805
        if(b & 0x00008000) b |= 0xffff8000;
3806
        #define PARAM1 b
3807
        {           /* "l_sfltu" */
3808
          if(PARAM0 < PARAM1)
3809
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3810
          else
3811
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3812
        }
3813
        #undef SET_PARAM
3814
        #undef PARAM0
3815
        #undef PARAM1
3816
 
3817
        if (do_stats) {
3818
          current->insn_index = 133;   /* "l.sfltui" */
3819
          analysis(current);
3820
        }
3821
      }
3822
      break;
3823
    case 0x5:
3824
      /* Instruction: l.sfleui */
3825
      {
3826
        uorreg_t a, b;
3827
        /* Number of operands: 2 */
3828
        a = (insn >> 16) & 0x1f;
3829
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3830
        #define PARAM0 cpu_state.reg[a]
3831
        b = (insn >> 0) & 0xffff;
3832
        if(b & 0x00008000) b |= 0xffff8000;
3833
        #define PARAM1 b
3834
        {           /* "l_sfleu" */
3835
          if(PARAM0 <= PARAM1)
3836
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3837
          else
3838
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3839
        }
3840
        #undef SET_PARAM
3841
        #undef PARAM0
3842
        #undef PARAM1
3843
 
3844
        if (do_stats) {
3845
          current->insn_index = 134;   /* "l.sfleui" */
3846
          analysis(current);
3847
        }
3848
      }
3849
      break;
3850
    case 0x6:
3851
    case 0x7:
3852
    case 0x8:
3853
    case 0x9:
3854
      /* Invalid instruction(s) */
3855
      break;
3856
    case 0xa:
3857
      /* Instruction: l.sfgtsi */
3858
      {
3859
        uorreg_t a, b;
3860
        /* Number of operands: 2 */
3861
        a = (insn >> 16) & 0x1f;
3862
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3863
        #define PARAM0 cpu_state.reg[a]
3864
        b = (insn >> 0) & 0xffff;
3865
        if(b & 0x00008000) b |= 0xffff8000;
3866
        #define PARAM1 b
3867
        {           /* "l_sfgts" */
3868
          if((orreg_t)PARAM0 > (orreg_t)PARAM1)
3869
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3870
          else
3871
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3872
        }
3873
        #undef SET_PARAM
3874
        #undef PARAM0
3875
        #undef PARAM1
3876
 
3877
        if (do_stats) {
3878
          current->insn_index = 135;   /* "l.sfgtsi" */
3879
          analysis(current);
3880
        }
3881
      }
3882
      break;
3883
    case 0xb:
3884
      /* Instruction: l.sfgesi */
3885
      {
3886
        uorreg_t a, b;
3887
        /* Number of operands: 2 */
3888
        a = (insn >> 16) & 0x1f;
3889
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3890
        #define PARAM0 cpu_state.reg[a]
3891
        b = (insn >> 0) & 0xffff;
3892
        if(b & 0x00008000) b |= 0xffff8000;
3893
        #define PARAM1 b
3894
        {           /* "l_sfges" */
3895
          if((orreg_t)PARAM0 >= (orreg_t)PARAM1)
3896
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3897
          else
3898
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3899
        }
3900
        #undef SET_PARAM
3901
        #undef PARAM0
3902
        #undef PARAM1
3903
 
3904
        if (do_stats) {
3905
          current->insn_index = 136;   /* "l.sfgesi" */
3906
          analysis(current);
3907
        }
3908
      }
3909
      break;
3910
    case 0xc:
3911
      /* Instruction: l.sfltsi */
3912
      {
3913
        uorreg_t a, b;
3914
        /* Number of operands: 2 */
3915
        a = (insn >> 16) & 0x1f;
3916
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3917
        #define PARAM0 cpu_state.reg[a]
3918
        b = (insn >> 0) & 0xffff;
3919
        if(b & 0x00008000) b |= 0xffff8000;
3920
        #define PARAM1 b
3921
        {           /* "l_sflts" */
3922
          if((orreg_t)PARAM0 < (orreg_t)PARAM1)
3923
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3924
          else
3925
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3926
        }
3927
        #undef SET_PARAM
3928
        #undef PARAM0
3929
        #undef PARAM1
3930
 
3931
        if (do_stats) {
3932
          current->insn_index = 137;   /* "l.sfltsi" */
3933
          analysis(current);
3934
        }
3935
      }
3936
      break;
3937
    case 0xd:
3938
      /* Instruction: l.sflesi */
3939
      {
3940
        uorreg_t a, b;
3941
        /* Number of operands: 2 */
3942
        a = (insn >> 16) & 0x1f;
3943
        #define SET_PARAM0(val) cpu_state.reg[a] = val
3944
        #define PARAM0 cpu_state.reg[a]
3945
        b = (insn >> 0) & 0xffff;
3946
        if(b & 0x00008000) b |= 0xffff8000;
3947
        #define PARAM1 b
3948
        {           /* "l_sfles" */
3949
          if((orreg_t)PARAM0 <= (orreg_t)PARAM1)
3950
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
3951
          else
3952
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
3953
        }
3954
        #undef SET_PARAM
3955
        #undef PARAM0
3956
        #undef PARAM1
3957
 
3958
        if (do_stats) {
3959
          current->insn_index = 138;   /* "l.sflesi" */
3960
          analysis(current);
3961
        }
3962
      }
3963
      break;
3964
    case 0xe:
3965
    case 0xf:
3966
    case 0x10:
3967
    case 0x11:
3968
    case 0x12:
3969
    case 0x13:
3970
    case 0x14:
3971
    case 0x15:
3972
    case 0x16:
3973
    case 0x17:
3974
    case 0x18:
3975
    case 0x19:
3976
    case 0x1a:
3977
    case 0x1b:
3978
    case 0x1c:
3979
    case 0x1d:
3980
    case 0x1e:
3981
    case 0x1f:
3982
      /* Invalid instruction(s) */
3983
      break;
3984
    }
3985
    break;
3986
  case 0x30:
3987
    /* Instruction: l.mtspr */
3988
    {
3989
      uorreg_t a, b, c;
3990
      /* Number of operands: 3 */
3991
      a = (insn >> 16) & 0x1f;
3992
      #define SET_PARAM0(val) cpu_state.reg[a] = val
3993
      #define PARAM0 cpu_state.reg[a]
3994
      b = (insn >> 11) & 0x1f;
3995
      #define PARAM1 cpu_state.reg[b]
3996
      c = (insn >> 0) & 0x7ff;
3997
      c |= ((insn >> 21) & 0x1f) << 11;
3998
      #define PARAM2 c
3999
      {         /* "l_mtspr" */
4000
        uint16_t regno = PARAM0 + PARAM2;
4001
        uorreg_t value = PARAM1;
4002
 
4003
        if (cpu_state.sprs[SPR_SR] & SPR_SR_SM)
4004
          mtspr(regno, value);
4005
        else {
4006
          PRINTF("WARNING: trying to write SPR while SR[SUPV] is cleared.\n");
4007
          sim_done();
4008
        }
4009
      }
4010
      #undef SET_PARAM
4011
      #undef PARAM0
4012
      #undef PARAM1
4013
      #undef PARAM2
4014
 
4015
      if (do_stats) {
4016
        current->insn_index = 139;   /* "l.mtspr" */
4017
        analysis(current);
4018
      }
4019
    }
4020
    break;
4021
  case 0x31:
4022
    switch((insn >> 0) & 0xf) {
4023
    case 0x0:
4024
      /* Invalid instruction(s) */
4025
      break;
4026
    case 0x1:
4027
      /* Instruction: l.mac */
4028
      {
4029
        uorreg_t a, b;
4030
        /* Number of operands: 2 */
4031
        a = (insn >> 16) & 0x1f;
4032
        #define SET_PARAM0(val) cpu_state.reg[a] = val
4033
        #define PARAM0 cpu_state.reg[a]
4034
        b = (insn >> 11) & 0x1f;
4035
        #define PARAM1 cpu_state.reg[b]
4036
        {           /* "l_mac" */
4037
          uorreg_t lo, hi;
4038
          LONGEST l;
4039
          orreg_t x, y;
4040
 
4041
          lo = cpu_state.sprs[SPR_MACLO];
4042
          hi = cpu_state.sprs[SPR_MACHI];
4043
          x = PARAM0;
4044
          y = PARAM1;
4045
          PRINTF ("[%"PRIxREG",%"PRIxREG"]\t", x, y);
4046
          l = (ULONGEST)lo | ((LONGEST)hi << 32);
4047
          l += (LONGEST) x * (LONGEST) y;
4048
 
4049
          /* This implementation is very fast - it needs only one cycle for mac.  */
4050
          lo = ((ULONGEST)l) & 0xFFFFFFFF;
4051
          hi = ((LONGEST)l) >> 32;
4052
          cpu_state.sprs[SPR_MACLO] = lo;
4053
          cpu_state.sprs[SPR_MACHI] = hi;
4054
          PRINTF ("(%"PRIxREG",%"PRIxREG"\n", hi, lo);
4055
        }
4056
        #undef SET_PARAM
4057
        #undef PARAM0
4058
        #undef PARAM1
4059
 
4060
        if (do_stats) {
4061
          current->insn_index = 140;   /* "l.mac" */
4062
          analysis(current);
4063
        }
4064
      }
4065
      break;
4066
    case 0x2:
4067
      /* Instruction: l.msb */
4068
      {
4069
        uorreg_t a, b;
4070
        /* Number of operands: 2 */
4071
        a = (insn >> 16) & 0x1f;
4072
        #define SET_PARAM0(val) cpu_state.reg[a] = val
4073
        #define PARAM0 cpu_state.reg[a]
4074
        b = (insn >> 11) & 0x1f;
4075
        #define PARAM1 cpu_state.reg[b]
4076
        {           /* "l_msb" */
4077
          uorreg_t lo, hi;
4078
          LONGEST l;
4079
          orreg_t x, y;
4080
 
4081
          lo = cpu_state.sprs[SPR_MACLO];
4082
          hi = cpu_state.sprs[SPR_MACHI];
4083
          x = PARAM0;
4084
          y = PARAM1;
4085
 
4086
          PRINTF ("[%"PRIxREG",%"PRIxREG"]\t", x, y);
4087
 
4088
          l = (ULONGEST)lo | ((LONGEST)hi << 32);
4089
          l -= x * y;
4090
 
4091
          /* This implementation is very fast - it needs only one cycle for msb.  */
4092
          lo = ((ULONGEST)l) & 0xFFFFFFFF;
4093
          hi = ((LONGEST)l) >> 32;
4094
          cpu_state.sprs[SPR_MACLO] = lo;
4095
          cpu_state.sprs[SPR_MACHI] = hi;
4096
          PRINTF ("(%"PRIxREG",%"PRIxREG")\n", hi, lo);
4097
        }
4098
        #undef SET_PARAM
4099
        #undef PARAM0
4100
        #undef PARAM1
4101
 
4102
        if (do_stats) {
4103
          current->insn_index = 141;   /* "l.msb" */
4104
          analysis(current);
4105
        }
4106
      }
4107
      break;
4108
    case 0x3:
4109
    case 0x4:
4110
    case 0x5:
4111
    case 0x6:
4112
    case 0x7:
4113
    case 0x8:
4114
    case 0x9:
4115
    case 0xa:
4116
    case 0xb:
4117
    case 0xc:
4118
    case 0xd:
4119
    case 0xe:
4120
    case 0xf:
4121
      /* Invalid instruction(s) */
4122
      break;
4123
    }
4124
    break;
4125
  case 0x32:
4126
    switch((insn >> 4) & 0xf) {
4127
    case 0x0:
4128
      switch((insn >> 0) & 0xf) {
4129
      case 0x0:
4130
        /* Instruction: lf.add.s */
4131
        {
4132
          uorreg_t a, b, c;
4133
          /* Number of operands: 3 */
4134
          a = (insn >> 21) & 0x1f;
4135
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4136
          #define PARAM0 cpu_state.reg[a]
4137
          b = (insn >> 16) & 0x1f;
4138
          #define PARAM1 cpu_state.reg[b]
4139
          c = (insn >> 11) & 0x1f;
4140
          #define PARAM2 cpu_state.reg[c]
4141
          {             /* "lf_add_s" */
4142
            SET_PARAM0((float)PARAM1 + (float)PARAM2);
4143
          }
4144
          #undef SET_PARAM
4145
          #undef PARAM0
4146
          #undef PARAM1
4147
          #undef PARAM2
4148
 
4149
          if (do_stats) {
4150
            current->insn_index = 142;   /* "lf.add.s" */
4151
            analysis(current);
4152
          }
4153
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4154
        }
4155
        break;
4156
      case 0x1:
4157
        /* Instruction: lf.sub.s */
4158
        {
4159
          uorreg_t a, b, c;
4160
          /* Number of operands: 3 */
4161
          a = (insn >> 21) & 0x1f;
4162
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4163
          #define PARAM0 cpu_state.reg[a]
4164
          b = (insn >> 16) & 0x1f;
4165
          #define PARAM1 cpu_state.reg[b]
4166
          c = (insn >> 11) & 0x1f;
4167
          #define PARAM2 cpu_state.reg[c]
4168
          {             /* "lf_sub_s" */
4169
            SET_PARAM0((float)PARAM1 - (float)PARAM2);
4170
          }
4171
          #undef SET_PARAM
4172
          #undef PARAM0
4173
          #undef PARAM1
4174
          #undef PARAM2
4175
 
4176
          if (do_stats) {
4177
            current->insn_index = 143;   /* "lf.sub.s" */
4178
            analysis(current);
4179
          }
4180
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4181
        }
4182
        break;
4183
      case 0x2:
4184
        /* Instruction: lf.mul.s */
4185
        {
4186
          uorreg_t a, b, c;
4187
          /* Number of operands: 3 */
4188
          a = (insn >> 21) & 0x1f;
4189
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4190
          #define PARAM0 cpu_state.reg[a]
4191
          b = (insn >> 16) & 0x1f;
4192
          #define PARAM1 cpu_state.reg[b]
4193
          c = (insn >> 11) & 0x1f;
4194
          #define PARAM2 cpu_state.reg[c]
4195
          {             /* "lf_mul_s" */
4196
            SET_PARAM0((float)PARAM1 * (float)PARAM2);
4197
          }
4198
          #undef SET_PARAM
4199
          #undef PARAM0
4200
          #undef PARAM1
4201
          #undef PARAM2
4202
 
4203
          if (do_stats) {
4204
            current->insn_index = 144;   /* "lf.mul.s" */
4205
            analysis(current);
4206
          }
4207
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4208
        }
4209
        break;
4210
      case 0x3:
4211
        /* Instruction: lf.div.s */
4212
        {
4213
          uorreg_t a, b, c;
4214
          /* Number of operands: 3 */
4215
          a = (insn >> 21) & 0x1f;
4216
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4217
          #define PARAM0 cpu_state.reg[a]
4218
          b = (insn >> 16) & 0x1f;
4219
          #define PARAM1 cpu_state.reg[b]
4220
          c = (insn >> 11) & 0x1f;
4221
          #define PARAM2 cpu_state.reg[c]
4222
          {             /* "lf_div_s" */
4223
            SET_PARAM0((float)PARAM1 / (float)PARAM2);
4224
          }
4225
          #undef SET_PARAM
4226
          #undef PARAM0
4227
          #undef PARAM1
4228
          #undef PARAM2
4229
 
4230
          if (do_stats) {
4231
            current->insn_index = 145;   /* "lf.div.s" */
4232
            analysis(current);
4233
          }
4234
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4235
        }
4236
        break;
4237
      case 0x4:
4238
        /* Not unique: real mask fc00f8ff and current mask fc0000ff differ - do final check */
4239
        if((insn & 0xfc00f8ff) == 0xc8000004) {
4240
          /* Instruction: lf.itof.s */
4241
          {
4242
            uorreg_t a, b;
4243
            /* Number of operands: 2 */
4244
            a = (insn >> 21) & 0x1f;
4245
            #define SET_PARAM0(val) cpu_state.reg[a] = val
4246
            #define PARAM0 cpu_state.reg[a]
4247
            b = (insn >> 16) & 0x1f;
4248
            #define PARAM1 cpu_state.reg[b]
4249
            {               /* "lf_itof_s" */
4250
            //  freg[get_operand(0)] = eval_operand32(1, &breakpoint);
4251
            }
4252
            #undef SET_PARAM
4253
            #undef PARAM0
4254
            #undef PARAM1
4255
 
4256
            if (do_stats) {
4257
              current->insn_index = 146;   /* "lf.itof.s" */
4258
              analysis(current);
4259
            }
4260
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4261
          }
4262
        } else {
4263
          /* Invalid insn */
4264
          {
4265
            l_invalid ();
4266
 
4267
            if (do_stats) {
4268
              current->insn_index = -1;   /* "???" */
4269
              analysis(current);
4270
            }
4271
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4272
          }
4273
        }
4274
        break;
4275
      case 0x5:
4276
        /* Not unique: real mask fc00f8ff and current mask fc0000ff differ - do final check */
4277
        if((insn & 0xfc00f8ff) == 0xc8000005) {
4278
          /* Instruction: lf.ftoi.s */
4279
          {
4280
            uorreg_t a, b;
4281
            /* Number of operands: 2 */
4282
            a = (insn >> 21) & 0x1f;
4283
            #define SET_PARAM0(val) cpu_state.reg[a] = val
4284
            #define PARAM0 cpu_state.reg[a]
4285
            b = (insn >> 16) & 0x1f;
4286
            #define PARAM1 cpu_state.reg[b]
4287
            {               /* "lf_ftoi_s" */
4288
            //  set_operand32(0, freg[get_operand(1)], &breakpoint);
4289
            }
4290
            #undef SET_PARAM
4291
            #undef PARAM0
4292
            #undef PARAM1
4293
 
4294
            if (do_stats) {
4295
              current->insn_index = 147;   /* "lf.ftoi.s" */
4296
              analysis(current);
4297
            }
4298
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4299
          }
4300
        } else {
4301
          /* Invalid insn */
4302
          {
4303
            l_invalid ();
4304
 
4305
            if (do_stats) {
4306
              current->insn_index = -1;   /* "???" */
4307
              analysis(current);
4308
            }
4309
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4310
          }
4311
        }
4312
        break;
4313
      case 0x6:
4314
        /* Instruction: lf.rem.s */
4315
        {
4316
          uorreg_t a, b, c;
4317
          /* Number of operands: 3 */
4318
          a = (insn >> 21) & 0x1f;
4319
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4320
          #define PARAM0 cpu_state.reg[a]
4321
          b = (insn >> 16) & 0x1f;
4322
          #define PARAM1 cpu_state.reg[b]
4323
          c = (insn >> 11) & 0x1f;
4324
          #define PARAM2 cpu_state.reg[c]
4325
          {             /* "lf_rem_s" */
4326
            float temp = (float)PARAM1 / (float)PARAM2;
4327
            SET_PARAM0(temp - (uint32_t)temp);
4328
          }
4329
          #undef SET_PARAM
4330
          #undef PARAM0
4331
          #undef PARAM1
4332
          #undef PARAM2
4333
 
4334
          if (do_stats) {
4335
            current->insn_index = 148;   /* "lf.rem.s" */
4336
            analysis(current);
4337
          }
4338
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4339
        }
4340
        break;
4341
      case 0x7:
4342
        /* Instruction: lf.madd.s */
4343
        {
4344
          uorreg_t a, b, c;
4345
          /* Number of operands: 3 */
4346
          a = (insn >> 21) & 0x1f;
4347
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4348
          #define PARAM0 cpu_state.reg[a]
4349
          b = (insn >> 16) & 0x1f;
4350
          #define PARAM1 cpu_state.reg[b]
4351
          c = (insn >> 11) & 0x1f;
4352
          #define PARAM2 cpu_state.reg[c]
4353
          {             /* "lf_madd_s" */
4354
            SET_PARAM0((float)PARAM0 + (float)PARAM1 * (float)PARAM2);
4355
          }
4356
          #undef SET_PARAM
4357
          #undef PARAM0
4358
          #undef PARAM1
4359
          #undef PARAM2
4360
 
4361
          if (do_stats) {
4362
            current->insn_index = 149;   /* "lf.madd.s" */
4363
            analysis(current);
4364
          }
4365
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4366
        }
4367
        break;
4368
      case 0x8:
4369
        /* Instruction: lf.sfeq.s */
4370
        {
4371
          uorreg_t a, b;
4372
          /* Number of operands: 2 */
4373
          a = (insn >> 16) & 0x1f;
4374
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4375
          #define PARAM0 cpu_state.reg[a]
4376
          b = (insn >> 11) & 0x1f;
4377
          #define PARAM1 cpu_state.reg[b]
4378
          {             /* "lf_sfeq_s" */
4379
            if((float)PARAM0 == (float)PARAM1)
4380
              cpu_state.sprs[SPR_SR] |= SPR_SR_F;
4381
            else
4382
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
4383
          }
4384
          #undef SET_PARAM
4385
          #undef PARAM0
4386
          #undef PARAM1
4387
 
4388
          if (do_stats) {
4389
            current->insn_index = 150;   /* "lf.sfeq.s" */
4390
            analysis(current);
4391
          }
4392
        }
4393
        break;
4394
      case 0x9:
4395
        /* Instruction: lf.sfne.s */
4396
        {
4397
          uorreg_t a, b;
4398
          /* Number of operands: 2 */
4399
          a = (insn >> 16) & 0x1f;
4400
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4401
          #define PARAM0 cpu_state.reg[a]
4402
          b = (insn >> 11) & 0x1f;
4403
          #define PARAM1 cpu_state.reg[b]
4404
          {             /* "lf_sfne_s" */
4405
            if((float)PARAM0 != (float)PARAM1)
4406
              cpu_state.sprs[SPR_SR] |= SPR_SR_F;
4407
            else
4408
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
4409
          }
4410
          #undef SET_PARAM
4411
          #undef PARAM0
4412
          #undef PARAM1
4413
 
4414
          if (do_stats) {
4415
            current->insn_index = 151;   /* "lf.sfne.s" */
4416
            analysis(current);
4417
          }
4418
        }
4419
        break;
4420
      case 0xa:
4421
        /* Instruction: lf.sfgt.s */
4422
        {
4423
          uorreg_t a, b;
4424
          /* Number of operands: 2 */
4425
          a = (insn >> 16) & 0x1f;
4426
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4427
          #define PARAM0 cpu_state.reg[a]
4428
          b = (insn >> 11) & 0x1f;
4429
          #define PARAM1 cpu_state.reg[b]
4430
          {             /* "lf_sfgt_s" */
4431
            if((float)PARAM0 > (float)PARAM1)
4432
              cpu_state.sprs[SPR_SR] |= SPR_SR_F;
4433
            else
4434
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
4435
          }
4436
          #undef SET_PARAM
4437
          #undef PARAM0
4438
          #undef PARAM1
4439
 
4440
          if (do_stats) {
4441
            current->insn_index = 152;   /* "lf.sfgt.s" */
4442
            analysis(current);
4443
          }
4444
        }
4445
        break;
4446
      case 0xb:
4447
        /* Instruction: lf.sfge.s */
4448
        {
4449
          uorreg_t a, b;
4450
          /* Number of operands: 2 */
4451
          a = (insn >> 16) & 0x1f;
4452
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4453
          #define PARAM0 cpu_state.reg[a]
4454
          b = (insn >> 11) & 0x1f;
4455
          #define PARAM1 cpu_state.reg[b]
4456
          {             /* "lf_sfge_s" */
4457
            if((float)PARAM0 >= (float)PARAM1)
4458
              cpu_state.sprs[SPR_SR] |= SPR_SR_F;
4459
            else
4460
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
4461
          }
4462
          #undef SET_PARAM
4463
          #undef PARAM0
4464
          #undef PARAM1
4465
 
4466
          if (do_stats) {
4467
            current->insn_index = 153;   /* "lf.sfge.s" */
4468
            analysis(current);
4469
          }
4470
        }
4471
        break;
4472
      case 0xc:
4473
        /* Instruction: lf.sflt.s */
4474
        {
4475
          uorreg_t a, b;
4476
          /* Number of operands: 2 */
4477
          a = (insn >> 16) & 0x1f;
4478
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4479
          #define PARAM0 cpu_state.reg[a]
4480
          b = (insn >> 11) & 0x1f;
4481
          #define PARAM1 cpu_state.reg[b]
4482
          {             /* "lf_sflt_s" */
4483
            if((float)PARAM0 < (float)PARAM1)
4484
              cpu_state.sprs[SPR_SR] |= SPR_SR_F;
4485
            else
4486
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
4487
          }
4488
          #undef SET_PARAM
4489
          #undef PARAM0
4490
          #undef PARAM1
4491
 
4492
          if (do_stats) {
4493
            current->insn_index = 154;   /* "lf.sflt.s" */
4494
            analysis(current);
4495
          }
4496
        }
4497
        break;
4498
      case 0xd:
4499
        /* Instruction: lf.sfle.s */
4500
        {
4501
          uorreg_t a, b;
4502
          /* Number of operands: 2 */
4503
          a = (insn >> 16) & 0x1f;
4504
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4505
          #define PARAM0 cpu_state.reg[a]
4506
          b = (insn >> 11) & 0x1f;
4507
          #define PARAM1 cpu_state.reg[b]
4508
          {             /* "lf_sfle_s" */
4509
            if((float)PARAM0 <= (float)PARAM1)
4510
              cpu_state.sprs[SPR_SR] |= SPR_SR_F;
4511
            else
4512
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
4513
          }
4514
          #undef SET_PARAM
4515
          #undef PARAM0
4516
          #undef PARAM1
4517
 
4518
          if (do_stats) {
4519
            current->insn_index = 155;   /* "lf.sfle.s" */
4520
            analysis(current);
4521
          }
4522
        }
4523
        break;
4524
      case 0xe:
4525
      case 0xf:
4526
        /* Invalid instruction(s) */
4527
        break;
4528
      }
4529
      break;
4530
    case 0x1:
4531
      switch((insn >> 0) & 0xf) {
4532
      case 0x0:
4533
        /* Instruction: lf.add.d */
4534
        {
4535
          uorreg_t a, b, c;
4536
          /* Number of operands: 3 */
4537
          a = (insn >> 21) & 0x1f;
4538
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4539
          #define PARAM0 cpu_state.reg[a]
4540
          b = (insn >> 16) & 0x1f;
4541
          #define PARAM1 cpu_state.reg[b]
4542
          c = (insn >> 11) & 0x1f;
4543
          #define PARAM2 cpu_state.reg[c]
4544
          l_invalid ();
4545
          #undef SET_PARAM
4546
          #undef PARAM0
4547
          #undef PARAM1
4548
          #undef PARAM2
4549
 
4550
          if (do_stats) {
4551
            current->insn_index = 157;   /* "lf.add.d" */
4552
            analysis(current);
4553
          }
4554
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4555
        }
4556
        break;
4557
      case 0x1:
4558
        /* Instruction: lf.sub.d */
4559
        {
4560
          uorreg_t a, b, c;
4561
          /* Number of operands: 3 */
4562
          a = (insn >> 21) & 0x1f;
4563
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4564
          #define PARAM0 cpu_state.reg[a]
4565
          b = (insn >> 16) & 0x1f;
4566
          #define PARAM1 cpu_state.reg[b]
4567
          c = (insn >> 11) & 0x1f;
4568
          #define PARAM2 cpu_state.reg[c]
4569
          l_invalid ();
4570
          #undef SET_PARAM
4571
          #undef PARAM0
4572
          #undef PARAM1
4573
          #undef PARAM2
4574
 
4575
          if (do_stats) {
4576
            current->insn_index = 158;   /* "lf.sub.d" */
4577
            analysis(current);
4578
          }
4579
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4580
        }
4581
        break;
4582
      case 0x2:
4583
        /* Instruction: lf.mul.d */
4584
        {
4585
          uorreg_t a, b, c;
4586
          /* Number of operands: 3 */
4587
          a = (insn >> 21) & 0x1f;
4588
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4589
          #define PARAM0 cpu_state.reg[a]
4590
          b = (insn >> 16) & 0x1f;
4591
          #define PARAM1 cpu_state.reg[b]
4592
          c = (insn >> 11) & 0x1f;
4593
          #define PARAM2 cpu_state.reg[c]
4594
          l_invalid ();
4595
          #undef SET_PARAM
4596
          #undef PARAM0
4597
          #undef PARAM1
4598
          #undef PARAM2
4599
 
4600
          if (do_stats) {
4601
            current->insn_index = 159;   /* "lf.mul.d" */
4602
            analysis(current);
4603
          }
4604
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4605
        }
4606
        break;
4607
      case 0x3:
4608
        /* Instruction: lf.div.d */
4609
        {
4610
          uorreg_t a, b, c;
4611
          /* Number of operands: 3 */
4612
          a = (insn >> 21) & 0x1f;
4613
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4614
          #define PARAM0 cpu_state.reg[a]
4615
          b = (insn >> 16) & 0x1f;
4616
          #define PARAM1 cpu_state.reg[b]
4617
          c = (insn >> 11) & 0x1f;
4618
          #define PARAM2 cpu_state.reg[c]
4619
          l_invalid ();
4620
          #undef SET_PARAM
4621
          #undef PARAM0
4622
          #undef PARAM1
4623
          #undef PARAM2
4624
 
4625
          if (do_stats) {
4626
            current->insn_index = 160;   /* "lf.div.d" */
4627
            analysis(current);
4628
          }
4629
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4630
        }
4631
        break;
4632
      case 0x4:
4633
        /* Not unique: real mask fc00f8ff and current mask fc0000ff differ - do final check */
4634
        if((insn & 0xfc00f8ff) == 0xc8000014) {
4635
          /* Instruction: lf.itof.d */
4636
          {
4637
            uorreg_t a, b;
4638
            /* Number of operands: 2 */
4639
            a = (insn >> 21) & 0x1f;
4640
            #define SET_PARAM0(val) cpu_state.reg[a] = val
4641
            #define PARAM0 cpu_state.reg[a]
4642
            b = (insn >> 16) & 0x1f;
4643
            #define PARAM1 cpu_state.reg[b]
4644
            l_invalid ();
4645
            #undef SET_PARAM
4646
            #undef PARAM0
4647
            #undef PARAM1
4648
 
4649
            if (do_stats) {
4650
              current->insn_index = 161;   /* "lf.itof.d" */
4651
              analysis(current);
4652
            }
4653
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4654
          }
4655
        } else {
4656
          /* Invalid insn */
4657
          {
4658
            l_invalid ();
4659
 
4660
            if (do_stats) {
4661
              current->insn_index = -1;   /* "???" */
4662
              analysis(current);
4663
            }
4664
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4665
          }
4666
        }
4667
        break;
4668
      case 0x5:
4669
        /* Not unique: real mask fc00f8ff and current mask fc0000ff differ - do final check */
4670
        if((insn & 0xfc00f8ff) == 0xc8000015) {
4671
          /* Instruction: lf.ftoi.d */
4672
          {
4673
            uorreg_t a, b;
4674
            /* Number of operands: 2 */
4675
            a = (insn >> 21) & 0x1f;
4676
            #define SET_PARAM0(val) cpu_state.reg[a] = val
4677
            #define PARAM0 cpu_state.reg[a]
4678
            b = (insn >> 16) & 0x1f;
4679
            #define PARAM1 cpu_state.reg[b]
4680
            l_invalid ();
4681
            #undef SET_PARAM
4682
            #undef PARAM0
4683
            #undef PARAM1
4684
 
4685
            if (do_stats) {
4686
              current->insn_index = 162;   /* "lf.ftoi.d" */
4687
              analysis(current);
4688
            }
4689
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4690
          }
4691
        } else {
4692
          /* Invalid insn */
4693
          {
4694
            l_invalid ();
4695
 
4696
            if (do_stats) {
4697
              current->insn_index = -1;   /* "???" */
4698
              analysis(current);
4699
            }
4700
            cpu_state.reg[0] = 0; /* Repair in case we changed it */
4701
          }
4702
        }
4703
        break;
4704
      case 0x6:
4705
        /* Instruction: lf.rem.d */
4706
        {
4707
          uorreg_t a, b, c;
4708
          /* Number of operands: 3 */
4709
          a = (insn >> 21) & 0x1f;
4710
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4711
          #define PARAM0 cpu_state.reg[a]
4712
          b = (insn >> 16) & 0x1f;
4713
          #define PARAM1 cpu_state.reg[b]
4714
          c = (insn >> 11) & 0x1f;
4715
          #define PARAM2 cpu_state.reg[c]
4716
          l_invalid ();
4717
          #undef SET_PARAM
4718
          #undef PARAM0
4719
          #undef PARAM1
4720
          #undef PARAM2
4721
 
4722
          if (do_stats) {
4723
            current->insn_index = 163;   /* "lf.rem.d" */
4724
            analysis(current);
4725
          }
4726
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4727
        }
4728
        break;
4729
      case 0x7:
4730
        /* Instruction: lf.madd.d */
4731
        {
4732
          uorreg_t a, b, c;
4733
          /* Number of operands: 3 */
4734
          a = (insn >> 21) & 0x1f;
4735
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4736
          #define PARAM0 cpu_state.reg[a]
4737
          b = (insn >> 16) & 0x1f;
4738
          #define PARAM1 cpu_state.reg[b]
4739
          c = (insn >> 11) & 0x1f;
4740
          #define PARAM2 cpu_state.reg[c]
4741
          l_invalid ();
4742
          #undef SET_PARAM
4743
          #undef PARAM0
4744
          #undef PARAM1
4745
          #undef PARAM2
4746
 
4747
          if (do_stats) {
4748
            current->insn_index = 164;   /* "lf.madd.d" */
4749
            analysis(current);
4750
          }
4751
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
4752
        }
4753
        break;
4754
      case 0x8:
4755
        /* Instruction: lf.sfeq.d */
4756
        {
4757
          uorreg_t a, b;
4758
          /* Number of operands: 2 */
4759
          a = (insn >> 16) & 0x1f;
4760
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4761
          #define PARAM0 cpu_state.reg[a]
4762
          b = (insn >> 11) & 0x1f;
4763
          #define PARAM1 cpu_state.reg[b]
4764
          l_invalid ();
4765
          #undef SET_PARAM
4766
          #undef PARAM0
4767
          #undef PARAM1
4768
 
4769
          if (do_stats) {
4770
            current->insn_index = 165;   /* "lf.sfeq.d" */
4771
            analysis(current);
4772
          }
4773
        }
4774
        break;
4775
      case 0x9:
4776
        /* Instruction: lf.sfne.d */
4777
        {
4778
          uorreg_t a, b;
4779
          /* Number of operands: 2 */
4780
          a = (insn >> 16) & 0x1f;
4781
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4782
          #define PARAM0 cpu_state.reg[a]
4783
          b = (insn >> 11) & 0x1f;
4784
          #define PARAM1 cpu_state.reg[b]
4785
          l_invalid ();
4786
          #undef SET_PARAM
4787
          #undef PARAM0
4788
          #undef PARAM1
4789
 
4790
          if (do_stats) {
4791
            current->insn_index = 166;   /* "lf.sfne.d" */
4792
            analysis(current);
4793
          }
4794
        }
4795
        break;
4796
      case 0xa:
4797
        /* Instruction: lf.sfgt.d */
4798
        {
4799
          uorreg_t a, b;
4800
          /* Number of operands: 2 */
4801
          a = (insn >> 16) & 0x1f;
4802
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4803
          #define PARAM0 cpu_state.reg[a]
4804
          b = (insn >> 11) & 0x1f;
4805
          #define PARAM1 cpu_state.reg[b]
4806
          l_invalid ();
4807
          #undef SET_PARAM
4808
          #undef PARAM0
4809
          #undef PARAM1
4810
 
4811
          if (do_stats) {
4812
            current->insn_index = 167;   /* "lf.sfgt.d" */
4813
            analysis(current);
4814
          }
4815
        }
4816
        break;
4817
      case 0xb:
4818
        /* Instruction: lf.sfge.d */
4819
        {
4820
          uorreg_t a, b;
4821
          /* Number of operands: 2 */
4822
          a = (insn >> 16) & 0x1f;
4823
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4824
          #define PARAM0 cpu_state.reg[a]
4825
          b = (insn >> 11) & 0x1f;
4826
          #define PARAM1 cpu_state.reg[b]
4827
          l_invalid ();
4828
          #undef SET_PARAM
4829
          #undef PARAM0
4830
          #undef PARAM1
4831
 
4832
          if (do_stats) {
4833
            current->insn_index = 168;   /* "lf.sfge.d" */
4834
            analysis(current);
4835
          }
4836
        }
4837
        break;
4838
      case 0xc:
4839
        /* Instruction: lf.sflt.d */
4840
        {
4841
          uorreg_t a, b;
4842
          /* Number of operands: 2 */
4843
          a = (insn >> 16) & 0x1f;
4844
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4845
          #define PARAM0 cpu_state.reg[a]
4846
          b = (insn >> 11) & 0x1f;
4847
          #define PARAM1 cpu_state.reg[b]
4848
          l_invalid ();
4849
          #undef SET_PARAM
4850
          #undef PARAM0
4851
          #undef PARAM1
4852
 
4853
          if (do_stats) {
4854
            current->insn_index = 169;   /* "lf.sflt.d" */
4855
            analysis(current);
4856
          }
4857
        }
4858
        break;
4859
      case 0xd:
4860
        /* Instruction: lf.sfle.d */
4861
        {
4862
          uorreg_t a, b;
4863
          /* Number of operands: 2 */
4864
          a = (insn >> 16) & 0x1f;
4865
          #define SET_PARAM0(val) cpu_state.reg[a] = val
4866
          #define PARAM0 cpu_state.reg[a]
4867
          b = (insn >> 11) & 0x1f;
4868
          #define PARAM1 cpu_state.reg[b]
4869
          l_invalid ();
4870
          #undef SET_PARAM
4871
          #undef PARAM0
4872
          #undef PARAM1
4873
 
4874
          if (do_stats) {
4875
            current->insn_index = 170;   /* "lf.sfle.d" */
4876
            analysis(current);
4877
          }
4878
        }
4879
        break;
4880
      case 0xe:
4881
      case 0xf:
4882
        /* Invalid instruction(s) */
4883
        break;
4884
      }
4885
      break;
4886
    case 0x2:
4887
    case 0x3:
4888
    case 0x4:
4889
    case 0x5:
4890
    case 0x6:
4891
    case 0x7:
4892
    case 0x8:
4893
    case 0x9:
4894
    case 0xa:
4895
    case 0xb:
4896
    case 0xc:
4897
      /* Invalid instruction(s) */
4898
      break;
4899
    case 0xd:
4900
      /* Instruction: lf.cust1.s */
4901
      {
4902
        uorreg_t a, b;
4903
        /* Number of operands: 2 */
4904
        a = (insn >> 16) & 0x1f;
4905
        #define SET_PARAM0(val) cpu_state.reg[a] = val
4906
        #define PARAM0 cpu_state.reg[a]
4907
        b = (insn >> 11) & 0x1f;
4908
        #define PARAM1 cpu_state.reg[b]
4909
        l_invalid ();
4910
        #undef SET_PARAM
4911
        #undef PARAM0
4912
        #undef PARAM1
4913
 
4914
        if (do_stats) {
4915
          current->insn_index = 156;   /* "lf.cust1.s" */
4916
          analysis(current);
4917
        }
4918
      }
4919
      break;
4920
    case 0xe:
4921
      /* Instruction: lf.cust1.d */
4922
      {
4923
        uorreg_t a, b;
4924
        /* Number of operands: 2 */
4925
        a = (insn >> 16) & 0x1f;
4926
        #define SET_PARAM0(val) cpu_state.reg[a] = val
4927
        #define PARAM0 cpu_state.reg[a]
4928
        b = (insn >> 11) & 0x1f;
4929
        #define PARAM1 cpu_state.reg[b]
4930
        l_invalid ();
4931
        #undef SET_PARAM
4932
        #undef PARAM0
4933
        #undef PARAM1
4934
 
4935
        if (do_stats) {
4936
          current->insn_index = 171;   /* "lf.cust1.d" */
4937
          analysis(current);
4938
        }
4939
      }
4940
      break;
4941
    case 0xf:
4942
      /* Invalid instruction(s) */
4943
      break;
4944
    }
4945
    break;
4946
  case 0x33:
4947
    /* Invalid instruction(s) */
4948
    break;
4949
  case 0x34:
4950
    /* Instruction: l.sd */
4951
    {
4952
      uorreg_t a, b;
4953
      /* Number of operands: 2 */
4954
      a = (insn >> 0) & 0x7ff;
4955
      a |= ((insn >> 21) & 0x1f) << 11;
4956
      if(a & 0x00008000) a |= 0xffff8000;
4957
      *(orreg_t *)&a += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
4958
      #define PARAM0 a
4959
      b = (insn >> 11) & 0x1f;
4960
      #define PARAM1 cpu_state.reg[b]
4961
      l_invalid ();
4962
      #undef PARAM0
4963
      #undef PARAM1
4964
 
4965
      if (do_stats) {
4966
        cpu_state.insn_ea = a;
4967
        current->insn_index = 172;   /* "l.sd" */
4968
        analysis(current);
4969
      }
4970
    }
4971
    break;
4972
  case 0x35:
4973
    /* Instruction: l.sw */
4974
    {
4975
      uorreg_t a, b;
4976
      /* Number of operands: 2 */
4977
      a = (insn >> 0) & 0x7ff;
4978
      a |= ((insn >> 21) & 0x1f) << 11;
4979
      if(a & 0x00008000) a |= 0xffff8000;
4980
      *(orreg_t *)&a += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
4981
      #define PARAM0 a
4982
      b = (insn >> 11) & 0x1f;
4983
      #define PARAM1 cpu_state.reg[b]
4984
      {         /* "l_sw" */
4985
        int old_cyc = 0;
4986
        if (config.cpu.sbuf_len) old_cyc = runtime.sim.mem_cycles;
4987
        set_mem32(PARAM0, PARAM1, &breakpoint);
4988
        if (config.cpu.sbuf_len) {
4989
          int t = runtime.sim.mem_cycles;
4990
          runtime.sim.mem_cycles = old_cyc;
4991
          sbuf_store (t - old_cyc);
4992
        }
4993
      }
4994
      #undef PARAM0
4995
      #undef PARAM1
4996
 
4997
      if (do_stats) {
4998
        cpu_state.insn_ea = a;
4999
        current->insn_index = 173;   /* "l.sw" */
5000
        analysis(current);
5001
      }
5002
    }
5003
    break;
5004
  case 0x36:
5005
    /* Instruction: l.sb */
5006
    {
5007
      uorreg_t a, b;
5008
      /* Number of operands: 2 */
5009
      a = (insn >> 0) & 0x7ff;
5010
      a |= ((insn >> 21) & 0x1f) << 11;
5011
      if(a & 0x00008000) a |= 0xffff8000;
5012
      *(orreg_t *)&a += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
5013
      #define PARAM0 a
5014
      b = (insn >> 11) & 0x1f;
5015
      #define PARAM1 cpu_state.reg[b]
5016
      {         /* "l_sb" */
5017
        int old_cyc = 0;
5018
        if (config.cpu.sbuf_len) old_cyc = runtime.sim.mem_cycles;
5019
        set_mem8(PARAM0, PARAM1, &breakpoint);
5020
        if (config.cpu.sbuf_len) {
5021
          int t = runtime.sim.mem_cycles;
5022
          runtime.sim.mem_cycles = old_cyc;
5023
          sbuf_store (t- old_cyc);
5024
        }
5025
      }
5026
      #undef PARAM0
5027
      #undef PARAM1
5028
 
5029
      if (do_stats) {
5030
        cpu_state.insn_ea = a;
5031
        current->insn_index = 174;   /* "l.sb" */
5032
        analysis(current);
5033
      }
5034
    }
5035
    break;
5036
  case 0x37:
5037
    /* Instruction: l.sh */
5038
    {
5039
      uorreg_t a, b;
5040
      /* Number of operands: 2 */
5041
      a = (insn >> 0) & 0x7ff;
5042
      a |= ((insn >> 21) & 0x1f) << 11;
5043
      if(a & 0x00008000) a |= 0xffff8000;
5044
      *(orreg_t *)&a += (orreg_t)cpu_state.reg[(insn >> 16) & 0x1f];
5045
      #define PARAM0 a
5046
      b = (insn >> 11) & 0x1f;
5047
      #define PARAM1 cpu_state.reg[b]
5048
      {         /* "l_sh" */
5049
        int old_cyc = 0;
5050
        if (config.cpu.sbuf_len) old_cyc = runtime.sim.mem_cycles;
5051
        set_mem16(PARAM0, PARAM1, &breakpoint);
5052
        if (config.cpu.sbuf_len) {
5053
          int t = runtime.sim.mem_cycles;
5054
          runtime.sim.mem_cycles = old_cyc;
5055
          sbuf_store (t - old_cyc);
5056
        }
5057
      }
5058
      #undef PARAM0
5059
      #undef PARAM1
5060
 
5061
      if (do_stats) {
5062
        cpu_state.insn_ea = a;
5063
        current->insn_index = 175;   /* "l.sh" */
5064
        analysis(current);
5065
      }
5066
    }
5067
    break;
5068
  case 0x38:
5069
    switch((insn >> 0) & 0xf) {
5070
    case 0x0:
5071
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5072
      if((insn & 0xfc00030f) == 0xe0000000) {
5073
        /* Instruction: l.add */
5074
        {
5075
          uorreg_t a, b, c;
5076
          /* Number of operands: 3 */
5077
          a = (insn >> 21) & 0x1f;
5078
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5079
          #define PARAM0 cpu_state.reg[a]
5080
          b = (insn >> 16) & 0x1f;
5081
          #define PARAM1 cpu_state.reg[b]
5082
          c = (insn >> 11) & 0x1f;
5083
          #define PARAM2 cpu_state.reg[c]
5084
          {             /* "l_add" */
5085
            orreg_t temp1, temp2, temp3;
5086
            int8_t temp4;
5087
 
5088
            temp2 = (orreg_t)PARAM2;
5089
            temp3 = (orreg_t)PARAM1;
5090
            temp1 = temp2 + temp3;
5091
            SET_PARAM0(temp1);
5092
            SET_OV_FLAG_FN (temp1);
5093
            if (ARITH_SET_FLAG) {
5094
              if(!temp1)
5095
                cpu_state.sprs[SPR_SR] |= SPR_SR_F;
5096
              else
5097
                cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
5098
            }
5099
            if ((uorreg_t) temp1 < (uorreg_t) temp2)
5100
              cpu_state.sprs[SPR_SR] |= SPR_SR_CY;
5101
            else
5102
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_CY;
5103
 
5104
            temp4 = temp1;
5105
            if (temp4 == temp1)
5106
              or1k_mstats.byteadd++;
5107
          }
5108
          #undef SET_PARAM
5109
          #undef PARAM0
5110
          #undef PARAM1
5111
          #undef PARAM2
5112
 
5113
          if (do_stats) {
5114
            current->insn_index = 176;   /* "l.add" */
5115
            analysis(current);
5116
          }
5117
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5118
        }
5119
      } else {
5120
        /* Invalid insn */
5121
        {
5122
          l_invalid ();
5123
 
5124
          if (do_stats) {
5125
            current->insn_index = -1;   /* "???" */
5126
            analysis(current);
5127
          }
5128
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5129
        }
5130
      }
5131
      break;
5132
    case 0x1:
5133
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5134
      if((insn & 0xfc00030f) == 0xe0000001) {
5135
        /* Instruction: l.addc */
5136
        {
5137
          uorreg_t a, b, c;
5138
          /* Number of operands: 3 */
5139
          a = (insn >> 21) & 0x1f;
5140
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5141
          #define PARAM0 cpu_state.reg[a]
5142
          b = (insn >> 16) & 0x1f;
5143
          #define PARAM1 cpu_state.reg[b]
5144
          c = (insn >> 11) & 0x1f;
5145
          #define PARAM2 cpu_state.reg[c]
5146
          {             /* "l_addc" */
5147
            orreg_t temp1, temp2, temp3;
5148
            int8_t temp4;
5149
 
5150
            temp2 = (orreg_t)PARAM2;
5151
            temp3 = (orreg_t)PARAM1;
5152
            temp1 = temp2 + temp3;
5153
            if(cpu_state.sprs[SPR_SR] & SPR_SR_CY)
5154
              temp1++;
5155
            SET_PARAM0(temp1);
5156
            SET_OV_FLAG_FN (temp1);
5157
            if (ARITH_SET_FLAG) {
5158
              if(!temp1)
5159
                cpu_state.sprs[SPR_SR] |= SPR_SR_F;
5160
              else
5161
                cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
5162
            }
5163
            if ((uorreg_t) temp1 < (uorreg_t) temp2)
5164
              cpu_state.sprs[SPR_SR] |= SPR_SR_CY;
5165
            else
5166
              cpu_state.sprs[SPR_SR] &= ~SPR_SR_CY;
5167
 
5168
            temp4 = temp1;
5169
            if (temp4 == temp1)
5170
              or1k_mstats.byteadd++;
5171
          }
5172
          #undef SET_PARAM
5173
          #undef PARAM0
5174
          #undef PARAM1
5175
          #undef PARAM2
5176
 
5177
          if (do_stats) {
5178
            current->insn_index = 177;   /* "l.addc" */
5179
            analysis(current);
5180
          }
5181
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5182
        }
5183
      } else {
5184
        /* Invalid insn */
5185
        {
5186
          l_invalid ();
5187
 
5188
          if (do_stats) {
5189
            current->insn_index = -1;   /* "???" */
5190
            analysis(current);
5191
          }
5192
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5193
        }
5194
      }
5195
      break;
5196
    case 0x2:
5197
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5198
      if((insn & 0xfc00030f) == 0xe0000002) {
5199
        /* Instruction: l.sub */
5200
        {
5201
          uorreg_t a, b, c;
5202
          /* Number of operands: 3 */
5203
          a = (insn >> 21) & 0x1f;
5204
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5205
          #define PARAM0 cpu_state.reg[a]
5206
          b = (insn >> 16) & 0x1f;
5207
          #define PARAM1 cpu_state.reg[b]
5208
          c = (insn >> 11) & 0x1f;
5209
          #define PARAM2 cpu_state.reg[c]
5210
          {             /* "l_sub" */
5211
            orreg_t temp1;
5212
            temp1 = (orreg_t)PARAM1 - (orreg_t)PARAM2;
5213
            SET_OV_FLAG_FN (temp1);
5214
            SET_PARAM0(temp1);
5215
          }
5216
          #undef SET_PARAM
5217
          #undef PARAM0
5218
          #undef PARAM1
5219
          #undef PARAM2
5220
 
5221
          if (do_stats) {
5222
            current->insn_index = 178;   /* "l.sub" */
5223
            analysis(current);
5224
          }
5225
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5226
        }
5227
      } else {
5228
        /* Invalid insn */
5229
        {
5230
          l_invalid ();
5231
 
5232
          if (do_stats) {
5233
            current->insn_index = -1;   /* "???" */
5234
            analysis(current);
5235
          }
5236
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5237
        }
5238
      }
5239
      break;
5240
    case 0x3:
5241
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5242
      if((insn & 0xfc00030f) == 0xe0000003) {
5243
        /* Instruction: l.and */
5244
        {
5245
          uorreg_t a, b, c;
5246
          /* Number of operands: 3 */
5247
          a = (insn >> 21) & 0x1f;
5248
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5249
          #define PARAM0 cpu_state.reg[a]
5250
          b = (insn >> 16) & 0x1f;
5251
          #define PARAM1 cpu_state.reg[b]
5252
          c = (insn >> 11) & 0x1f;
5253
          #define PARAM2 cpu_state.reg[c]
5254
          {             /* "l_and" */
5255
            uorreg_t temp1;
5256
            temp1 = PARAM1 & PARAM2;
5257
            SET_OV_FLAG_FN (temp1);
5258
            SET_PARAM0(temp1);
5259
            if (ARITH_SET_FLAG) {
5260
              if(!temp1)
5261
                cpu_state.sprs[SPR_SR] |= SPR_SR_F;
5262
              else
5263
                cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
5264
            }
5265
          }
5266
          #undef SET_PARAM
5267
          #undef PARAM0
5268
          #undef PARAM1
5269
          #undef PARAM2
5270
 
5271
          if (do_stats) {
5272
            current->insn_index = 179;   /* "l.and" */
5273
            analysis(current);
5274
          }
5275
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5276
        }
5277
      } else {
5278
        /* Invalid insn */
5279
        {
5280
          l_invalid ();
5281
 
5282
          if (do_stats) {
5283
            current->insn_index = -1;   /* "???" */
5284
            analysis(current);
5285
          }
5286
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5287
        }
5288
      }
5289
      break;
5290
    case 0x4:
5291
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5292
      if((insn & 0xfc00030f) == 0xe0000004) {
5293
        /* Instruction: l.or */
5294
        {
5295
          uorreg_t a, b, c;
5296
          /* Number of operands: 3 */
5297
          a = (insn >> 21) & 0x1f;
5298
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5299
          #define PARAM0 cpu_state.reg[a]
5300
          b = (insn >> 16) & 0x1f;
5301
          #define PARAM1 cpu_state.reg[b]
5302
          c = (insn >> 11) & 0x1f;
5303
          #define PARAM2 cpu_state.reg[c]
5304
          {             /* "l_or" */
5305
            uorreg_t temp1;
5306
            temp1 = PARAM1 | PARAM2;
5307
            SET_OV_FLAG_FN (temp1);
5308
            SET_PARAM0(temp1);
5309
          }
5310
          #undef SET_PARAM
5311
          #undef PARAM0
5312
          #undef PARAM1
5313
          #undef PARAM2
5314
 
5315
          if (do_stats) {
5316
            current->insn_index = 180;   /* "l.or" */
5317
            analysis(current);
5318
          }
5319
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5320
        }
5321
      } else {
5322
        /* Invalid insn */
5323
        {
5324
          l_invalid ();
5325
 
5326
          if (do_stats) {
5327
            current->insn_index = -1;   /* "???" */
5328
            analysis(current);
5329
          }
5330
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5331
        }
5332
      }
5333
      break;
5334
    case 0x5:
5335
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5336
      if((insn & 0xfc00030f) == 0xe0000005) {
5337
        /* Instruction: l.xor */
5338
        {
5339
          uorreg_t a, b, c;
5340
          /* Number of operands: 3 */
5341
          a = (insn >> 21) & 0x1f;
5342
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5343
          #define PARAM0 cpu_state.reg[a]
5344
          b = (insn >> 16) & 0x1f;
5345
          #define PARAM1 cpu_state.reg[b]
5346
          c = (insn >> 11) & 0x1f;
5347
          #define PARAM2 cpu_state.reg[c]
5348
          {             /* "l_xor" */
5349
            uorreg_t temp1;
5350
            temp1 = PARAM1 ^ PARAM2;
5351
            SET_OV_FLAG_FN (temp1);
5352
            SET_PARAM0(temp1);
5353
          }
5354
          #undef SET_PARAM
5355
          #undef PARAM0
5356
          #undef PARAM1
5357
          #undef PARAM2
5358
 
5359
          if (do_stats) {
5360
            current->insn_index = 181;   /* "l.xor" */
5361
            analysis(current);
5362
          }
5363
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5364
        }
5365
      } else {
5366
        /* Invalid insn */
5367
        {
5368
          l_invalid ();
5369
 
5370
          if (do_stats) {
5371
            current->insn_index = -1;   /* "???" */
5372
            analysis(current);
5373
          }
5374
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5375
        }
5376
      }
5377
      break;
5378
    case 0x6:
5379
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5380
      if((insn & 0xfc00030f) == 0xe0000306) {
5381
        /* Instruction: l.mul */
5382
        {
5383
          uorreg_t a, b, c;
5384
          /* Number of operands: 3 */
5385
          a = (insn >> 21) & 0x1f;
5386
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5387
          #define PARAM0 cpu_state.reg[a]
5388
          b = (insn >> 16) & 0x1f;
5389
          #define PARAM1 cpu_state.reg[b]
5390
          c = (insn >> 11) & 0x1f;
5391
          #define PARAM2 cpu_state.reg[c]
5392
          {             /* "l_mul" */
5393
            orreg_t temp1;
5394
 
5395
            temp1 = (orreg_t)PARAM1 * (orreg_t)PARAM2;
5396
            SET_OV_FLAG_FN (temp1);
5397
            SET_PARAM0(temp1);
5398
            /*if (!(mcount++ & 1023)) {
5399
              PRINTF ("[%i]\n",mcount);
5400
              }*/
5401
          }
5402
          #undef SET_PARAM
5403
          #undef PARAM0
5404
          #undef PARAM1
5405
          #undef PARAM2
5406
 
5407
          if (do_stats) {
5408
            current->insn_index = 182;   /* "l.mul" */
5409
            analysis(current);
5410
          }
5411
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5412
        }
5413
      } else {
5414
        /* Invalid insn */
5415
        {
5416
          l_invalid ();
5417
 
5418
          if (do_stats) {
5419
            current->insn_index = -1;   /* "???" */
5420
            analysis(current);
5421
          }
5422
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5423
        }
5424
      }
5425
      break;
5426
    case 0x7:
5427
      /* Invalid instruction(s) */
5428
      break;
5429
    case 0x8:
5430
      switch((insn >> 6) & 0xf) {
5431
      case 0x0:
5432
        /* Instruction: l.sll */
5433
        {
5434
          uorreg_t a, b, c;
5435
          /* Number of operands: 3 */
5436
          a = (insn >> 21) & 0x1f;
5437
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5438
          #define PARAM0 cpu_state.reg[a]
5439
          b = (insn >> 16) & 0x1f;
5440
          #define PARAM1 cpu_state.reg[b]
5441
          c = (insn >> 11) & 0x1f;
5442
          #define PARAM2 cpu_state.reg[c]
5443
          {             /* "l_sll" */
5444
            uorreg_t temp1;
5445
 
5446
            temp1 = PARAM1 << PARAM2;
5447
            SET_OV_FLAG_FN (temp1);
5448
            SET_PARAM0(temp1);
5449
            /* runtime.sim.cycles += 2; */
5450
          }
5451
          #undef SET_PARAM
5452
          #undef PARAM0
5453
          #undef PARAM1
5454
          #undef PARAM2
5455
 
5456
          if (do_stats) {
5457
            current->insn_index = 183;   /* "l.sll" */
5458
            analysis(current);
5459
          }
5460
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5461
        }
5462
        break;
5463
      case 0x1:
5464
        /* Instruction: l.srl */
5465
        {
5466
          uorreg_t a, b, c;
5467
          /* Number of operands: 3 */
5468
          a = (insn >> 21) & 0x1f;
5469
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5470
          #define PARAM0 cpu_state.reg[a]
5471
          b = (insn >> 16) & 0x1f;
5472
          #define PARAM1 cpu_state.reg[b]
5473
          c = (insn >> 11) & 0x1f;
5474
          #define PARAM2 cpu_state.reg[c]
5475
          {             /* "l_srl" */
5476
            uorreg_t temp1;
5477
            temp1 = PARAM1 >> PARAM2;
5478
            SET_OV_FLAG_FN (temp1);
5479
            SET_PARAM0(temp1);
5480
            /* runtime.sim.cycles += 2; */
5481
          }
5482
          #undef SET_PARAM
5483
          #undef PARAM0
5484
          #undef PARAM1
5485
          #undef PARAM2
5486
 
5487
          if (do_stats) {
5488
            current->insn_index = 184;   /* "l.srl" */
5489
            analysis(current);
5490
          }
5491
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5492
        }
5493
        break;
5494
      case 0x2:
5495
        /* Instruction: l.sra */
5496
        {
5497
          uorreg_t a, b, c;
5498
          /* Number of operands: 3 */
5499
          a = (insn >> 21) & 0x1f;
5500
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5501
          #define PARAM0 cpu_state.reg[a]
5502
          b = (insn >> 16) & 0x1f;
5503
          #define PARAM1 cpu_state.reg[b]
5504
          c = (insn >> 11) & 0x1f;
5505
          #define PARAM2 cpu_state.reg[c]
5506
          {             /* "l_sra" */
5507
            orreg_t temp1;
5508
 
5509
            temp1 = (orreg_t)PARAM1 >> PARAM2;
5510
            SET_OV_FLAG_FN (temp1);
5511
            SET_PARAM0(temp1);
5512
            /* runtime.sim.cycles += 2; */
5513
          }
5514
          #undef SET_PARAM
5515
          #undef PARAM0
5516
          #undef PARAM1
5517
          #undef PARAM2
5518
 
5519
          if (do_stats) {
5520
            current->insn_index = 185;   /* "l.sra" */
5521
            analysis(current);
5522
          }
5523
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5524
        }
5525
        break;
5526
      case 0x3:
5527
        /* Instruction: l.ror */
5528
        {
5529
          uorreg_t a, b, c;
5530
          /* Number of operands: 3 */
5531
          a = (insn >> 21) & 0x1f;
5532
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5533
          #define PARAM0 cpu_state.reg[a]
5534
          b = (insn >> 16) & 0x1f;
5535
          #define PARAM1 cpu_state.reg[b]
5536
          c = (insn >> 11) & 0x1f;
5537
          #define PARAM2 cpu_state.reg[c]
5538
          l_invalid ();
5539
          #undef SET_PARAM
5540
          #undef PARAM0
5541
          #undef PARAM1
5542
          #undef PARAM2
5543
 
5544
          if (do_stats) {
5545
            current->insn_index = 186;   /* "l.ror" */
5546
            analysis(current);
5547
          }
5548
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5549
        }
5550
        break;
5551
      case 0x4:
5552
      case 0x5:
5553
      case 0x6:
5554
      case 0x7:
5555
      case 0x8:
5556
      case 0x9:
5557
      case 0xa:
5558
      case 0xb:
5559
      case 0xc:
5560
      case 0xd:
5561
      case 0xe:
5562
      case 0xf:
5563
        /* Invalid instruction(s) */
5564
        break;
5565
      }
5566
      break;
5567
    case 0x9:
5568
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5569
      if((insn & 0xfc00030f) == 0xe0000309) {
5570
        /* Instruction: l.div */
5571
        {
5572
          uorreg_t a, b, c;
5573
          /* Number of operands: 3 */
5574
          a = (insn >> 21) & 0x1f;
5575
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5576
          #define PARAM0 cpu_state.reg[a]
5577
          b = (insn >> 16) & 0x1f;
5578
          #define PARAM1 cpu_state.reg[b]
5579
          c = (insn >> 11) & 0x1f;
5580
          #define PARAM2 cpu_state.reg[c]
5581
          {             /* "l_div" */
5582
            orreg_t temp3, temp2, temp1;
5583
 
5584
            temp3 = PARAM2;
5585
            temp2 = PARAM1;
5586
            if (temp3)
5587
              temp1 = temp2 / temp3;
5588
            else {
5589
              except_handle(EXCEPT_ILLEGAL, cpu_state.pc);
5590
              return;
5591
            }
5592
            SET_OV_FLAG_FN (temp1);
5593
            SET_PARAM0(temp1);
5594
          }
5595
          #undef SET_PARAM
5596
          #undef PARAM0
5597
          #undef PARAM1
5598
          #undef PARAM2
5599
 
5600
          if (do_stats) {
5601
            current->insn_index = 187;   /* "l.div" */
5602
            analysis(current);
5603
          }
5604
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5605
        }
5606
      } else {
5607
        /* Invalid insn */
5608
        {
5609
          l_invalid ();
5610
 
5611
          if (do_stats) {
5612
            current->insn_index = -1;   /* "???" */
5613
            analysis(current);
5614
          }
5615
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5616
        }
5617
      }
5618
      break;
5619
    case 0xa:
5620
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5621
      if((insn & 0xfc00030f) == 0xe000030a) {
5622
        /* Instruction: l.divu */
5623
        {
5624
          uorreg_t a, b, c;
5625
          /* Number of operands: 3 */
5626
          a = (insn >> 21) & 0x1f;
5627
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5628
          #define PARAM0 cpu_state.reg[a]
5629
          b = (insn >> 16) & 0x1f;
5630
          #define PARAM1 cpu_state.reg[b]
5631
          c = (insn >> 11) & 0x1f;
5632
          #define PARAM2 cpu_state.reg[c]
5633
          {             /* "l_divu" */
5634
            uorreg_t temp3, temp2, temp1;
5635
 
5636
            temp3 = PARAM2;
5637
            temp2 = PARAM1;
5638
            if (temp3)
5639
              temp1 = temp2 / temp3;
5640
            else {
5641
              except_handle(EXCEPT_ILLEGAL, cpu_state.pc);
5642
              return;
5643
            }
5644
            SET_OV_FLAG_FN (temp1);
5645
            SET_PARAM0(temp1);
5646
            /* runtime.sim.cycles += 16; */
5647
          }
5648
          #undef SET_PARAM
5649
          #undef PARAM0
5650
          #undef PARAM1
5651
          #undef PARAM2
5652
 
5653
          if (do_stats) {
5654
            current->insn_index = 188;   /* "l.divu" */
5655
            analysis(current);
5656
          }
5657
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5658
        }
5659
      } else {
5660
        /* Invalid insn */
5661
        {
5662
          l_invalid ();
5663
 
5664
          if (do_stats) {
5665
            current->insn_index = -1;   /* "???" */
5666
            analysis(current);
5667
          }
5668
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5669
        }
5670
      }
5671
      break;
5672
    case 0xb:
5673
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5674
      if((insn & 0xfc00030f) == 0xe000030b) {
5675
        /* Instruction: l.mulu */
5676
        {
5677
          uorreg_t a, b, c;
5678
          /* Number of operands: 3 */
5679
          a = (insn >> 21) & 0x1f;
5680
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5681
          #define PARAM0 cpu_state.reg[a]
5682
          b = (insn >> 16) & 0x1f;
5683
          #define PARAM1 cpu_state.reg[b]
5684
          c = (insn >> 11) & 0x1f;
5685
          #define PARAM2 cpu_state.reg[c]
5686
          l_invalid ();
5687
          #undef SET_PARAM
5688
          #undef PARAM0
5689
          #undef PARAM1
5690
          #undef PARAM2
5691
 
5692
          if (do_stats) {
5693
            current->insn_index = 189;   /* "l.mulu" */
5694
            analysis(current);
5695
          }
5696
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5697
        }
5698
      } else {
5699
        /* Invalid insn */
5700
        {
5701
          l_invalid ();
5702
 
5703
          if (do_stats) {
5704
            current->insn_index = -1;   /* "???" */
5705
            analysis(current);
5706
          }
5707
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5708
        }
5709
      }
5710
      break;
5711
    case 0xc:
5712
      switch((insn >> 6) & 0xf) {
5713
      case 0x0:
5714
        /* Instruction: l.exths */
5715
        {
5716
          uorreg_t a, b;
5717
          /* Number of operands: 2 */
5718
          a = (insn >> 21) & 0x1f;
5719
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5720
          #define PARAM0 cpu_state.reg[a]
5721
          b = (insn >> 16) & 0x1f;
5722
          #define PARAM1 cpu_state.reg[b]
5723
          {             /* "l_exths" */
5724
            int16_t x;
5725
            x = PARAM1;
5726
            SET_PARAM0((orreg_t)x);
5727
          }
5728
          #undef SET_PARAM
5729
          #undef PARAM0
5730
          #undef PARAM1
5731
 
5732
          if (do_stats) {
5733
            current->insn_index = 191;   /* "l.exths" */
5734
            analysis(current);
5735
          }
5736
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5737
        }
5738
        break;
5739
      case 0x1:
5740
        /* Instruction: l.extbs */
5741
        {
5742
          uorreg_t a, b;
5743
          /* Number of operands: 2 */
5744
          a = (insn >> 21) & 0x1f;
5745
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5746
          #define PARAM0 cpu_state.reg[a]
5747
          b = (insn >> 16) & 0x1f;
5748
          #define PARAM1 cpu_state.reg[b]
5749
          {             /* "l_extbs" */
5750
            int8_t x;
5751
            x = PARAM1;
5752
            SET_PARAM0((orreg_t)x);
5753
          }
5754
          #undef SET_PARAM
5755
          #undef PARAM0
5756
          #undef PARAM1
5757
 
5758
          if (do_stats) {
5759
            current->insn_index = 190;   /* "l.extbs" */
5760
            analysis(current);
5761
          }
5762
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5763
        }
5764
        break;
5765
      case 0x2:
5766
        /* Instruction: l.exthz */
5767
        {
5768
          uorreg_t a, b;
5769
          /* Number of operands: 2 */
5770
          a = (insn >> 21) & 0x1f;
5771
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5772
          #define PARAM0 cpu_state.reg[a]
5773
          b = (insn >> 16) & 0x1f;
5774
          #define PARAM1 cpu_state.reg[b]
5775
          {             /* "l_exthz" */
5776
            uint16_t x;
5777
            x = PARAM1;
5778
            SET_PARAM0((uorreg_t)x);
5779
          }
5780
          #undef SET_PARAM
5781
          #undef PARAM0
5782
          #undef PARAM1
5783
 
5784
          if (do_stats) {
5785
            current->insn_index = 194;   /* "l.exthz" */
5786
            analysis(current);
5787
          }
5788
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5789
        }
5790
        break;
5791
      case 0x3:
5792
        /* Instruction: l.extbz */
5793
        {
5794
          uorreg_t a, b;
5795
          /* Number of operands: 2 */
5796
          a = (insn >> 21) & 0x1f;
5797
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5798
          #define PARAM0 cpu_state.reg[a]
5799
          b = (insn >> 16) & 0x1f;
5800
          #define PARAM1 cpu_state.reg[b]
5801
          {             /* "l_extbz" */
5802
            uint8_t x;
5803
            x = PARAM1;
5804
            SET_PARAM0((uorreg_t)x);
5805
          }
5806
          #undef SET_PARAM
5807
          #undef PARAM0
5808
          #undef PARAM1
5809
 
5810
          if (do_stats) {
5811
            current->insn_index = 193;   /* "l.extbz" */
5812
            analysis(current);
5813
          }
5814
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5815
        }
5816
        break;
5817
      case 0x4:
5818
      case 0x5:
5819
      case 0x6:
5820
      case 0x7:
5821
      case 0x8:
5822
      case 0x9:
5823
      case 0xa:
5824
      case 0xb:
5825
      case 0xc:
5826
      case 0xd:
5827
      case 0xe:
5828
      case 0xf:
5829
        /* Invalid instruction(s) */
5830
        break;
5831
      }
5832
      break;
5833
    case 0xd:
5834
      switch((insn >> 6) & 0xf) {
5835
      case 0x0:
5836
        /* Instruction: l.extws */
5837
        {
5838
          uorreg_t a, b;
5839
          /* Number of operands: 2 */
5840
          a = (insn >> 21) & 0x1f;
5841
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5842
          #define PARAM0 cpu_state.reg[a]
5843
          b = (insn >> 16) & 0x1f;
5844
          #define PARAM1 cpu_state.reg[b]
5845
          {             /* "l_extws" */
5846
            int32_t x;
5847
            x = PARAM1;
5848
            SET_PARAM0((orreg_t)x);
5849
          }
5850
          #undef SET_PARAM
5851
          #undef PARAM0
5852
          #undef PARAM1
5853
 
5854
          if (do_stats) {
5855
            current->insn_index = 192;   /* "l.extws" */
5856
            analysis(current);
5857
          }
5858
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5859
        }
5860
        break;
5861
      case 0x1:
5862
        /* Instruction: l.extwz */
5863
        {
5864
          uorreg_t a, b;
5865
          /* Number of operands: 2 */
5866
          a = (insn >> 21) & 0x1f;
5867
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5868
          #define PARAM0 cpu_state.reg[a]
5869
          b = (insn >> 16) & 0x1f;
5870
          #define PARAM1 cpu_state.reg[b]
5871
          {             /* "l_extwz" */
5872
            uint32_t x;
5873
            x = PARAM1;
5874
            SET_PARAM0((uorreg_t)x);
5875
          }
5876
          #undef SET_PARAM
5877
          #undef PARAM0
5878
          #undef PARAM1
5879
 
5880
          if (do_stats) {
5881
            current->insn_index = 195;   /* "l.extwz" */
5882
            analysis(current);
5883
          }
5884
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5885
        }
5886
        break;
5887
      case 0x2:
5888
      case 0x3:
5889
      case 0x4:
5890
      case 0x5:
5891
      case 0x6:
5892
      case 0x7:
5893
      case 0x8:
5894
      case 0x9:
5895
      case 0xa:
5896
      case 0xb:
5897
      case 0xc:
5898
      case 0xd:
5899
      case 0xe:
5900
      case 0xf:
5901
        /* Invalid instruction(s) */
5902
        break;
5903
      }
5904
      break;
5905
    case 0xe:
5906
      /* Not unique: real mask fc00030f and current mask fc00000f differ - do final check */
5907
      if((insn & 0xfc00030f) == 0xe000000e) {
5908
        /* Instruction: l.cmov */
5909
        {
5910
          uorreg_t a, b, c;
5911
          /* Number of operands: 3 */
5912
          a = (insn >> 21) & 0x1f;
5913
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5914
          #define PARAM0 cpu_state.reg[a]
5915
          b = (insn >> 16) & 0x1f;
5916
          #define PARAM1 cpu_state.reg[b]
5917
          c = (insn >> 11) & 0x1f;
5918
          #define PARAM2 cpu_state.reg[c]
5919
          {             /* "l_cmov" */
5920
            SET_PARAM0(cpu_state.sprs[SPR_SR] & SPR_SR_F ? PARAM1 : PARAM2);
5921
          }
5922
          #undef SET_PARAM
5923
          #undef PARAM0
5924
          #undef PARAM1
5925
          #undef PARAM2
5926
 
5927
          if (do_stats) {
5928
            current->insn_index = 196;   /* "l.cmov" */
5929
            analysis(current);
5930
          }
5931
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5932
        }
5933
      } else {
5934
        /* Invalid insn */
5935
        {
5936
          l_invalid ();
5937
 
5938
          if (do_stats) {
5939
            current->insn_index = -1;   /* "???" */
5940
            analysis(current);
5941
          }
5942
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5943
        }
5944
      }
5945
      break;
5946
    case 0xf:
5947
      switch((insn >> 8) & 0x3) {
5948
      case 0x0:
5949
        /* Instruction: l.ff1 */
5950
        {
5951
          uorreg_t a, b;
5952
          /* Number of operands: 2 */
5953
          a = (insn >> 21) & 0x1f;
5954
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5955
          #define PARAM0 cpu_state.reg[a]
5956
          b = (insn >> 16) & 0x1f;
5957
          #define PARAM1 cpu_state.reg[b]
5958
          {             /* "l_ff1" */
5959
            SET_PARAM0(ffs(PARAM1));
5960
          }
5961
          #undef SET_PARAM
5962
          #undef PARAM0
5963
          #undef PARAM1
5964
 
5965
          if (do_stats) {
5966
            current->insn_index = 197;   /* "l.ff1" */
5967
            analysis(current);
5968
          }
5969
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5970
        }
5971
        break;
5972
      case 0x1:
5973
        /* Instruction: l.fl1 */
5974
        {
5975
          uorreg_t a, b;
5976
          /* Number of operands: 2 */
5977
          a = (insn >> 21) & 0x1f;
5978
          #define SET_PARAM0(val) cpu_state.reg[a] = val
5979
          #define PARAM0 cpu_state.reg[a]
5980
          b = (insn >> 16) & 0x1f;
5981
          #define PARAM1 cpu_state.reg[b]
5982
          l_invalid ();
5983
          #undef SET_PARAM
5984
          #undef PARAM0
5985
          #undef PARAM1
5986
 
5987
          if (do_stats) {
5988
            current->insn_index = 198;   /* "l.fl1" */
5989
            analysis(current);
5990
          }
5991
          cpu_state.reg[0] = 0; /* Repair in case we changed it */
5992
        }
5993
        break;
5994
      case 0x2:
5995
      case 0x3:
5996
        /* Invalid instruction(s) */
5997
        break;
5998
      }
5999
      break;
6000
    }
6001
    break;
6002
  case 0x39:
6003
    switch((insn >> 21) & 0x1f) {
6004
    case 0x0:
6005
      /* Instruction: l.sfeq */
6006
      {
6007
        uorreg_t a, b;
6008
        /* Number of operands: 2 */
6009
        a = (insn >> 16) & 0x1f;
6010
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6011
        #define PARAM0 cpu_state.reg[a]
6012
        b = (insn >> 11) & 0x1f;
6013
        #define PARAM1 cpu_state.reg[b]
6014
        {           /* "l_sfeq" */
6015
          if(PARAM0 == PARAM1)
6016
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6017
          else
6018
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6019
        }
6020
        #undef SET_PARAM
6021
        #undef PARAM0
6022
        #undef PARAM1
6023
 
6024
        if (do_stats) {
6025
          current->insn_index = 199;   /* "l.sfeq" */
6026
          analysis(current);
6027
        }
6028
      }
6029
      break;
6030
    case 0x1:
6031
      /* Instruction: l.sfne */
6032
      {
6033
        uorreg_t a, b;
6034
        /* Number of operands: 2 */
6035
        a = (insn >> 16) & 0x1f;
6036
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6037
        #define PARAM0 cpu_state.reg[a]
6038
        b = (insn >> 11) & 0x1f;
6039
        #define PARAM1 cpu_state.reg[b]
6040
        {           /* "l_sfne" */
6041
          if(PARAM0 != PARAM1)
6042
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6043
          else
6044
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6045
        }
6046
        #undef SET_PARAM
6047
        #undef PARAM0
6048
        #undef PARAM1
6049
 
6050
        if (do_stats) {
6051
          current->insn_index = 200;   /* "l.sfne" */
6052
          analysis(current);
6053
        }
6054
      }
6055
      break;
6056
    case 0x2:
6057
      /* Instruction: l.sfgtu */
6058
      {
6059
        uorreg_t a, b;
6060
        /* Number of operands: 2 */
6061
        a = (insn >> 16) & 0x1f;
6062
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6063
        #define PARAM0 cpu_state.reg[a]
6064
        b = (insn >> 11) & 0x1f;
6065
        #define PARAM1 cpu_state.reg[b]
6066
        {           /* "l_sfgtu" */
6067
          if(PARAM0 > PARAM1)
6068
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6069
          else
6070
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6071
        }
6072
        #undef SET_PARAM
6073
        #undef PARAM0
6074
        #undef PARAM1
6075
 
6076
        if (do_stats) {
6077
          current->insn_index = 201;   /* "l.sfgtu" */
6078
          analysis(current);
6079
        }
6080
      }
6081
      break;
6082
    case 0x3:
6083
      /* Instruction: l.sfgeu */
6084
      {
6085
        uorreg_t a, b;
6086
        /* Number of operands: 2 */
6087
        a = (insn >> 16) & 0x1f;
6088
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6089
        #define PARAM0 cpu_state.reg[a]
6090
        b = (insn >> 11) & 0x1f;
6091
        #define PARAM1 cpu_state.reg[b]
6092
        {           /* "l_sfgeu" */
6093
          if(PARAM0 >= PARAM1)
6094
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6095
          else
6096
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6097
        }
6098
        #undef SET_PARAM
6099
        #undef PARAM0
6100
        #undef PARAM1
6101
 
6102
        if (do_stats) {
6103
          current->insn_index = 202;   /* "l.sfgeu" */
6104
          analysis(current);
6105
        }
6106
      }
6107
      break;
6108
    case 0x4:
6109
      /* Instruction: l.sfltu */
6110
      {
6111
        uorreg_t a, b;
6112
        /* Number of operands: 2 */
6113
        a = (insn >> 16) & 0x1f;
6114
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6115
        #define PARAM0 cpu_state.reg[a]
6116
        b = (insn >> 11) & 0x1f;
6117
        #define PARAM1 cpu_state.reg[b]
6118
        {           /* "l_sfltu" */
6119
          if(PARAM0 < PARAM1)
6120
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6121
          else
6122
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6123
        }
6124
        #undef SET_PARAM
6125
        #undef PARAM0
6126
        #undef PARAM1
6127
 
6128
        if (do_stats) {
6129
          current->insn_index = 203;   /* "l.sfltu" */
6130
          analysis(current);
6131
        }
6132
      }
6133
      break;
6134
    case 0x5:
6135
      /* Instruction: l.sfleu */
6136
      {
6137
        uorreg_t a, b;
6138
        /* Number of operands: 2 */
6139
        a = (insn >> 16) & 0x1f;
6140
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6141
        #define PARAM0 cpu_state.reg[a]
6142
        b = (insn >> 11) & 0x1f;
6143
        #define PARAM1 cpu_state.reg[b]
6144
        {           /* "l_sfleu" */
6145
          if(PARAM0 <= PARAM1)
6146
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6147
          else
6148
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6149
        }
6150
        #undef SET_PARAM
6151
        #undef PARAM0
6152
        #undef PARAM1
6153
 
6154
        if (do_stats) {
6155
          current->insn_index = 204;   /* "l.sfleu" */
6156
          analysis(current);
6157
        }
6158
      }
6159
      break;
6160
    case 0x6:
6161
    case 0x7:
6162
    case 0x8:
6163
    case 0x9:
6164
      /* Invalid instruction(s) */
6165
      break;
6166
    case 0xa:
6167
      /* Instruction: l.sfgts */
6168
      {
6169
        uorreg_t a, b;
6170
        /* Number of operands: 2 */
6171
        a = (insn >> 16) & 0x1f;
6172
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6173
        #define PARAM0 cpu_state.reg[a]
6174
        b = (insn >> 11) & 0x1f;
6175
        #define PARAM1 cpu_state.reg[b]
6176
        {           /* "l_sfgts" */
6177
          if((orreg_t)PARAM0 > (orreg_t)PARAM1)
6178
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6179
          else
6180
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6181
        }
6182
        #undef SET_PARAM
6183
        #undef PARAM0
6184
        #undef PARAM1
6185
 
6186
        if (do_stats) {
6187
          current->insn_index = 205;   /* "l.sfgts" */
6188
          analysis(current);
6189
        }
6190
      }
6191
      break;
6192
    case 0xb:
6193
      /* Instruction: l.sfges */
6194
      {
6195
        uorreg_t a, b;
6196
        /* Number of operands: 2 */
6197
        a = (insn >> 16) & 0x1f;
6198
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6199
        #define PARAM0 cpu_state.reg[a]
6200
        b = (insn >> 11) & 0x1f;
6201
        #define PARAM1 cpu_state.reg[b]
6202
        {           /* "l_sfges" */
6203
          if((orreg_t)PARAM0 >= (orreg_t)PARAM1)
6204
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6205
          else
6206
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6207
        }
6208
        #undef SET_PARAM
6209
        #undef PARAM0
6210
        #undef PARAM1
6211
 
6212
        if (do_stats) {
6213
          current->insn_index = 206;   /* "l.sfges" */
6214
          analysis(current);
6215
        }
6216
      }
6217
      break;
6218
    case 0xc:
6219
      /* Instruction: l.sflts */
6220
      {
6221
        uorreg_t a, b;
6222
        /* Number of operands: 2 */
6223
        a = (insn >> 16) & 0x1f;
6224
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6225
        #define PARAM0 cpu_state.reg[a]
6226
        b = (insn >> 11) & 0x1f;
6227
        #define PARAM1 cpu_state.reg[b]
6228
        {           /* "l_sflts" */
6229
          if((orreg_t)PARAM0 < (orreg_t)PARAM1)
6230
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6231
          else
6232
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6233
        }
6234
        #undef SET_PARAM
6235
        #undef PARAM0
6236
        #undef PARAM1
6237
 
6238
        if (do_stats) {
6239
          current->insn_index = 207;   /* "l.sflts" */
6240
          analysis(current);
6241
        }
6242
      }
6243
      break;
6244
    case 0xd:
6245
      /* Instruction: l.sfles */
6246
      {
6247
        uorreg_t a, b;
6248
        /* Number of operands: 2 */
6249
        a = (insn >> 16) & 0x1f;
6250
        #define SET_PARAM0(val) cpu_state.reg[a] = val
6251
        #define PARAM0 cpu_state.reg[a]
6252
        b = (insn >> 11) & 0x1f;
6253
        #define PARAM1 cpu_state.reg[b]
6254
        {           /* "l_sfles" */
6255
          if((orreg_t)PARAM0 <= (orreg_t)PARAM1)
6256
            cpu_state.sprs[SPR_SR] |= SPR_SR_F;
6257
          else
6258
            cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
6259
        }
6260
        #undef SET_PARAM
6261
        #undef PARAM0
6262
        #undef PARAM1
6263
 
6264
        if (do_stats) {
6265
          current->insn_index = 208;   /* "l.sfles" */
6266
          analysis(current);
6267
        }
6268
      }
6269
      break;
6270
    case 0xe:
6271
    case 0xf:
6272
    case 0x10:
6273
    case 0x11:
6274
    case 0x12:
6275
    case 0x13:
6276
    case 0x14:
6277
    case 0x15:
6278
    case 0x16:
6279
    case 0x17:
6280
    case 0x18:
6281
    case 0x19:
6282
    case 0x1a:
6283
    case 0x1b:
6284
    case 0x1c:
6285
    case 0x1d:
6286
    case 0x1e:
6287
    case 0x1f:
6288
      /* Invalid instruction(s) */
6289
      break;
6290
    }
6291
    break;
6292
  case 0x3a:
6293
  case 0x3b:
6294
    /* Invalid instruction(s) */
6295
    break;
6296
  case 0x3c:
6297
    /* Instruction: l.cust5 */
6298
    {
6299
      uorreg_t a, b, c, d, e;
6300
      /* Number of operands: 5 */
6301
      a = (insn >> 21) & 0x1f;
6302
      #define SET_PARAM0(val) cpu_state.reg[a] = val
6303
      #define PARAM0 cpu_state.reg[a]
6304
      b = (insn >> 16) & 0x1f;
6305
      #define PARAM1 cpu_state.reg[b]
6306
      c = (insn >> 11) & 0x1f;
6307
      #define PARAM2 cpu_state.reg[c]
6308
      d = (insn >> 5) & 0x3f;
6309
      #define PARAM3 d
6310
      e = (insn >> 0) & 0x1f;
6311
      #define PARAM4 e
6312
      l_invalid ();
6313
      #undef SET_PARAM
6314
      #undef PARAM0
6315
      #undef PARAM1
6316
      #undef PARAM2
6317
      #undef PARAM3
6318
      #undef PARAM4
6319
 
6320
      if (do_stats) {
6321
        current->insn_index = 209;   /* "l.cust5" */
6322
        analysis(current);
6323
      }
6324
      cpu_state.reg[0] = 0; /* Repair in case we changed it */
6325
    }
6326
    break;
6327
  case 0x3d:
6328
    /* Instruction: l.cust6 */
6329
    {
6330
      uorreg_t a;
6331
      /* Number of operands: 1 */
6332
      a = (insn >> 0) & 0x0;
6333
      #define SET_PARAM0(val) cpu_state.reg[a] = val
6334
      #define PARAM0 cpu_state.reg[a]
6335
      l_invalid ();
6336
      #undef SET_PARAM
6337
      #undef PARAM0
6338
 
6339
      if (do_stats) {
6340
        current->insn_index = 210;   /* "l.cust6" */
6341
        analysis(current);
6342
      }
6343
    }
6344
    break;
6345
  case 0x3e:
6346
    /* Instruction: l.cust7 */
6347
    {
6348
      uorreg_t a;
6349
      /* Number of operands: 1 */
6350
      a = (insn >> 0) & 0x0;
6351
      #define SET_PARAM0(val) cpu_state.reg[a] = val
6352
      #define PARAM0 cpu_state.reg[a]
6353
      l_invalid ();
6354
      #undef SET_PARAM
6355
      #undef PARAM0
6356
 
6357
      if (do_stats) {
6358
        current->insn_index = 211;   /* "l.cust7" */
6359
        analysis(current);
6360
      }
6361
    }
6362
    break;
6363
  case 0x3f:
6364
    /* Instruction: l.cust8 */
6365
    {
6366
      uorreg_t a;
6367
      /* Number of operands: 1 */
6368
      a = (insn >> 0) & 0x0;
6369
      #define SET_PARAM0(val) cpu_state.reg[a] = val
6370
      #define PARAM0 cpu_state.reg[a]
6371
      l_invalid ();
6372
      #undef SET_PARAM
6373
      #undef PARAM0
6374
 
6375
      if (do_stats) {
6376
        current->insn_index = 212;   /* "l.cust8" */
6377
        analysis(current);
6378
      }
6379
    }
6380
    break;
6381
  }
6382
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.