OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [sim/] [sh64/] [sem-media.c] - Blame information for rev 308

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Simulator instruction semantics for sh64.
2
 
3
THIS FILE IS MACHINE GENERATED WITH CGEN.
4
 
5
Copyright 1996-2005 Free Software Foundation, Inc.
6
 
7
This file is part of the GNU simulators.
8
 
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 3 of the License, or
12
(at your option) any later version.
13
 
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
GNU General Public License for more details.
18
 
19
You should have received a copy of the GNU General Public License
20
along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 
22
*/
23
 
24
#define WANT_CPU sh64
25
#define WANT_CPU_SH64
26
 
27
#include "sim-main.h"
28
#include "cgen-mem.h"
29
#include "cgen-ops.h"
30
 
31
#undef GET_ATTR
32
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
33
#define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34
#else
35
#define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_/**/attr)
36
#endif
37
 
38
/* This is used so that we can compile two copies of the semantic code,
39
   one with full feature support and one without that runs fast(er).
40
   FAST_P, when desired, is defined on the command line, -DFAST_P=1.  */
41
#if FAST_P
42
#define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
43
#undef TRACE_RESULT
44
#define TRACE_RESULT(cpu, abuf, name, type, val)
45
#else
46
#define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
47
#endif
48
 
49
/* x-invalid: --invalid-- */
50
 
51
static SEM_PC
52
SEM_FN_NAME (sh64_media,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
53
{
54
#define FLD(f) abuf->fields.fmt_empty.f
55
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
56
  int UNUSED written = 0;
57
  IADDR UNUSED pc = abuf->addr;
58
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
59
 
60
  {
61
    /* Update the recorded pc in the cpu state struct.
62
       Only necessary for WITH_SCACHE case, but to avoid the
63
       conditional compilation ....  */
64
    SET_H_PC (pc);
65
    /* Virtual insns have zero size.  Overwrite vpc with address of next insn
66
       using the default-insn-bitsize spec.  When executing insns in parallel
67
       we may want to queue the fault and continue execution.  */
68
    vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
69
    vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
70
  }
71
 
72
  return vpc;
73
#undef FLD
74
}
75
 
76
/* x-after: --after-- */
77
 
78
static SEM_PC
79
SEM_FN_NAME (sh64_media,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
80
{
81
#define FLD(f) abuf->fields.fmt_empty.f
82
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
83
  int UNUSED written = 0;
84
  IADDR UNUSED pc = abuf->addr;
85
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
86
 
87
  {
88
#if WITH_SCACHE_PBB_SH64_MEDIA
89
    sh64_media_pbb_after (current_cpu, sem_arg);
90
#endif
91
  }
92
 
93
  return vpc;
94
#undef FLD
95
}
96
 
97
/* x-before: --before-- */
98
 
99
static SEM_PC
100
SEM_FN_NAME (sh64_media,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
101
{
102
#define FLD(f) abuf->fields.fmt_empty.f
103
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
104
  int UNUSED written = 0;
105
  IADDR UNUSED pc = abuf->addr;
106
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
107
 
108
  {
109
#if WITH_SCACHE_PBB_SH64_MEDIA
110
    sh64_media_pbb_before (current_cpu, sem_arg);
111
#endif
112
  }
113
 
114
  return vpc;
115
#undef FLD
116
}
117
 
118
/* x-cti-chain: --cti-chain-- */
119
 
120
static SEM_PC
121
SEM_FN_NAME (sh64_media,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
122
{
123
#define FLD(f) abuf->fields.fmt_empty.f
124
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
125
  int UNUSED written = 0;
126
  IADDR UNUSED pc = abuf->addr;
127
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
128
 
129
  {
130
#if WITH_SCACHE_PBB_SH64_MEDIA
131
#ifdef DEFINE_SWITCH
132
    vpc = sh64_media_pbb_cti_chain (current_cpu, sem_arg,
133
                               pbb_br_type, pbb_br_npc);
134
    BREAK (sem);
135
#else
136
    /* FIXME: Allow provision of explicit ifmt spec in insn spec.  */
137
    vpc = sh64_media_pbb_cti_chain (current_cpu, sem_arg,
138
                               CPU_PBB_BR_TYPE (current_cpu),
139
                               CPU_PBB_BR_NPC (current_cpu));
140
#endif
141
#endif
142
  }
143
 
144
  return vpc;
145
#undef FLD
146
}
147
 
148
/* x-chain: --chain-- */
149
 
150
static SEM_PC
151
SEM_FN_NAME (sh64_media,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
152
{
153
#define FLD(f) abuf->fields.fmt_empty.f
154
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
155
  int UNUSED written = 0;
156
  IADDR UNUSED pc = abuf->addr;
157
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
158
 
159
  {
160
#if WITH_SCACHE_PBB_SH64_MEDIA
161
    vpc = sh64_media_pbb_chain (current_cpu, sem_arg);
162
#ifdef DEFINE_SWITCH
163
    BREAK (sem);
164
#endif
165
#endif
166
  }
167
 
168
  return vpc;
169
#undef FLD
170
}
171
 
172
/* x-begin: --begin-- */
173
 
174
static SEM_PC
175
SEM_FN_NAME (sh64_media,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
176
{
177
#define FLD(f) abuf->fields.fmt_empty.f
178
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
179
  int UNUSED written = 0;
180
  IADDR UNUSED pc = abuf->addr;
181
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
182
 
183
  {
184
#if WITH_SCACHE_PBB_SH64_MEDIA
185
#if defined DEFINE_SWITCH || defined FAST_P
186
    /* In the switch case FAST_P is a constant, allowing several optimizations
187
       in any called inline functions.  */
188
    vpc = sh64_media_pbb_begin (current_cpu, FAST_P);
189
#else
190
#if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
191
    vpc = sh64_media_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
192
#else
193
    vpc = sh64_media_pbb_begin (current_cpu, 0);
194
#endif
195
#endif
196
#endif
197
  }
198
 
199
  return vpc;
200
#undef FLD
201
}
202
 
203
/* add: add $rm, $rn, $rd */
204
 
205
static SEM_PC
206
SEM_FN_NAME (sh64_media,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
207
{
208
#define FLD(f) abuf->fields.sfmt_add.f
209
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
210
  int UNUSED written = 0;
211
  IADDR UNUSED pc = abuf->addr;
212
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
213
 
214
  {
215
    DI opval = ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
216
    SET_H_GR (FLD (f_dest), opval);
217
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
218
  }
219
 
220
  return vpc;
221
#undef FLD
222
}
223
 
224
/* addl: add.l $rm, $rn, $rd */
225
 
226
static SEM_PC
227
SEM_FN_NAME (sh64_media,addl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
228
{
229
#define FLD(f) abuf->fields.sfmt_add.f
230
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
231
  int UNUSED written = 0;
232
  IADDR UNUSED pc = abuf->addr;
233
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
234
 
235
  {
236
    DI opval = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
237
    SET_H_GR (FLD (f_dest), opval);
238
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
239
  }
240
 
241
  return vpc;
242
#undef FLD
243
}
244
 
245
/* addi: addi $rm, $disp10, $rd */
246
 
247
static SEM_PC
248
SEM_FN_NAME (sh64_media,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
249
{
250
#define FLD(f) abuf->fields.sfmt_addi.f
251
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
252
  int UNUSED written = 0;
253
  IADDR UNUSED pc = abuf->addr;
254
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
255
 
256
  {
257
    DI opval = ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)));
258
    SET_H_GR (FLD (f_dest), opval);
259
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
260
  }
261
 
262
  return vpc;
263
#undef FLD
264
}
265
 
266
/* addil: addi.l $rm, $disp10, $rd */
267
 
268
static SEM_PC
269
SEM_FN_NAME (sh64_media,addil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
270
{
271
#define FLD(f) abuf->fields.sfmt_addi.f
272
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
273
  int UNUSED written = 0;
274
  IADDR UNUSED pc = abuf->addr;
275
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
276
 
277
  {
278
    DI opval = EXTSIDI (ADDSI (EXTSISI (FLD (f_disp10)), SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)));
279
    SET_H_GR (FLD (f_dest), opval);
280
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
281
  }
282
 
283
  return vpc;
284
#undef FLD
285
}
286
 
287
/* addzl: addz.l $rm, $rn, $rd */
288
 
289
static SEM_PC
290
SEM_FN_NAME (sh64_media,addzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
291
{
292
#define FLD(f) abuf->fields.sfmt_add.f
293
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
294
  int UNUSED written = 0;
295
  IADDR UNUSED pc = abuf->addr;
296
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
297
 
298
  {
299
    DI opval = ZEXTSIDI (ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
300
    SET_H_GR (FLD (f_dest), opval);
301
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
302
  }
303
 
304
  return vpc;
305
#undef FLD
306
}
307
 
308
/* alloco: alloco $rm, $disp6x32 */
309
 
310
static SEM_PC
311
SEM_FN_NAME (sh64_media,alloco) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
312
{
313
#define FLD(f) abuf->fields.sfmt_xori.f
314
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
315
  int UNUSED written = 0;
316
  IADDR UNUSED pc = abuf->addr;
317
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
318
 
319
{
320
  {
321
    DI opval = GET_H_GR (FLD (f_left));
322
    SET_H_GR (FLD (f_left), opval);
323
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
324
  }
325
((void) 0); /*nop*/
326
}
327
 
328
  return vpc;
329
#undef FLD
330
}
331
 
332
/* and: and $rm, $rn, $rd */
333
 
334
static SEM_PC
335
SEM_FN_NAME (sh64_media,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
336
{
337
#define FLD(f) abuf->fields.sfmt_add.f
338
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
339
  int UNUSED written = 0;
340
  IADDR UNUSED pc = abuf->addr;
341
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
342
 
343
  {
344
    DI opval = ANDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
345
    SET_H_GR (FLD (f_dest), opval);
346
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
347
  }
348
 
349
  return vpc;
350
#undef FLD
351
}
352
 
353
/* andc: andc $rm, $rn, $rd */
354
 
355
static SEM_PC
356
SEM_FN_NAME (sh64_media,andc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
357
{
358
#define FLD(f) abuf->fields.sfmt_add.f
359
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
360
  int UNUSED written = 0;
361
  IADDR UNUSED pc = abuf->addr;
362
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
363
 
364
  {
365
    DI opval = ANDDI (GET_H_GR (FLD (f_left)), INVDI (GET_H_GR (FLD (f_right))));
366
    SET_H_GR (FLD (f_dest), opval);
367
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
368
  }
369
 
370
  return vpc;
371
#undef FLD
372
}
373
 
374
/* andi: andi $rm, $disp10, $rd */
375
 
376
static SEM_PC
377
SEM_FN_NAME (sh64_media,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
378
{
379
#define FLD(f) abuf->fields.sfmt_addi.f
380
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
381
  int UNUSED written = 0;
382
  IADDR UNUSED pc = abuf->addr;
383
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
384
 
385
  {
386
    DI opval = ANDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)));
387
    SET_H_GR (FLD (f_dest), opval);
388
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
389
  }
390
 
391
  return vpc;
392
#undef FLD
393
}
394
 
395
/* beq: beq$likely $rm, $rn, $tra */
396
 
397
static SEM_PC
398
SEM_FN_NAME (sh64_media,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
399
{
400
#define FLD(f) abuf->fields.sfmt_beq.f
401
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
402
  int UNUSED written = 0;
403
  IADDR UNUSED pc = abuf->addr;
404
  SEM_BRANCH_INIT
405
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
406
 
407
{
408
((void) 0); /*nop*/
409
if (EQDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
410
  {
411
    UDI opval = CPU (h_tr[FLD (f_tra)]);
412
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
413
    written |= (1 << 3);
414
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
415
  }
416
}
417
}
418
 
419
  abuf->written = written;
420
  SEM_BRANCH_FINI (vpc);
421
  return vpc;
422
#undef FLD
423
}
424
 
425
/* beqi: beqi$likely $rm, $imm6, $tra */
426
 
427
static SEM_PC
428
SEM_FN_NAME (sh64_media,beqi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
429
{
430
#define FLD(f) abuf->fields.sfmt_beqi.f
431
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
432
  int UNUSED written = 0;
433
  IADDR UNUSED pc = abuf->addr;
434
  SEM_BRANCH_INIT
435
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
436
 
437
{
438
((void) 0); /*nop*/
439
if (EQDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) {
440
  {
441
    UDI opval = CPU (h_tr[FLD (f_tra)]);
442
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
443
    written |= (1 << 3);
444
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
445
  }
446
}
447
}
448
 
449
  abuf->written = written;
450
  SEM_BRANCH_FINI (vpc);
451
  return vpc;
452
#undef FLD
453
}
454
 
455
/* bge: bge$likely $rm, $rn, $tra */
456
 
457
static SEM_PC
458
SEM_FN_NAME (sh64_media,bge) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
459
{
460
#define FLD(f) abuf->fields.sfmt_beq.f
461
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
462
  int UNUSED written = 0;
463
  IADDR UNUSED pc = abuf->addr;
464
  SEM_BRANCH_INIT
465
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
466
 
467
{
468
((void) 0); /*nop*/
469
if (GEDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
470
  {
471
    UDI opval = CPU (h_tr[FLD (f_tra)]);
472
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
473
    written |= (1 << 3);
474
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
475
  }
476
}
477
}
478
 
479
  abuf->written = written;
480
  SEM_BRANCH_FINI (vpc);
481
  return vpc;
482
#undef FLD
483
}
484
 
485
/* bgeu: bgeu$likely $rm, $rn, $tra */
486
 
487
static SEM_PC
488
SEM_FN_NAME (sh64_media,bgeu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
489
{
490
#define FLD(f) abuf->fields.sfmt_beq.f
491
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
492
  int UNUSED written = 0;
493
  IADDR UNUSED pc = abuf->addr;
494
  SEM_BRANCH_INIT
495
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
496
 
497
{
498
((void) 0); /*nop*/
499
if (GEUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
500
  {
501
    UDI opval = CPU (h_tr[FLD (f_tra)]);
502
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
503
    written |= (1 << 3);
504
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
505
  }
506
}
507
}
508
 
509
  abuf->written = written;
510
  SEM_BRANCH_FINI (vpc);
511
  return vpc;
512
#undef FLD
513
}
514
 
515
/* bgt: bgt$likely $rm, $rn, $tra */
516
 
517
static SEM_PC
518
SEM_FN_NAME (sh64_media,bgt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
519
{
520
#define FLD(f) abuf->fields.sfmt_beq.f
521
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
522
  int UNUSED written = 0;
523
  IADDR UNUSED pc = abuf->addr;
524
  SEM_BRANCH_INIT
525
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
526
 
527
{
528
((void) 0); /*nop*/
529
if (GTDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
530
  {
531
    UDI opval = CPU (h_tr[FLD (f_tra)]);
532
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
533
    written |= (1 << 3);
534
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
535
  }
536
}
537
}
538
 
539
  abuf->written = written;
540
  SEM_BRANCH_FINI (vpc);
541
  return vpc;
542
#undef FLD
543
}
544
 
545
/* bgtu: bgtu$likely $rm, $rn, $tra */
546
 
547
static SEM_PC
548
SEM_FN_NAME (sh64_media,bgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
549
{
550
#define FLD(f) abuf->fields.sfmt_beq.f
551
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
552
  int UNUSED written = 0;
553
  IADDR UNUSED pc = abuf->addr;
554
  SEM_BRANCH_INIT
555
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
556
 
557
{
558
((void) 0); /*nop*/
559
if (GTUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
560
  {
561
    UDI opval = CPU (h_tr[FLD (f_tra)]);
562
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
563
    written |= (1 << 3);
564
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
565
  }
566
}
567
}
568
 
569
  abuf->written = written;
570
  SEM_BRANCH_FINI (vpc);
571
  return vpc;
572
#undef FLD
573
}
574
 
575
/* blink: blink $trb, $rd */
576
 
577
static SEM_PC
578
SEM_FN_NAME (sh64_media,blink) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
579
{
580
#define FLD(f) abuf->fields.sfmt_blink.f
581
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
582
  int UNUSED written = 0;
583
  IADDR UNUSED pc = abuf->addr;
584
  SEM_BRANCH_INIT
585
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
586
 
587
{
588
  {
589
    DI opval = ORDI (ADDDI (pc, 4), 1);
590
    SET_H_GR (FLD (f_dest), opval);
591
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
592
  }
593
  {
594
    UDI opval = CPU (h_tr[FLD (f_trb)]);
595
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
596
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
597
  }
598
if (EQSI (FLD (f_dest), 63)) {
599
((void) 0); /*nop*/
600
} else {
601
((void) 0); /*nop*/
602
}
603
}
604
 
605
  SEM_BRANCH_FINI (vpc);
606
  return vpc;
607
#undef FLD
608
}
609
 
610
/* bne: bne$likely $rm, $rn, $tra */
611
 
612
static SEM_PC
613
SEM_FN_NAME (sh64_media,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
614
{
615
#define FLD(f) abuf->fields.sfmt_beq.f
616
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
617
  int UNUSED written = 0;
618
  IADDR UNUSED pc = abuf->addr;
619
  SEM_BRANCH_INIT
620
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
621
 
622
{
623
((void) 0); /*nop*/
624
if (NEDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
625
  {
626
    UDI opval = CPU (h_tr[FLD (f_tra)]);
627
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
628
    written |= (1 << 3);
629
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
630
  }
631
}
632
}
633
 
634
  abuf->written = written;
635
  SEM_BRANCH_FINI (vpc);
636
  return vpc;
637
#undef FLD
638
}
639
 
640
/* bnei: bnei$likely $rm, $imm6, $tra */
641
 
642
static SEM_PC
643
SEM_FN_NAME (sh64_media,bnei) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
644
{
645
#define FLD(f) abuf->fields.sfmt_beqi.f
646
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
647
  int UNUSED written = 0;
648
  IADDR UNUSED pc = abuf->addr;
649
  SEM_BRANCH_INIT
650
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
651
 
652
{
653
((void) 0); /*nop*/
654
if (NEDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) {
655
  {
656
    UDI opval = CPU (h_tr[FLD (f_tra)]);
657
    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
658
    written |= (1 << 3);
659
    TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
660
  }
661
}
662
}
663
 
664
  abuf->written = written;
665
  SEM_BRANCH_FINI (vpc);
666
  return vpc;
667
#undef FLD
668
}
669
 
670
/* brk: brk */
671
 
672
static SEM_PC
673
SEM_FN_NAME (sh64_media,brk) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
674
{
675
#define FLD(f) abuf->fields.fmt_empty.f
676
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
677
  int UNUSED written = 0;
678
  IADDR UNUSED pc = abuf->addr;
679
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
680
 
681
sh64_break (current_cpu, pc);
682
 
683
  return vpc;
684
#undef FLD
685
}
686
 
687
/* byterev: byterev $rm, $rd */
688
 
689
static SEM_PC
690
SEM_FN_NAME (sh64_media,byterev) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
691
{
692
#define FLD(f) abuf->fields.sfmt_xori.f
693
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
694
  int UNUSED written = 0;
695
  IADDR UNUSED pc = abuf->addr;
696
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
697
 
698
{
699
  DI tmp_source;
700
  DI tmp_result;
701
  tmp_source = GET_H_GR (FLD (f_left));
702
  tmp_result = 0;
703
{
704
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
705
  tmp_source = SRLDI (tmp_source, 8);
706
}
707
{
708
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
709
  tmp_source = SRLDI (tmp_source, 8);
710
}
711
{
712
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
713
  tmp_source = SRLDI (tmp_source, 8);
714
}
715
{
716
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
717
  tmp_source = SRLDI (tmp_source, 8);
718
}
719
{
720
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
721
  tmp_source = SRLDI (tmp_source, 8);
722
}
723
{
724
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
725
  tmp_source = SRLDI (tmp_source, 8);
726
}
727
{
728
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
729
  tmp_source = SRLDI (tmp_source, 8);
730
}
731
{
732
  tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
733
  tmp_source = SRLDI (tmp_source, 8);
734
}
735
  {
736
    DI opval = tmp_result;
737
    SET_H_GR (FLD (f_dest), opval);
738
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
739
  }
740
}
741
 
742
  return vpc;
743
#undef FLD
744
}
745
 
746
/* cmpeq: cmpeq $rm, $rn, $rd */
747
 
748
static SEM_PC
749
SEM_FN_NAME (sh64_media,cmpeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
750
{
751
#define FLD(f) abuf->fields.sfmt_add.f
752
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
753
  int UNUSED written = 0;
754
  IADDR UNUSED pc = abuf->addr;
755
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
756
 
757
  {
758
    DI opval = ((EQDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0));
759
    SET_H_GR (FLD (f_dest), opval);
760
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
761
  }
762
 
763
  return vpc;
764
#undef FLD
765
}
766
 
767
/* cmpgt: cmpgt $rm, $rn, $rd */
768
 
769
static SEM_PC
770
SEM_FN_NAME (sh64_media,cmpgt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
771
{
772
#define FLD(f) abuf->fields.sfmt_add.f
773
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
774
  int UNUSED written = 0;
775
  IADDR UNUSED pc = abuf->addr;
776
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
777
 
778
  {
779
    DI opval = ((GTDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0));
780
    SET_H_GR (FLD (f_dest), opval);
781
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
782
  }
783
 
784
  return vpc;
785
#undef FLD
786
}
787
 
788
/* cmpgtu: cmpgtu $rm,$rn, $rd */
789
 
790
static SEM_PC
791
SEM_FN_NAME (sh64_media,cmpgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
792
{
793
#define FLD(f) abuf->fields.sfmt_add.f
794
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
795
  int UNUSED written = 0;
796
  IADDR UNUSED pc = abuf->addr;
797
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
798
 
799
  {
800
    DI opval = ((GTUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0));
801
    SET_H_GR (FLD (f_dest), opval);
802
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
803
  }
804
 
805
  return vpc;
806
#undef FLD
807
}
808
 
809
/* cmveq: cmveq $rm, $rn, $rd */
810
 
811
static SEM_PC
812
SEM_FN_NAME (sh64_media,cmveq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
813
{
814
#define FLD(f) abuf->fields.sfmt_add.f
815
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
816
  int UNUSED written = 0;
817
  IADDR UNUSED pc = abuf->addr;
818
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
819
 
820
if (EQDI (GET_H_GR (FLD (f_left)), 0)) {
821
  {
822
    DI opval = GET_H_GR (FLD (f_right));
823
    SET_H_GR (FLD (f_dest), opval);
824
    written |= (1 << 2);
825
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
826
  }
827
}
828
 
829
  abuf->written = written;
830
  return vpc;
831
#undef FLD
832
}
833
 
834
/* cmvne: cmvne $rm, $rn, $rd */
835
 
836
static SEM_PC
837
SEM_FN_NAME (sh64_media,cmvne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
838
{
839
#define FLD(f) abuf->fields.sfmt_add.f
840
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
841
  int UNUSED written = 0;
842
  IADDR UNUSED pc = abuf->addr;
843
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
844
 
845
if (NEDI (GET_H_GR (FLD (f_left)), 0)) {
846
  {
847
    DI opval = GET_H_GR (FLD (f_right));
848
    SET_H_GR (FLD (f_dest), opval);
849
    written |= (1 << 2);
850
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
851
  }
852
}
853
 
854
  abuf->written = written;
855
  return vpc;
856
#undef FLD
857
}
858
 
859
/* fabsd: fabs.d $drgh, $drf */
860
 
861
static SEM_PC
862
SEM_FN_NAME (sh64_media,fabsd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
863
{
864
#define FLD(f) abuf->fields.sfmt_fabsd.f
865
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
866
  int UNUSED written = 0;
867
  IADDR UNUSED pc = abuf->addr;
868
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
869
 
870
  {
871
    DF opval = sh64_fabsd (current_cpu, GET_H_DR (FLD (f_left_right)));
872
    SET_H_DR (FLD (f_dest), opval);
873
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
874
  }
875
 
876
  return vpc;
877
#undef FLD
878
}
879
 
880
/* fabss: fabs.s $frgh, $frf */
881
 
882
static SEM_PC
883
SEM_FN_NAME (sh64_media,fabss) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
884
{
885
#define FLD(f) abuf->fields.sfmt_fabsd.f
886
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
887
  int UNUSED written = 0;
888
  IADDR UNUSED pc = abuf->addr;
889
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
890
 
891
  {
892
    SF opval = sh64_fabss (current_cpu, CPU (h_fr[FLD (f_left_right)]));
893
    CPU (h_fr[FLD (f_dest)]) = opval;
894
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
895
  }
896
 
897
  return vpc;
898
#undef FLD
899
}
900
 
901
/* faddd: fadd.d $drg, $drh, $drf */
902
 
903
static SEM_PC
904
SEM_FN_NAME (sh64_media,faddd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
905
{
906
#define FLD(f) abuf->fields.sfmt_add.f
907
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
908
  int UNUSED written = 0;
909
  IADDR UNUSED pc = abuf->addr;
910
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
911
 
912
  {
913
    DF opval = sh64_faddd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
914
    SET_H_DR (FLD (f_dest), opval);
915
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
916
  }
917
 
918
  return vpc;
919
#undef FLD
920
}
921
 
922
/* fadds: fadd.s $frg, $frh, $frf */
923
 
924
static SEM_PC
925
SEM_FN_NAME (sh64_media,fadds) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
926
{
927
#define FLD(f) abuf->fields.sfmt_add.f
928
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
929
  int UNUSED written = 0;
930
  IADDR UNUSED pc = abuf->addr;
931
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
932
 
933
  {
934
    SF opval = sh64_fadds (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
935
    CPU (h_fr[FLD (f_dest)]) = opval;
936
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
937
  }
938
 
939
  return vpc;
940
#undef FLD
941
}
942
 
943
/* fcmpeqd: fcmpeq.d $drg, $drh, $rd */
944
 
945
static SEM_PC
946
SEM_FN_NAME (sh64_media,fcmpeqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
947
{
948
#define FLD(f) abuf->fields.sfmt_add.f
949
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
950
  int UNUSED written = 0;
951
  IADDR UNUSED pc = abuf->addr;
952
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
953
 
954
  {
955
    DI opval = ZEXTBIDI (sh64_fcmpeqd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
956
    SET_H_GR (FLD (f_dest), opval);
957
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
958
  }
959
 
960
  return vpc;
961
#undef FLD
962
}
963
 
964
/* fcmpeqs: fcmpeq.s $frg, $frh, $rd */
965
 
966
static SEM_PC
967
SEM_FN_NAME (sh64_media,fcmpeqs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
968
{
969
#define FLD(f) abuf->fields.sfmt_add.f
970
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
971
  int UNUSED written = 0;
972
  IADDR UNUSED pc = abuf->addr;
973
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
974
 
975
  {
976
    DI opval = ZEXTBIDI (sh64_fcmpeqs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
977
    SET_H_GR (FLD (f_dest), opval);
978
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
979
  }
980
 
981
  return vpc;
982
#undef FLD
983
}
984
 
985
/* fcmpged: fcmpge.d $drg, $drh, $rd */
986
 
987
static SEM_PC
988
SEM_FN_NAME (sh64_media,fcmpged) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
989
{
990
#define FLD(f) abuf->fields.sfmt_add.f
991
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
992
  int UNUSED written = 0;
993
  IADDR UNUSED pc = abuf->addr;
994
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
995
 
996
  {
997
    DI opval = ZEXTBIDI (sh64_fcmpged (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
998
    SET_H_GR (FLD (f_dest), opval);
999
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1000
  }
1001
 
1002
  return vpc;
1003
#undef FLD
1004
}
1005
 
1006
/* fcmpges: fcmpge.s $frg, $frh, $rd */
1007
 
1008
static SEM_PC
1009
SEM_FN_NAME (sh64_media,fcmpges) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1010
{
1011
#define FLD(f) abuf->fields.sfmt_add.f
1012
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1013
  int UNUSED written = 0;
1014
  IADDR UNUSED pc = abuf->addr;
1015
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1016
 
1017
  {
1018
    DI opval = ZEXTBIDI (sh64_fcmpges (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1019
    SET_H_GR (FLD (f_dest), opval);
1020
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1021
  }
1022
 
1023
  return vpc;
1024
#undef FLD
1025
}
1026
 
1027
/* fcmpgtd: fcmpgt.d $drg, $drh, $rd */
1028
 
1029
static SEM_PC
1030
SEM_FN_NAME (sh64_media,fcmpgtd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1031
{
1032
#define FLD(f) abuf->fields.sfmt_add.f
1033
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1034
  int UNUSED written = 0;
1035
  IADDR UNUSED pc = abuf->addr;
1036
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1037
 
1038
  {
1039
    DI opval = ZEXTBIDI (sh64_fcmpgtd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
1040
    SET_H_GR (FLD (f_dest), opval);
1041
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1042
  }
1043
 
1044
  return vpc;
1045
#undef FLD
1046
}
1047
 
1048
/* fcmpgts: fcmpgt.s $frg, $frh, $rd */
1049
 
1050
static SEM_PC
1051
SEM_FN_NAME (sh64_media,fcmpgts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1052
{
1053
#define FLD(f) abuf->fields.sfmt_add.f
1054
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1055
  int UNUSED written = 0;
1056
  IADDR UNUSED pc = abuf->addr;
1057
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1058
 
1059
  {
1060
    DI opval = ZEXTBIDI (sh64_fcmpgts (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1061
    SET_H_GR (FLD (f_dest), opval);
1062
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1063
  }
1064
 
1065
  return vpc;
1066
#undef FLD
1067
}
1068
 
1069
/* fcmpund: fcmpun.d $drg, $drh, $rd */
1070
 
1071
static SEM_PC
1072
SEM_FN_NAME (sh64_media,fcmpund) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1073
{
1074
#define FLD(f) abuf->fields.sfmt_add.f
1075
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1076
  int UNUSED written = 0;
1077
  IADDR UNUSED pc = abuf->addr;
1078
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1079
 
1080
  {
1081
    DI opval = ZEXTBIDI (sh64_fcmpund (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
1082
    SET_H_GR (FLD (f_dest), opval);
1083
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1084
  }
1085
 
1086
  return vpc;
1087
#undef FLD
1088
}
1089
 
1090
/* fcmpuns: fcmpun.s $frg, $frh, $rd */
1091
 
1092
static SEM_PC
1093
SEM_FN_NAME (sh64_media,fcmpuns) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1094
{
1095
#define FLD(f) abuf->fields.sfmt_add.f
1096
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1097
  int UNUSED written = 0;
1098
  IADDR UNUSED pc = abuf->addr;
1099
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1100
 
1101
  {
1102
    DI opval = ZEXTBIDI (sh64_fcmpuns (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1103
    SET_H_GR (FLD (f_dest), opval);
1104
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1105
  }
1106
 
1107
  return vpc;
1108
#undef FLD
1109
}
1110
 
1111
/* fcnvds: fcnv.ds $drgh, $frf */
1112
 
1113
static SEM_PC
1114
SEM_FN_NAME (sh64_media,fcnvds) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1115
{
1116
#define FLD(f) abuf->fields.sfmt_fabsd.f
1117
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1118
  int UNUSED written = 0;
1119
  IADDR UNUSED pc = abuf->addr;
1120
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1121
 
1122
  {
1123
    SF opval = sh64_fcnvds (current_cpu, GET_H_DR (FLD (f_left_right)));
1124
    CPU (h_fr[FLD (f_dest)]) = opval;
1125
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1126
  }
1127
 
1128
  return vpc;
1129
#undef FLD
1130
}
1131
 
1132
/* fcnvsd: fcnv.sd $frgh, $drf */
1133
 
1134
static SEM_PC
1135
SEM_FN_NAME (sh64_media,fcnvsd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1136
{
1137
#define FLD(f) abuf->fields.sfmt_fabsd.f
1138
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1139
  int UNUSED written = 0;
1140
  IADDR UNUSED pc = abuf->addr;
1141
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1142
 
1143
  {
1144
    DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1145
    SET_H_DR (FLD (f_dest), opval);
1146
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1147
  }
1148
 
1149
  return vpc;
1150
#undef FLD
1151
}
1152
 
1153
/* fdivd: fdiv.d $drg, $drh, $drf */
1154
 
1155
static SEM_PC
1156
SEM_FN_NAME (sh64_media,fdivd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1157
{
1158
#define FLD(f) abuf->fields.sfmt_add.f
1159
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1160
  int UNUSED written = 0;
1161
  IADDR UNUSED pc = abuf->addr;
1162
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1163
 
1164
  {
1165
    DF opval = sh64_fdivd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
1166
    SET_H_DR (FLD (f_dest), opval);
1167
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1168
  }
1169
 
1170
  return vpc;
1171
#undef FLD
1172
}
1173
 
1174
/* fdivs: fdiv.s $frg, $frh, $frf */
1175
 
1176
static SEM_PC
1177
SEM_FN_NAME (sh64_media,fdivs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1178
{
1179
#define FLD(f) abuf->fields.sfmt_add.f
1180
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1181
  int UNUSED written = 0;
1182
  IADDR UNUSED pc = abuf->addr;
1183
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1184
 
1185
  {
1186
    SF opval = sh64_fdivs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
1187
    CPU (h_fr[FLD (f_dest)]) = opval;
1188
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1189
  }
1190
 
1191
  return vpc;
1192
#undef FLD
1193
}
1194
 
1195
/* fgetscr: fgetscr $frf */
1196
 
1197
static SEM_PC
1198
SEM_FN_NAME (sh64_media,fgetscr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1199
{
1200
#define FLD(f) abuf->fields.sfmt_shori.f
1201
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1202
  int UNUSED written = 0;
1203
  IADDR UNUSED pc = abuf->addr;
1204
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1205
 
1206
  {
1207
    SF opval = SUBWORDSISF (CPU (h_fpscr));
1208
    CPU (h_fr[FLD (f_dest)]) = opval;
1209
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1210
  }
1211
 
1212
  return vpc;
1213
#undef FLD
1214
}
1215
 
1216
/* fiprs: fipr.s $fvg, $fvh, $frf */
1217
 
1218
static SEM_PC
1219
SEM_FN_NAME (sh64_media,fiprs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1220
{
1221
#define FLD(f) abuf->fields.sfmt_add.f
1222
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1223
  int UNUSED written = 0;
1224
  IADDR UNUSED pc = abuf->addr;
1225
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1226
 
1227
{
1228
  {
1229
    SF opval = GET_H_FV (FLD (f_left));
1230
    SET_H_FV (FLD (f_left), opval);
1231
    TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
1232
  }
1233
  {
1234
    SF opval = GET_H_FV (FLD (f_right));
1235
    SET_H_FV (FLD (f_right), opval);
1236
    TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
1237
  }
1238
  {
1239
    SF opval = sh64_fiprs (current_cpu, FLD (f_left), FLD (f_right));
1240
    CPU (h_fr[FLD (f_dest)]) = opval;
1241
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1242
  }
1243
}
1244
 
1245
  return vpc;
1246
#undef FLD
1247
}
1248
 
1249
/* fldd: fld.d $rm, $disp10x8, $drf */
1250
 
1251
static SEM_PC
1252
SEM_FN_NAME (sh64_media,fldd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1253
{
1254
#define FLD(f) abuf->fields.sfmt_fldd.f
1255
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1256
  int UNUSED written = 0;
1257
  IADDR UNUSED pc = abuf->addr;
1258
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1259
 
1260
  {
1261
    DF opval = GETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x8)));
1262
    SET_H_DR (FLD (f_dest), opval);
1263
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1264
  }
1265
 
1266
  return vpc;
1267
#undef FLD
1268
}
1269
 
1270
/* fldp: fld.p $rm, $disp10x8, $fpf */
1271
 
1272
static SEM_PC
1273
SEM_FN_NAME (sh64_media,fldp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1274
{
1275
#define FLD(f) abuf->fields.sfmt_fldd.f
1276
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1277
  int UNUSED written = 0;
1278
  IADDR UNUSED pc = abuf->addr;
1279
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1280
 
1281
{
1282
  {
1283
    SF opval = GET_H_FP (FLD (f_dest));
1284
    SET_H_FP (FLD (f_dest), opval);
1285
    TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1286
  }
1287
sh64_fldp (current_cpu, pc, GET_H_GR (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest));
1288
}
1289
 
1290
  return vpc;
1291
#undef FLD
1292
}
1293
 
1294
/* flds: fld.s $rm, $disp10x4, $frf */
1295
 
1296
static SEM_PC
1297
SEM_FN_NAME (sh64_media,flds) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1298
{
1299
#define FLD(f) abuf->fields.sfmt_flds.f
1300
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1301
  int UNUSED written = 0;
1302
  IADDR UNUSED pc = abuf->addr;
1303
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1304
 
1305
  {
1306
    SF opval = GETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x4)));
1307
    CPU (h_fr[FLD (f_dest)]) = opval;
1308
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1309
  }
1310
 
1311
  return vpc;
1312
#undef FLD
1313
}
1314
 
1315
/* fldxd: fldx.d $rm, $rn, $drf */
1316
 
1317
static SEM_PC
1318
SEM_FN_NAME (sh64_media,fldxd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1319
{
1320
#define FLD(f) abuf->fields.sfmt_add.f
1321
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1322
  int UNUSED written = 0;
1323
  IADDR UNUSED pc = abuf->addr;
1324
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1325
 
1326
  {
1327
    DF opval = GETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))));
1328
    SET_H_DR (FLD (f_dest), opval);
1329
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1330
  }
1331
 
1332
  return vpc;
1333
#undef FLD
1334
}
1335
 
1336
/* fldxp: fldx.p $rm, $rn, $fpf */
1337
 
1338
static SEM_PC
1339
SEM_FN_NAME (sh64_media,fldxp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1340
{
1341
#define FLD(f) abuf->fields.sfmt_add.f
1342
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1343
  int UNUSED written = 0;
1344
  IADDR UNUSED pc = abuf->addr;
1345
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1346
 
1347
{
1348
  {
1349
    SF opval = GET_H_FP (FLD (f_dest));
1350
    SET_H_FP (FLD (f_dest), opval);
1351
    TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1352
  }
1353
sh64_fldp (current_cpu, pc, GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)), FLD (f_dest));
1354
}
1355
 
1356
  return vpc;
1357
#undef FLD
1358
}
1359
 
1360
/* fldxs: fldx.s $rm, $rn, $frf */
1361
 
1362
static SEM_PC
1363
SEM_FN_NAME (sh64_media,fldxs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1364
{
1365
#define FLD(f) abuf->fields.sfmt_add.f
1366
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1367
  int UNUSED written = 0;
1368
  IADDR UNUSED pc = abuf->addr;
1369
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1370
 
1371
  {
1372
    SF opval = GETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))));
1373
    CPU (h_fr[FLD (f_dest)]) = opval;
1374
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1375
  }
1376
 
1377
  return vpc;
1378
#undef FLD
1379
}
1380
 
1381
/* floatld: float.ld $frgh, $drf */
1382
 
1383
static SEM_PC
1384
SEM_FN_NAME (sh64_media,floatld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1385
{
1386
#define FLD(f) abuf->fields.sfmt_fabsd.f
1387
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1388
  int UNUSED written = 0;
1389
  IADDR UNUSED pc = abuf->addr;
1390
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1391
 
1392
  {
1393
    DF opval = sh64_floatld (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1394
    SET_H_DR (FLD (f_dest), opval);
1395
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1396
  }
1397
 
1398
  return vpc;
1399
#undef FLD
1400
}
1401
 
1402
/* floatls: float.ls $frgh, $frf */
1403
 
1404
static SEM_PC
1405
SEM_FN_NAME (sh64_media,floatls) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1406
{
1407
#define FLD(f) abuf->fields.sfmt_fabsd.f
1408
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1409
  int UNUSED written = 0;
1410
  IADDR UNUSED pc = abuf->addr;
1411
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1412
 
1413
  {
1414
    SF opval = sh64_floatls (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1415
    CPU (h_fr[FLD (f_dest)]) = opval;
1416
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1417
  }
1418
 
1419
  return vpc;
1420
#undef FLD
1421
}
1422
 
1423
/* floatqd: float.qd $drgh, $drf */
1424
 
1425
static SEM_PC
1426
SEM_FN_NAME (sh64_media,floatqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1427
{
1428
#define FLD(f) abuf->fields.sfmt_fabsd.f
1429
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1430
  int UNUSED written = 0;
1431
  IADDR UNUSED pc = abuf->addr;
1432
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1433
 
1434
  {
1435
    DF opval = sh64_floatqd (current_cpu, GET_H_DR (FLD (f_left_right)));
1436
    SET_H_DR (FLD (f_dest), opval);
1437
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1438
  }
1439
 
1440
  return vpc;
1441
#undef FLD
1442
}
1443
 
1444
/* floatqs: float.qs $drgh, $frf */
1445
 
1446
static SEM_PC
1447
SEM_FN_NAME (sh64_media,floatqs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1448
{
1449
#define FLD(f) abuf->fields.sfmt_fabsd.f
1450
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1451
  int UNUSED written = 0;
1452
  IADDR UNUSED pc = abuf->addr;
1453
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1454
 
1455
  {
1456
    SF opval = sh64_floatqs (current_cpu, GET_H_DR (FLD (f_left_right)));
1457
    CPU (h_fr[FLD (f_dest)]) = opval;
1458
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1459
  }
1460
 
1461
  return vpc;
1462
#undef FLD
1463
}
1464
 
1465
/* fmacs: fmac.s $frg, $frh, $frf */
1466
 
1467
static SEM_PC
1468
SEM_FN_NAME (sh64_media,fmacs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1469
{
1470
#define FLD(f) abuf->fields.sfmt_add.f
1471
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1472
  int UNUSED written = 0;
1473
  IADDR UNUSED pc = abuf->addr;
1474
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1475
 
1476
  {
1477
    SF opval = sh64_fadds (current_cpu, CPU (h_fr[FLD (f_dest)]), sh64_fmuls (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1478
    CPU (h_fr[FLD (f_dest)]) = opval;
1479
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1480
  }
1481
 
1482
  return vpc;
1483
#undef FLD
1484
}
1485
 
1486
/* fmovd: fmov.d $drgh, $drf */
1487
 
1488
static SEM_PC
1489
SEM_FN_NAME (sh64_media,fmovd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1490
{
1491
#define FLD(f) abuf->fields.sfmt_fabsd.f
1492
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1493
  int UNUSED written = 0;
1494
  IADDR UNUSED pc = abuf->addr;
1495
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1496
 
1497
  {
1498
    DF opval = GET_H_DR (FLD (f_left_right));
1499
    SET_H_DR (FLD (f_dest), opval);
1500
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1501
  }
1502
 
1503
  return vpc;
1504
#undef FLD
1505
}
1506
 
1507
/* fmovdq: fmov.dq $drgh, $rd */
1508
 
1509
static SEM_PC
1510
SEM_FN_NAME (sh64_media,fmovdq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1511
{
1512
#define FLD(f) abuf->fields.sfmt_fabsd.f
1513
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1514
  int UNUSED written = 0;
1515
  IADDR UNUSED pc = abuf->addr;
1516
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1517
 
1518
  {
1519
    DI opval = SUBWORDDFDI (GET_H_DR (FLD (f_left_right)));
1520
    SET_H_GR (FLD (f_dest), opval);
1521
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1522
  }
1523
 
1524
  return vpc;
1525
#undef FLD
1526
}
1527
 
1528
/* fmovls: fmov.ls $rm, $frf */
1529
 
1530
static SEM_PC
1531
SEM_FN_NAME (sh64_media,fmovls) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1532
{
1533
#define FLD(f) abuf->fields.sfmt_xori.f
1534
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1535
  int UNUSED written = 0;
1536
  IADDR UNUSED pc = abuf->addr;
1537
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1538
 
1539
  {
1540
    SF opval = SUBWORDSISF (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1));
1541
    CPU (h_fr[FLD (f_dest)]) = opval;
1542
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1543
  }
1544
 
1545
  return vpc;
1546
#undef FLD
1547
}
1548
 
1549
/* fmovqd: fmov.qd $rm, $drf */
1550
 
1551
static SEM_PC
1552
SEM_FN_NAME (sh64_media,fmovqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1553
{
1554
#define FLD(f) abuf->fields.sfmt_xori.f
1555
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1556
  int UNUSED written = 0;
1557
  IADDR UNUSED pc = abuf->addr;
1558
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1559
 
1560
  {
1561
    DF opval = SUBWORDDIDF (GET_H_GR (FLD (f_left)));
1562
    SET_H_DR (FLD (f_dest), opval);
1563
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1564
  }
1565
 
1566
  return vpc;
1567
#undef FLD
1568
}
1569
 
1570
/* fmovs: fmov.s $frgh, $frf */
1571
 
1572
static SEM_PC
1573
SEM_FN_NAME (sh64_media,fmovs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1574
{
1575
#define FLD(f) abuf->fields.sfmt_fabsd.f
1576
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1577
  int UNUSED written = 0;
1578
  IADDR UNUSED pc = abuf->addr;
1579
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1580
 
1581
  {
1582
    SF opval = CPU (h_fr[FLD (f_left_right)]);
1583
    CPU (h_fr[FLD (f_dest)]) = opval;
1584
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1585
  }
1586
 
1587
  return vpc;
1588
#undef FLD
1589
}
1590
 
1591
/* fmovsl: fmov.sl $frgh, $rd */
1592
 
1593
static SEM_PC
1594
SEM_FN_NAME (sh64_media,fmovsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1595
{
1596
#define FLD(f) abuf->fields.sfmt_fabsd.f
1597
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1598
  int UNUSED written = 0;
1599
  IADDR UNUSED pc = abuf->addr;
1600
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1601
 
1602
  {
1603
    DI opval = EXTSIDI (SUBWORDSFSI (CPU (h_fr[FLD (f_left_right)])));
1604
    SET_H_GR (FLD (f_dest), opval);
1605
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1606
  }
1607
 
1608
  return vpc;
1609
#undef FLD
1610
}
1611
 
1612
/* fmuld: fmul.d $drg, $drh, $drf */
1613
 
1614
static SEM_PC
1615
SEM_FN_NAME (sh64_media,fmuld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1616
{
1617
#define FLD(f) abuf->fields.sfmt_add.f
1618
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1619
  int UNUSED written = 0;
1620
  IADDR UNUSED pc = abuf->addr;
1621
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1622
 
1623
  {
1624
    DF opval = sh64_fmuld (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
1625
    SET_H_DR (FLD (f_dest), opval);
1626
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1627
  }
1628
 
1629
  return vpc;
1630
#undef FLD
1631
}
1632
 
1633
/* fmuls: fmul.s $frg, $frh, $frf */
1634
 
1635
static SEM_PC
1636
SEM_FN_NAME (sh64_media,fmuls) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1637
{
1638
#define FLD(f) abuf->fields.sfmt_add.f
1639
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1640
  int UNUSED written = 0;
1641
  IADDR UNUSED pc = abuf->addr;
1642
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1643
 
1644
  {
1645
    SF opval = sh64_fmuls (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
1646
    CPU (h_fr[FLD (f_dest)]) = opval;
1647
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1648
  }
1649
 
1650
  return vpc;
1651
#undef FLD
1652
}
1653
 
1654
/* fnegd: fneg.d $drgh, $drf */
1655
 
1656
static SEM_PC
1657
SEM_FN_NAME (sh64_media,fnegd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1658
{
1659
#define FLD(f) abuf->fields.sfmt_fabsd.f
1660
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1661
  int UNUSED written = 0;
1662
  IADDR UNUSED pc = abuf->addr;
1663
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1664
 
1665
  {
1666
    DF opval = sh64_fnegd (current_cpu, GET_H_DR (FLD (f_left_right)));
1667
    SET_H_DR (FLD (f_dest), opval);
1668
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1669
  }
1670
 
1671
  return vpc;
1672
#undef FLD
1673
}
1674
 
1675
/* fnegs: fneg.s $frgh, $frf */
1676
 
1677
static SEM_PC
1678
SEM_FN_NAME (sh64_media,fnegs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1679
{
1680
#define FLD(f) abuf->fields.sfmt_fabsd.f
1681
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1682
  int UNUSED written = 0;
1683
  IADDR UNUSED pc = abuf->addr;
1684
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1685
 
1686
  {
1687
    SF opval = sh64_fnegs (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1688
    CPU (h_fr[FLD (f_dest)]) = opval;
1689
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1690
  }
1691
 
1692
  return vpc;
1693
#undef FLD
1694
}
1695
 
1696
/* fputscr: fputscr $frgh */
1697
 
1698
static SEM_PC
1699
SEM_FN_NAME (sh64_media,fputscr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1700
{
1701
#define FLD(f) abuf->fields.sfmt_fabsd.f
1702
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1703
  int UNUSED written = 0;
1704
  IADDR UNUSED pc = abuf->addr;
1705
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1706
 
1707
  {
1708
    SI opval = SUBWORDSFSI (CPU (h_fr[FLD (f_left_right)]));
1709
    CPU (h_fpscr) = opval;
1710
    TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
1711
  }
1712
 
1713
  return vpc;
1714
#undef FLD
1715
}
1716
 
1717
/* fsqrtd: fsqrt.d $drgh, $drf */
1718
 
1719
static SEM_PC
1720
SEM_FN_NAME (sh64_media,fsqrtd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1721
{
1722
#define FLD(f) abuf->fields.sfmt_fabsd.f
1723
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1724
  int UNUSED written = 0;
1725
  IADDR UNUSED pc = abuf->addr;
1726
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1727
 
1728
  {
1729
    DF opval = sh64_fsqrtd (current_cpu, GET_H_DR (FLD (f_left_right)));
1730
    SET_H_DR (FLD (f_dest), opval);
1731
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1732
  }
1733
 
1734
  return vpc;
1735
#undef FLD
1736
}
1737
 
1738
/* fsqrts: fsqrt.s $frgh, $frf */
1739
 
1740
static SEM_PC
1741
SEM_FN_NAME (sh64_media,fsqrts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1742
{
1743
#define FLD(f) abuf->fields.sfmt_fabsd.f
1744
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1745
  int UNUSED written = 0;
1746
  IADDR UNUSED pc = abuf->addr;
1747
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1748
 
1749
  {
1750
    SF opval = sh64_fsqrts (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1751
    CPU (h_fr[FLD (f_dest)]) = opval;
1752
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1753
  }
1754
 
1755
  return vpc;
1756
#undef FLD
1757
}
1758
 
1759
/* fstd: fst.d $rm, $disp10x8, $drf */
1760
 
1761
static SEM_PC
1762
SEM_FN_NAME (sh64_media,fstd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1763
{
1764
#define FLD(f) abuf->fields.sfmt_fldd.f
1765
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1766
  int UNUSED written = 0;
1767
  IADDR UNUSED pc = abuf->addr;
1768
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1769
 
1770
  {
1771
    DF opval = GET_H_DR (FLD (f_dest));
1772
    SETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x8)), opval);
1773
    TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1774
  }
1775
 
1776
  return vpc;
1777
#undef FLD
1778
}
1779
 
1780
/* fstp: fst.p $rm, $disp10x8, $fpf */
1781
 
1782
static SEM_PC
1783
SEM_FN_NAME (sh64_media,fstp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1784
{
1785
#define FLD(f) abuf->fields.sfmt_fldd.f
1786
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1787
  int UNUSED written = 0;
1788
  IADDR UNUSED pc = abuf->addr;
1789
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1790
 
1791
{
1792
  {
1793
    SF opval = GET_H_FP (FLD (f_dest));
1794
    SET_H_FP (FLD (f_dest), opval);
1795
    TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1796
  }
1797
sh64_fstp (current_cpu, pc, GET_H_GR (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest));
1798
}
1799
 
1800
  return vpc;
1801
#undef FLD
1802
}
1803
 
1804
/* fsts: fst.s $rm, $disp10x4, $frf */
1805
 
1806
static SEM_PC
1807
SEM_FN_NAME (sh64_media,fsts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1808
{
1809
#define FLD(f) abuf->fields.sfmt_flds.f
1810
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1811
  int UNUSED written = 0;
1812
  IADDR UNUSED pc = abuf->addr;
1813
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1814
 
1815
  {
1816
    SF opval = CPU (h_fr[FLD (f_dest)]);
1817
    SETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x4)), opval);
1818
    TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1819
  }
1820
 
1821
  return vpc;
1822
#undef FLD
1823
}
1824
 
1825
/* fstxd: fstx.d $rm, $rn, $drf */
1826
 
1827
static SEM_PC
1828
SEM_FN_NAME (sh64_media,fstxd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1829
{
1830
#define FLD(f) abuf->fields.sfmt_add.f
1831
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1832
  int UNUSED written = 0;
1833
  IADDR UNUSED pc = abuf->addr;
1834
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1835
 
1836
  {
1837
    DF opval = GET_H_DR (FLD (f_dest));
1838
    SETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
1839
    TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1840
  }
1841
 
1842
  return vpc;
1843
#undef FLD
1844
}
1845
 
1846
/* fstxp: fstx.p $rm, $rn, $fpf */
1847
 
1848
static SEM_PC
1849
SEM_FN_NAME (sh64_media,fstxp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1850
{
1851
#define FLD(f) abuf->fields.sfmt_add.f
1852
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1853
  int UNUSED written = 0;
1854
  IADDR UNUSED pc = abuf->addr;
1855
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1856
 
1857
{
1858
  {
1859
    SF opval = GET_H_FP (FLD (f_dest));
1860
    SET_H_FP (FLD (f_dest), opval);
1861
    TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1862
  }
1863
sh64_fstp (current_cpu, pc, GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)), FLD (f_dest));
1864
}
1865
 
1866
  return vpc;
1867
#undef FLD
1868
}
1869
 
1870
/* fstxs: fstx.s $rm, $rn, $frf */
1871
 
1872
static SEM_PC
1873
SEM_FN_NAME (sh64_media,fstxs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1874
{
1875
#define FLD(f) abuf->fields.sfmt_add.f
1876
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1877
  int UNUSED written = 0;
1878
  IADDR UNUSED pc = abuf->addr;
1879
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1880
 
1881
  {
1882
    SF opval = CPU (h_fr[FLD (f_dest)]);
1883
    SETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
1884
    TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1885
  }
1886
 
1887
  return vpc;
1888
#undef FLD
1889
}
1890
 
1891
/* fsubd: fsub.d $drg, $drh, $drf */
1892
 
1893
static SEM_PC
1894
SEM_FN_NAME (sh64_media,fsubd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1895
{
1896
#define FLD(f) abuf->fields.sfmt_add.f
1897
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1898
  int UNUSED written = 0;
1899
  IADDR UNUSED pc = abuf->addr;
1900
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1901
 
1902
  {
1903
    DF opval = sh64_fsubd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
1904
    SET_H_DR (FLD (f_dest), opval);
1905
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1906
  }
1907
 
1908
  return vpc;
1909
#undef FLD
1910
}
1911
 
1912
/* fsubs: fsub.s $frg, $frh, $frf */
1913
 
1914
static SEM_PC
1915
SEM_FN_NAME (sh64_media,fsubs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1916
{
1917
#define FLD(f) abuf->fields.sfmt_add.f
1918
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1919
  int UNUSED written = 0;
1920
  IADDR UNUSED pc = abuf->addr;
1921
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1922
 
1923
  {
1924
    SF opval = sh64_fsubs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
1925
    CPU (h_fr[FLD (f_dest)]) = opval;
1926
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1927
  }
1928
 
1929
  return vpc;
1930
#undef FLD
1931
}
1932
 
1933
/* ftrcdl: ftrc.dl $drgh, $frf */
1934
 
1935
static SEM_PC
1936
SEM_FN_NAME (sh64_media,ftrcdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1937
{
1938
#define FLD(f) abuf->fields.sfmt_fabsd.f
1939
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1940
  int UNUSED written = 0;
1941
  IADDR UNUSED pc = abuf->addr;
1942
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1943
 
1944
  {
1945
    SF opval = sh64_ftrcdl (current_cpu, GET_H_DR (FLD (f_left_right)));
1946
    CPU (h_fr[FLD (f_dest)]) = opval;
1947
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1948
  }
1949
 
1950
  return vpc;
1951
#undef FLD
1952
}
1953
 
1954
/* ftrcsl: ftrc.sl $frgh, $frf */
1955
 
1956
static SEM_PC
1957
SEM_FN_NAME (sh64_media,ftrcsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1958
{
1959
#define FLD(f) abuf->fields.sfmt_fabsd.f
1960
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1961
  int UNUSED written = 0;
1962
  IADDR UNUSED pc = abuf->addr;
1963
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1964
 
1965
  {
1966
    SF opval = sh64_ftrcsl (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1967
    CPU (h_fr[FLD (f_dest)]) = opval;
1968
    TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1969
  }
1970
 
1971
  return vpc;
1972
#undef FLD
1973
}
1974
 
1975
/* ftrcdq: ftrc.dq $drgh, $drf */
1976
 
1977
static SEM_PC
1978
SEM_FN_NAME (sh64_media,ftrcdq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1979
{
1980
#define FLD(f) abuf->fields.sfmt_fabsd.f
1981
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1982
  int UNUSED written = 0;
1983
  IADDR UNUSED pc = abuf->addr;
1984
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1985
 
1986
  {
1987
    DF opval = sh64_ftrcdq (current_cpu, GET_H_DR (FLD (f_left_right)));
1988
    SET_H_DR (FLD (f_dest), opval);
1989
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1990
  }
1991
 
1992
  return vpc;
1993
#undef FLD
1994
}
1995
 
1996
/* ftrcsq: ftrc.sq $frgh, $drf */
1997
 
1998
static SEM_PC
1999
SEM_FN_NAME (sh64_media,ftrcsq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2000
{
2001
#define FLD(f) abuf->fields.sfmt_fabsd.f
2002
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2003
  int UNUSED written = 0;
2004
  IADDR UNUSED pc = abuf->addr;
2005
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2006
 
2007
  {
2008
    DF opval = sh64_ftrcsq (current_cpu, CPU (h_fr[FLD (f_left_right)]));
2009
    SET_H_DR (FLD (f_dest), opval);
2010
    TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
2011
  }
2012
 
2013
  return vpc;
2014
#undef FLD
2015
}
2016
 
2017
/* ftrvs: ftrv.s $mtrxg, $fvh, $fvf */
2018
 
2019
static SEM_PC
2020
SEM_FN_NAME (sh64_media,ftrvs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2021
{
2022
#define FLD(f) abuf->fields.sfmt_add.f
2023
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2024
  int UNUSED written = 0;
2025
  IADDR UNUSED pc = abuf->addr;
2026
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2027
 
2028
{
2029
  {
2030
    SF opval = GET_H_FMTX (FLD (f_left));
2031
    SET_H_FMTX (FLD (f_left), opval);
2032
    TRACE_RESULT (current_cpu, abuf, "fmtx", 'f', opval);
2033
  }
2034
  {
2035
    SF opval = GET_H_FV (FLD (f_right));
2036
    SET_H_FV (FLD (f_right), opval);
2037
    TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
2038
  }
2039
  {
2040
    SF opval = GET_H_FV (FLD (f_dest));
2041
    SET_H_FV (FLD (f_dest), opval);
2042
    TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
2043
  }
2044
sh64_ftrvs (current_cpu, FLD (f_left), FLD (f_right), FLD (f_dest));
2045
}
2046
 
2047
  return vpc;
2048
#undef FLD
2049
}
2050
 
2051
/* getcfg: getcfg $rm, $disp6, $rd */
2052
 
2053
static SEM_PC
2054
SEM_FN_NAME (sh64_media,getcfg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2055
{
2056
#define FLD(f) abuf->fields.sfmt_getcfg.f
2057
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2058
  int UNUSED written = 0;
2059
  IADDR UNUSED pc = abuf->addr;
2060
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2061
 
2062
{
2063
  SI tmp_address;
2064
  tmp_address = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2065
((void) 0); /*nop*/
2066
  {
2067
    DI opval = GETMEMSI (current_cpu, pc, tmp_address);
2068
    SET_H_GR (FLD (f_dest), opval);
2069
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2070
  }
2071
}
2072
 
2073
  return vpc;
2074
#undef FLD
2075
}
2076
 
2077
/* getcon: getcon $crk, $rd */
2078
 
2079
static SEM_PC
2080
SEM_FN_NAME (sh64_media,getcon) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2081
{
2082
#define FLD(f) abuf->fields.sfmt_xori.f
2083
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2084
  int UNUSED written = 0;
2085
  IADDR UNUSED pc = abuf->addr;
2086
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2087
 
2088
  {
2089
    DI opval = GET_H_CR (FLD (f_left));
2090
    SET_H_GR (FLD (f_dest), opval);
2091
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2092
  }
2093
 
2094
  return vpc;
2095
#undef FLD
2096
}
2097
 
2098
/* gettr: gettr $trb, $rd */
2099
 
2100
static SEM_PC
2101
SEM_FN_NAME (sh64_media,gettr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2102
{
2103
#define FLD(f) abuf->fields.sfmt_blink.f
2104
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2105
  int UNUSED written = 0;
2106
  IADDR UNUSED pc = abuf->addr;
2107
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2108
 
2109
  {
2110
    DI opval = CPU (h_tr[FLD (f_trb)]);
2111
    SET_H_GR (FLD (f_dest), opval);
2112
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2113
  }
2114
 
2115
  return vpc;
2116
#undef FLD
2117
}
2118
 
2119
/* icbi: icbi $rm, $disp6x32 */
2120
 
2121
static SEM_PC
2122
SEM_FN_NAME (sh64_media,icbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2123
{
2124
#define FLD(f) abuf->fields.sfmt_xori.f
2125
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2126
  int UNUSED written = 0;
2127
  IADDR UNUSED pc = abuf->addr;
2128
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2129
 
2130
{
2131
  {
2132
    DI opval = GET_H_GR (FLD (f_left));
2133
    SET_H_GR (FLD (f_left), opval);
2134
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2135
  }
2136
((void) 0); /*nop*/
2137
}
2138
 
2139
  return vpc;
2140
#undef FLD
2141
}
2142
 
2143
/* ldb: ld.b $rm, $disp10, $rd */
2144
 
2145
static SEM_PC
2146
SEM_FN_NAME (sh64_media,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2147
{
2148
#define FLD(f) abuf->fields.sfmt_addi.f
2149
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2150
  int UNUSED written = 0;
2151
  IADDR UNUSED pc = abuf->addr;
2152
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2153
 
2154
  {
2155
    DI opval = EXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)))));
2156
    SET_H_GR (FLD (f_dest), opval);
2157
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2158
  }
2159
 
2160
  return vpc;
2161
#undef FLD
2162
}
2163
 
2164
/* ldl: ld.l $rm, $disp10x4, $rd */
2165
 
2166
static SEM_PC
2167
SEM_FN_NAME (sh64_media,ldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2168
{
2169
#define FLD(f) abuf->fields.sfmt_flds.f
2170
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2171
  int UNUSED written = 0;
2172
  IADDR UNUSED pc = abuf->addr;
2173
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2174
 
2175
  {
2176
    DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x4)))));
2177
    SET_H_GR (FLD (f_dest), opval);
2178
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2179
  }
2180
 
2181
  return vpc;
2182
#undef FLD
2183
}
2184
 
2185
/* ldq: ld.q $rm, $disp10x8, $rd */
2186
 
2187
static SEM_PC
2188
SEM_FN_NAME (sh64_media,ldq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2189
{
2190
#define FLD(f) abuf->fields.sfmt_fldd.f
2191
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2192
  int UNUSED written = 0;
2193
  IADDR UNUSED pc = abuf->addr;
2194
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2195
 
2196
  {
2197
    DI opval = GETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))));
2198
    SET_H_GR (FLD (f_dest), opval);
2199
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2200
  }
2201
 
2202
  return vpc;
2203
#undef FLD
2204
}
2205
 
2206
/* ldub: ld.ub $rm, $disp10, $rd */
2207
 
2208
static SEM_PC
2209
SEM_FN_NAME (sh64_media,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2210
{
2211
#define FLD(f) abuf->fields.sfmt_addi.f
2212
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2213
  int UNUSED written = 0;
2214
  IADDR UNUSED pc = abuf->addr;
2215
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2216
 
2217
  {
2218
    DI opval = ZEXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)))));
2219
    SET_H_GR (FLD (f_dest), opval);
2220
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2221
  }
2222
 
2223
  return vpc;
2224
#undef FLD
2225
}
2226
 
2227
/* lduw: ld.uw $rm, $disp10x2, $rd */
2228
 
2229
static SEM_PC
2230
SEM_FN_NAME (sh64_media,lduw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2231
{
2232
#define FLD(f) abuf->fields.sfmt_lduw.f
2233
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2234
  int UNUSED written = 0;
2235
  IADDR UNUSED pc = abuf->addr;
2236
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2237
 
2238
  {
2239
    DI opval = ZEXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2)))));
2240
    SET_H_GR (FLD (f_dest), opval);
2241
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2242
  }
2243
 
2244
  return vpc;
2245
#undef FLD
2246
}
2247
 
2248
/* ldw: ld.w $rm, $disp10x2, $rd */
2249
 
2250
static SEM_PC
2251
SEM_FN_NAME (sh64_media,ldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2252
{
2253
#define FLD(f) abuf->fields.sfmt_lduw.f
2254
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2255
  int UNUSED written = 0;
2256
  IADDR UNUSED pc = abuf->addr;
2257
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2258
 
2259
  {
2260
    DI opval = EXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2)))));
2261
    SET_H_GR (FLD (f_dest), opval);
2262
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2263
  }
2264
 
2265
  return vpc;
2266
#undef FLD
2267
}
2268
 
2269
/* ldhil: ldhi.l $rm, $disp6, $rd */
2270
 
2271
static SEM_PC
2272
SEM_FN_NAME (sh64_media,ldhil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2273
{
2274
#define FLD(f) abuf->fields.sfmt_getcfg.f
2275
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2276
  int UNUSED written = 0;
2277
  IADDR UNUSED pc = abuf->addr;
2278
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2279
 
2280
{
2281
  DI tmp_addr;
2282
  QI tmp_bytecount;
2283
  SI tmp_val;
2284
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2285
  tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1);
2286
  tmp_val = 0;
2287
if (ANDQI (tmp_bytecount, 4)) {
2288
  {
2289
    DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -4)));
2290
    SET_H_GR (FLD (f_dest), opval);
2291
    written |= (1 << 6);
2292
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2293
  }
2294
} else {
2295
if (GET_H_ENDIAN ()) {
2296
{
2297
if (ANDQI (tmp_bytecount, 2)) {
2298
  tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2299
}
2300
if (ANDQI (tmp_bytecount, 1)) {
2301
  tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2302
}
2303
  {
2304
    DI opval = EXTSIDI (tmp_val);
2305
    SET_H_GR (FLD (f_dest), opval);
2306
    written |= (1 << 6);
2307
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2308
  }
2309
}
2310
} else {
2311
{
2312
if (ANDQI (tmp_bytecount, 1)) {
2313
  tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2314
}
2315
if (ANDQI (tmp_bytecount, 2)) {
2316
  tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2317
}
2318
  {
2319
    DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount))));
2320
    SET_H_GR (FLD (f_dest), opval);
2321
    written |= (1 << 6);
2322
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2323
  }
2324
}
2325
}
2326
}
2327
}
2328
 
2329
  abuf->written = written;
2330
  return vpc;
2331
#undef FLD
2332
}
2333
 
2334
/* ldhiq: ldhi.q $rm, $disp6, $rd */
2335
 
2336
static SEM_PC
2337
SEM_FN_NAME (sh64_media,ldhiq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2338
{
2339
#define FLD(f) abuf->fields.sfmt_getcfg.f
2340
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2341
  int UNUSED written = 0;
2342
  IADDR UNUSED pc = abuf->addr;
2343
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2344
 
2345
{
2346
  DI tmp_addr;
2347
  QI tmp_bytecount;
2348
  DI tmp_val;
2349
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2350
  tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1);
2351
  tmp_val = 0;
2352
if (ANDQI (tmp_bytecount, 8)) {
2353
  {
2354
    DI opval = GETMEMDI (current_cpu, pc, ANDDI (tmp_addr, -8));
2355
    SET_H_GR (FLD (f_dest), opval);
2356
    written |= (1 << 7);
2357
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2358
  }
2359
} else {
2360
if (GET_H_ENDIAN ()) {
2361
{
2362
if (ANDQI (tmp_bytecount, 4)) {
2363
  tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8))));
2364
}
2365
if (ANDQI (tmp_bytecount, 2)) {
2366
  tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2367
}
2368
if (ANDQI (tmp_bytecount, 1)) {
2369
  tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2370
}
2371
  {
2372
    DI opval = tmp_val;
2373
    SET_H_GR (FLD (f_dest), opval);
2374
    written |= (1 << 7);
2375
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2376
  }
2377
}
2378
} else {
2379
{
2380
if (ANDQI (tmp_bytecount, 1)) {
2381
  tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2382
}
2383
if (ANDQI (tmp_bytecount, 2)) {
2384
  tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2385
}
2386
if (ANDQI (tmp_bytecount, 4)) {
2387
  tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8))));
2388
}
2389
  {
2390
    DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount)));
2391
    SET_H_GR (FLD (f_dest), opval);
2392
    written |= (1 << 7);
2393
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2394
  }
2395
}
2396
}
2397
}
2398
}
2399
 
2400
  abuf->written = written;
2401
  return vpc;
2402
#undef FLD
2403
}
2404
 
2405
/* ldlol: ldlo.l $rm, $disp6, $rd */
2406
 
2407
static SEM_PC
2408
SEM_FN_NAME (sh64_media,ldlol) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2409
{
2410
#define FLD(f) abuf->fields.sfmt_getcfg.f
2411
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2412
  int UNUSED written = 0;
2413
  IADDR UNUSED pc = abuf->addr;
2414
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2415
 
2416
{
2417
  DI tmp_addr;
2418
  QI tmp_bytecount;
2419
  SI tmp_val;
2420
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2421
  tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3));
2422
  tmp_val = 0;
2423
if (ANDQI (tmp_bytecount, 4)) {
2424
  {
2425
    DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, tmp_addr));
2426
    SET_H_GR (FLD (f_dest), opval);
2427
    written |= (1 << 6);
2428
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2429
  }
2430
} else {
2431
if (GET_H_ENDIAN ()) {
2432
{
2433
if (ANDQI (tmp_bytecount, 1)) {
2434
  tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2435
}
2436
if (ANDQI (tmp_bytecount, 2)) {
2437
  tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2438
}
2439
  {
2440
    DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount))));
2441
    SET_H_GR (FLD (f_dest), opval);
2442
    written |= (1 << 6);
2443
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2444
  }
2445
}
2446
} else {
2447
{
2448
if (ANDQI (tmp_bytecount, 2)) {
2449
  tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2450
}
2451
if (ANDQI (tmp_bytecount, 1)) {
2452
  tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2453
}
2454
  {
2455
    DI opval = EXTSIDI (tmp_val);
2456
    SET_H_GR (FLD (f_dest), opval);
2457
    written |= (1 << 6);
2458
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2459
  }
2460
}
2461
}
2462
}
2463
}
2464
 
2465
  abuf->written = written;
2466
  return vpc;
2467
#undef FLD
2468
}
2469
 
2470
/* ldloq: ldlo.q $rm, $disp6, $rd */
2471
 
2472
static SEM_PC
2473
SEM_FN_NAME (sh64_media,ldloq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2474
{
2475
#define FLD(f) abuf->fields.sfmt_getcfg.f
2476
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2477
  int UNUSED written = 0;
2478
  IADDR UNUSED pc = abuf->addr;
2479
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2480
 
2481
{
2482
  DI tmp_addr;
2483
  QI tmp_bytecount;
2484
  DI tmp_val;
2485
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2486
  tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7));
2487
  tmp_val = 0;
2488
if (ANDQI (tmp_bytecount, 8)) {
2489
  {
2490
    DI opval = GETMEMDI (current_cpu, pc, tmp_addr);
2491
    SET_H_GR (FLD (f_dest), opval);
2492
    written |= (1 << 7);
2493
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2494
  }
2495
} else {
2496
if (GET_H_ENDIAN ()) {
2497
{
2498
if (ANDQI (tmp_bytecount, 1)) {
2499
  tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2500
}
2501
if (ANDQI (tmp_bytecount, 2)) {
2502
  tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2503
}
2504
if (ANDQI (tmp_bytecount, 4)) {
2505
  tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4))));
2506
}
2507
  {
2508
    DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount)));
2509
    SET_H_GR (FLD (f_dest), opval);
2510
    written |= (1 << 7);
2511
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2512
  }
2513
}
2514
} else {
2515
{
2516
if (ANDQI (tmp_bytecount, 4)) {
2517
  tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4))));
2518
}
2519
if (ANDQI (tmp_bytecount, 2)) {
2520
  tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2521
}
2522
if (ANDQI (tmp_bytecount, 1)) {
2523
  tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2524
}
2525
  {
2526
    DI opval = tmp_val;
2527
    SET_H_GR (FLD (f_dest), opval);
2528
    written |= (1 << 7);
2529
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2530
  }
2531
}
2532
}
2533
}
2534
}
2535
 
2536
  abuf->written = written;
2537
  return vpc;
2538
#undef FLD
2539
}
2540
 
2541
/* ldxb: ldx.b $rm, $rn, $rd */
2542
 
2543
static SEM_PC
2544
SEM_FN_NAME (sh64_media,ldxb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2545
{
2546
#define FLD(f) abuf->fields.sfmt_add.f
2547
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2548
  int UNUSED written = 0;
2549
  IADDR UNUSED pc = abuf->addr;
2550
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2551
 
2552
  {
2553
    DI opval = EXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2554
    SET_H_GR (FLD (f_dest), opval);
2555
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2556
  }
2557
 
2558
  return vpc;
2559
#undef FLD
2560
}
2561
 
2562
/* ldxl: ldx.l $rm, $rn, $rd */
2563
 
2564
static SEM_PC
2565
SEM_FN_NAME (sh64_media,ldxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2566
{
2567
#define FLD(f) abuf->fields.sfmt_add.f
2568
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2569
  int UNUSED written = 0;
2570
  IADDR UNUSED pc = abuf->addr;
2571
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2572
 
2573
  {
2574
    DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2575
    SET_H_GR (FLD (f_dest), opval);
2576
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2577
  }
2578
 
2579
  return vpc;
2580
#undef FLD
2581
}
2582
 
2583
/* ldxq: ldx.q $rm, $rn, $rd */
2584
 
2585
static SEM_PC
2586
SEM_FN_NAME (sh64_media,ldxq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2587
{
2588
#define FLD(f) abuf->fields.sfmt_add.f
2589
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2590
  int UNUSED written = 0;
2591
  IADDR UNUSED pc = abuf->addr;
2592
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2593
 
2594
  {
2595
    DI opval = GETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))));
2596
    SET_H_GR (FLD (f_dest), opval);
2597
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2598
  }
2599
 
2600
  return vpc;
2601
#undef FLD
2602
}
2603
 
2604
/* ldxub: ldx.ub $rm, $rn, $rd */
2605
 
2606
static SEM_PC
2607
SEM_FN_NAME (sh64_media,ldxub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2608
{
2609
#define FLD(f) abuf->fields.sfmt_add.f
2610
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2611
  int UNUSED written = 0;
2612
  IADDR UNUSED pc = abuf->addr;
2613
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2614
 
2615
  {
2616
    DI opval = ZEXTQIDI (GETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2617
    SET_H_GR (FLD (f_dest), opval);
2618
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2619
  }
2620
 
2621
  return vpc;
2622
#undef FLD
2623
}
2624
 
2625
/* ldxuw: ldx.uw $rm, $rn, $rd */
2626
 
2627
static SEM_PC
2628
SEM_FN_NAME (sh64_media,ldxuw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2629
{
2630
#define FLD(f) abuf->fields.sfmt_add.f
2631
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2632
  int UNUSED written = 0;
2633
  IADDR UNUSED pc = abuf->addr;
2634
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2635
 
2636
  {
2637
    DI opval = ZEXTHIDI (GETMEMUHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2638
    SET_H_GR (FLD (f_dest), opval);
2639
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2640
  }
2641
 
2642
  return vpc;
2643
#undef FLD
2644
}
2645
 
2646
/* ldxw: ldx.w $rm, $rn, $rd */
2647
 
2648
static SEM_PC
2649
SEM_FN_NAME (sh64_media,ldxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2650
{
2651
#define FLD(f) abuf->fields.sfmt_add.f
2652
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2653
  int UNUSED written = 0;
2654
  IADDR UNUSED pc = abuf->addr;
2655
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2656
 
2657
  {
2658
    DI opval = EXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2659
    SET_H_GR (FLD (f_dest), opval);
2660
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2661
  }
2662
 
2663
  return vpc;
2664
#undef FLD
2665
}
2666
 
2667
/* mabsl: mabs.l $rm, $rd */
2668
 
2669
static SEM_PC
2670
SEM_FN_NAME (sh64_media,mabsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2671
{
2672
#define FLD(f) abuf->fields.sfmt_xori.f
2673
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2674
  int UNUSED written = 0;
2675
  IADDR UNUSED pc = abuf->addr;
2676
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2677
 
2678
{
2679
  SI tmp_result1;
2680
  SI tmp_result0;
2681
  tmp_result0 = ABSSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1));
2682
  tmp_result1 = ABSSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0));
2683
  {
2684
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2685
    SET_H_GR (FLD (f_dest), opval);
2686
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2687
  }
2688
}
2689
 
2690
  return vpc;
2691
#undef FLD
2692
}
2693
 
2694
/* mabsw: mabs.w $rm, $rd */
2695
 
2696
static SEM_PC
2697
SEM_FN_NAME (sh64_media,mabsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2698
{
2699
#define FLD(f) abuf->fields.sfmt_xori.f
2700
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2701
  int UNUSED written = 0;
2702
  IADDR UNUSED pc = abuf->addr;
2703
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2704
 
2705
{
2706
  HI tmp_result3;
2707
  HI tmp_result2;
2708
  HI tmp_result1;
2709
  HI tmp_result0;
2710
  tmp_result0 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3));
2711
  tmp_result1 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2));
2712
  tmp_result2 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1));
2713
  tmp_result3 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0));
2714
  {
2715
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2716
    SET_H_GR (FLD (f_dest), opval);
2717
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2718
  }
2719
}
2720
 
2721
  return vpc;
2722
#undef FLD
2723
}
2724
 
2725
/* maddl: madd.l $rm, $rn, $rd */
2726
 
2727
static SEM_PC
2728
SEM_FN_NAME (sh64_media,maddl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2729
{
2730
#define FLD(f) abuf->fields.sfmt_add.f
2731
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2732
  int UNUSED written = 0;
2733
  IADDR UNUSED pc = abuf->addr;
2734
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2735
 
2736
{
2737
  SI tmp_result1;
2738
  SI tmp_result0;
2739
  tmp_result0 = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
2740
  tmp_result1 = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0));
2741
  {
2742
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2743
    SET_H_GR (FLD (f_dest), opval);
2744
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2745
  }
2746
}
2747
 
2748
  return vpc;
2749
#undef FLD
2750
}
2751
 
2752
/* maddw: madd.w $rm, $rn, $rd */
2753
 
2754
static SEM_PC
2755
SEM_FN_NAME (sh64_media,maddw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2756
{
2757
#define FLD(f) abuf->fields.sfmt_add.f
2758
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2759
  int UNUSED written = 0;
2760
  IADDR UNUSED pc = abuf->addr;
2761
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2762
 
2763
{
2764
  HI tmp_result3;
2765
  HI tmp_result2;
2766
  HI tmp_result1;
2767
  HI tmp_result0;
2768
  tmp_result0 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3));
2769
  tmp_result1 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2));
2770
  tmp_result2 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1));
2771
  tmp_result3 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0));
2772
  {
2773
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2774
    SET_H_GR (FLD (f_dest), opval);
2775
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2776
  }
2777
}
2778
 
2779
  return vpc;
2780
#undef FLD
2781
}
2782
 
2783
/* maddsl: madds.l $rm, $rn, $rd */
2784
 
2785
static SEM_PC
2786
SEM_FN_NAME (sh64_media,maddsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2787
{
2788
#define FLD(f) abuf->fields.sfmt_add.f
2789
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2790
  int UNUSED written = 0;
2791
  IADDR UNUSED pc = abuf->addr;
2792
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2793
 
2794
{
2795
  SI tmp_result1;
2796
  SI tmp_result0;
2797
  tmp_result0 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
2798
  tmp_result1 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
2799
  {
2800
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2801
    SET_H_GR (FLD (f_dest), opval);
2802
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2803
  }
2804
}
2805
 
2806
  return vpc;
2807
#undef FLD
2808
}
2809
 
2810
/* maddsub: madds.ub $rm, $rn, $rd */
2811
 
2812
static SEM_PC
2813
SEM_FN_NAME (sh64_media,maddsub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2814
{
2815
#define FLD(f) abuf->fields.sfmt_add.f
2816
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2817
  int UNUSED written = 0;
2818
  IADDR UNUSED pc = abuf->addr;
2819
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2820
 
2821
{
2822
  QI tmp_result7;
2823
  QI tmp_result6;
2824
  QI tmp_result5;
2825
  QI tmp_result4;
2826
  QI tmp_result3;
2827
  QI tmp_result2;
2828
  QI tmp_result1;
2829
  QI tmp_result0;
2830
  tmp_result0 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1)))));
2831
  tmp_result1 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1)))));
2832
  tmp_result2 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1)))));
2833
  tmp_result3 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1)))));
2834
  tmp_result4 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1)))));
2835
  tmp_result5 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1)))));
2836
  tmp_result6 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1)))));
2837
  tmp_result7 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1)))));
2838
  {
2839
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
2840
    SET_H_GR (FLD (f_dest), opval);
2841
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2842
  }
2843
}
2844
 
2845
  return vpc;
2846
#undef FLD
2847
}
2848
 
2849
/* maddsw: madds.w $rm, $rn, $rd */
2850
 
2851
static SEM_PC
2852
SEM_FN_NAME (sh64_media,maddsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2853
{
2854
#define FLD(f) abuf->fields.sfmt_add.f
2855
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2856
  int UNUSED written = 0;
2857
  IADDR UNUSED pc = abuf->addr;
2858
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2859
 
2860
{
2861
  HI tmp_result3;
2862
  HI tmp_result2;
2863
  HI tmp_result1;
2864
  HI tmp_result0;
2865
  tmp_result0 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2866
  tmp_result1 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2867
  tmp_result2 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2868
  tmp_result3 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2869
  {
2870
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2871
    SET_H_GR (FLD (f_dest), opval);
2872
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2873
  }
2874
}
2875
 
2876
  return vpc;
2877
#undef FLD
2878
}
2879
 
2880
/* mcmpeqb: mcmpeq.b $rm, $rn, $rd */
2881
 
2882
static SEM_PC
2883
SEM_FN_NAME (sh64_media,mcmpeqb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2884
{
2885
#define FLD(f) abuf->fields.sfmt_add.f
2886
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2887
  int UNUSED written = 0;
2888
  IADDR UNUSED pc = abuf->addr;
2889
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2890
 
2891
{
2892
  QI tmp_result7;
2893
  QI tmp_result6;
2894
  QI tmp_result5;
2895
  QI tmp_result4;
2896
  QI tmp_result3;
2897
  QI tmp_result2;
2898
  QI tmp_result1;
2899
  QI tmp_result0;
2900
  tmp_result0 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))) ? (INVQI (0)) : (0));
2901
  tmp_result1 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))) ? (INVQI (0)) : (0));
2902
  tmp_result2 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))) ? (INVQI (0)) : (0));
2903
  tmp_result3 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))) ? (INVQI (0)) : (0));
2904
  tmp_result4 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))) ? (INVQI (0)) : (0));
2905
  tmp_result5 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))) ? (INVQI (0)) : (0));
2906
  tmp_result6 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))) ? (INVQI (0)) : (0));
2907
  tmp_result7 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))) ? (INVQI (0)) : (0));
2908
  {
2909
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
2910
    SET_H_GR (FLD (f_dest), opval);
2911
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2912
  }
2913
}
2914
 
2915
  return vpc;
2916
#undef FLD
2917
}
2918
 
2919
/* mcmpeql: mcmpeq.l $rm, $rn, $rd */
2920
 
2921
static SEM_PC
2922
SEM_FN_NAME (sh64_media,mcmpeql) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2923
{
2924
#define FLD(f) abuf->fields.sfmt_add.f
2925
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2926
  int UNUSED written = 0;
2927
  IADDR UNUSED pc = abuf->addr;
2928
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2929
 
2930
{
2931
  SI tmp_result1;
2932
  SI tmp_result0;
2933
  tmp_result0 = ((EQSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))) ? (INVSI (0)) : (0));
2934
  tmp_result1 = ((EQSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))) ? (INVSI (0)) : (0));
2935
  {
2936
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2937
    SET_H_GR (FLD (f_dest), opval);
2938
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2939
  }
2940
}
2941
 
2942
  return vpc;
2943
#undef FLD
2944
}
2945
 
2946
/* mcmpeqw: mcmpeq.w $rm, $rn, $rd */
2947
 
2948
static SEM_PC
2949
SEM_FN_NAME (sh64_media,mcmpeqw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2950
{
2951
#define FLD(f) abuf->fields.sfmt_add.f
2952
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2953
  int UNUSED written = 0;
2954
  IADDR UNUSED pc = abuf->addr;
2955
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2956
 
2957
{
2958
  HI tmp_result3;
2959
  HI tmp_result2;
2960
  HI tmp_result1;
2961
  HI tmp_result0;
2962
  tmp_result0 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))) ? (INVHI (0)) : (0));
2963
  tmp_result1 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))) ? (INVHI (0)) : (0));
2964
  tmp_result2 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))) ? (INVHI (0)) : (0));
2965
  tmp_result3 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))) ? (INVHI (0)) : (0));
2966
  {
2967
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2968
    SET_H_GR (FLD (f_dest), opval);
2969
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2970
  }
2971
}
2972
 
2973
  return vpc;
2974
#undef FLD
2975
}
2976
 
2977
/* mcmpgtl: mcmpgt.l $rm, $rn, $rd */
2978
 
2979
static SEM_PC
2980
SEM_FN_NAME (sh64_media,mcmpgtl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2981
{
2982
#define FLD(f) abuf->fields.sfmt_add.f
2983
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2984
  int UNUSED written = 0;
2985
  IADDR UNUSED pc = abuf->addr;
2986
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2987
 
2988
{
2989
  SI tmp_result1;
2990
  SI tmp_result0;
2991
  tmp_result0 = ((GTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))) ? (INVSI (0)) : (0));
2992
  tmp_result1 = ((GTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))) ? (INVSI (0)) : (0));
2993
  {
2994
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2995
    SET_H_GR (FLD (f_dest), opval);
2996
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2997
  }
2998
}
2999
 
3000
  return vpc;
3001
#undef FLD
3002
}
3003
 
3004
/* mcmpgtub: mcmpgt.ub $rm, $rn, $rd */
3005
 
3006
static SEM_PC
3007
SEM_FN_NAME (sh64_media,mcmpgtub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3008
{
3009
#define FLD(f) abuf->fields.sfmt_add.f
3010
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3011
  int UNUSED written = 0;
3012
  IADDR UNUSED pc = abuf->addr;
3013
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3014
 
3015
{
3016
  QI tmp_result7;
3017
  QI tmp_result6;
3018
  QI tmp_result5;
3019
  QI tmp_result4;
3020
  QI tmp_result3;
3021
  QI tmp_result2;
3022
  QI tmp_result1;
3023
  QI tmp_result0;
3024
  tmp_result0 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))) ? (INVQI (0)) : (0));
3025
  tmp_result1 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))) ? (INVQI (0)) : (0));
3026
  tmp_result2 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))) ? (INVQI (0)) : (0));
3027
  tmp_result3 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))) ? (INVQI (0)) : (0));
3028
  tmp_result4 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))) ? (INVQI (0)) : (0));
3029
  tmp_result5 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))) ? (INVQI (0)) : (0));
3030
  tmp_result6 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))) ? (INVQI (0)) : (0));
3031
  tmp_result7 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))) ? (INVQI (0)) : (0));
3032
  {
3033
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3034
    SET_H_GR (FLD (f_dest), opval);
3035
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3036
  }
3037
}
3038
 
3039
  return vpc;
3040
#undef FLD
3041
}
3042
 
3043
/* mcmpgtw: mcmpgt.w $rm, $rn, $rd */
3044
 
3045
static SEM_PC
3046
SEM_FN_NAME (sh64_media,mcmpgtw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3047
{
3048
#define FLD(f) abuf->fields.sfmt_add.f
3049
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3050
  int UNUSED written = 0;
3051
  IADDR UNUSED pc = abuf->addr;
3052
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3053
 
3054
{
3055
  HI tmp_result3;
3056
  HI tmp_result2;
3057
  HI tmp_result1;
3058
  HI tmp_result0;
3059
  tmp_result0 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))) ? (INVHI (0)) : (0));
3060
  tmp_result1 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))) ? (INVHI (0)) : (0));
3061
  tmp_result2 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))) ? (INVHI (0)) : (0));
3062
  tmp_result3 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))) ? (INVHI (0)) : (0));
3063
  {
3064
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3065
    SET_H_GR (FLD (f_dest), opval);
3066
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3067
  }
3068
}
3069
 
3070
  return vpc;
3071
#undef FLD
3072
}
3073
 
3074
/* mcmv: mcmv $rm, $rn, $rd */
3075
 
3076
static SEM_PC
3077
SEM_FN_NAME (sh64_media,mcmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3078
{
3079
#define FLD(f) abuf->fields.sfmt_add.f
3080
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3081
  int UNUSED written = 0;
3082
  IADDR UNUSED pc = abuf->addr;
3083
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3084
 
3085
  {
3086
    DI opval = ORDI (ANDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), ANDDI (GET_H_GR (FLD (f_dest)), INVDI (GET_H_GR (FLD (f_right)))));
3087
    SET_H_GR (FLD (f_dest), opval);
3088
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3089
  }
3090
 
3091
  return vpc;
3092
#undef FLD
3093
}
3094
 
3095
/* mcnvslw: mcnvs.lw $rm, $rn, $rd */
3096
 
3097
static SEM_PC
3098
SEM_FN_NAME (sh64_media,mcnvslw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3099
{
3100
#define FLD(f) abuf->fields.sfmt_add.f
3101
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3102
  int UNUSED written = 0;
3103
  IADDR UNUSED pc = abuf->addr;
3104
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3105
 
3106
{
3107
  HI tmp_result3;
3108
  HI tmp_result2;
3109
  HI tmp_result1;
3110
  HI tmp_result0;
3111
  tmp_result0 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3112
  tmp_result1 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3113
  tmp_result2 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3114
  tmp_result3 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3115
  {
3116
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3117
    SET_H_GR (FLD (f_dest), opval);
3118
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3119
  }
3120
}
3121
 
3122
  return vpc;
3123
#undef FLD
3124
}
3125
 
3126
/* mcnvswb: mcnvs.wb $rm, $rn, $rd */
3127
 
3128
static SEM_PC
3129
SEM_FN_NAME (sh64_media,mcnvswb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3130
{
3131
#define FLD(f) abuf->fields.sfmt_add.f
3132
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3133
  int UNUSED written = 0;
3134
  IADDR UNUSED pc = abuf->addr;
3135
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3136
 
3137
{
3138
  QI tmp_result7;
3139
  QI tmp_result6;
3140
  QI tmp_result5;
3141
  QI tmp_result4;
3142
  QI tmp_result3;
3143
  QI tmp_result2;
3144
  QI tmp_result1;
3145
  QI tmp_result0;
3146
  tmp_result0 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3147
  tmp_result1 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3148
  tmp_result2 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3149
  tmp_result3 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3150
  tmp_result4 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3151
  tmp_result5 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3152
  tmp_result6 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3153
  tmp_result7 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3154
  {
3155
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3156
    SET_H_GR (FLD (f_dest), opval);
3157
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3158
  }
3159
}
3160
 
3161
  return vpc;
3162
#undef FLD
3163
}
3164
 
3165
/* mcnvswub: mcnvs.wub $rm, $rn, $rd */
3166
 
3167
static SEM_PC
3168
SEM_FN_NAME (sh64_media,mcnvswub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3169
{
3170
#define FLD(f) abuf->fields.sfmt_add.f
3171
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3172
  int UNUSED written = 0;
3173
  IADDR UNUSED pc = abuf->addr;
3174
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3175
 
3176
{
3177
  QI tmp_result7;
3178
  QI tmp_result6;
3179
  QI tmp_result5;
3180
  QI tmp_result4;
3181
  QI tmp_result3;
3182
  QI tmp_result2;
3183
  QI tmp_result1;
3184
  QI tmp_result0;
3185
  tmp_result0 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, 8), 1)))));
3186
  tmp_result1 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, 8), 1)))));
3187
  tmp_result2 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, 8), 1)))));
3188
  tmp_result3 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, 8), 1)))));
3189
  tmp_result4 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, 8), 1)))));
3190
  tmp_result5 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, 8), 1)))));
3191
  tmp_result6 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, 8), 1)))));
3192
  tmp_result7 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, 8), 1)))));
3193
  {
3194
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3195
    SET_H_GR (FLD (f_dest), opval);
3196
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3197
  }
3198
}
3199
 
3200
  return vpc;
3201
#undef FLD
3202
}
3203
 
3204
/* mextr1: mextr1 $rm, $rn, $rd */
3205
 
3206
static SEM_PC
3207
SEM_FN_NAME (sh64_media,mextr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3208
{
3209
#define FLD(f) abuf->fields.sfmt_add.f
3210
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3211
  int UNUSED written = 0;
3212
  IADDR UNUSED pc = abuf->addr;
3213
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3214
 
3215
{
3216
  QI tmp_count;
3217
  DI tmp_mask;
3218
  DI tmp_rhs;
3219
  tmp_count = MULQI (8, 1);
3220
  tmp_mask = SLLDI (INVSI (0), tmp_count);
3221
  tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3222
  tmp_count = MULQI (8, SUBQI (8, 1));
3223
  tmp_mask = SRLDI (INVSI (0), tmp_count);
3224
  {
3225
    DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3226
    SET_H_GR (FLD (f_dest), opval);
3227
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3228
  }
3229
}
3230
 
3231
  return vpc;
3232
#undef FLD
3233
}
3234
 
3235
/* mextr2: mextr2 $rm, $rn, $rd */
3236
 
3237
static SEM_PC
3238
SEM_FN_NAME (sh64_media,mextr2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3239
{
3240
#define FLD(f) abuf->fields.sfmt_add.f
3241
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3242
  int UNUSED written = 0;
3243
  IADDR UNUSED pc = abuf->addr;
3244
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3245
 
3246
{
3247
  QI tmp_count;
3248
  DI tmp_mask;
3249
  DI tmp_rhs;
3250
  tmp_count = MULQI (8, 2);
3251
  tmp_mask = SLLDI (INVSI (0), tmp_count);
3252
  tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3253
  tmp_count = MULQI (8, SUBQI (8, 2));
3254
  tmp_mask = SRLDI (INVSI (0), tmp_count);
3255
  {
3256
    DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3257
    SET_H_GR (FLD (f_dest), opval);
3258
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3259
  }
3260
}
3261
 
3262
  return vpc;
3263
#undef FLD
3264
}
3265
 
3266
/* mextr3: mextr3 $rm, $rn, $rd */
3267
 
3268
static SEM_PC
3269
SEM_FN_NAME (sh64_media,mextr3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3270
{
3271
#define FLD(f) abuf->fields.sfmt_add.f
3272
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3273
  int UNUSED written = 0;
3274
  IADDR UNUSED pc = abuf->addr;
3275
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3276
 
3277
{
3278
  QI tmp_count;
3279
  DI tmp_mask;
3280
  DI tmp_rhs;
3281
  tmp_count = MULQI (8, 3);
3282
  tmp_mask = SLLDI (INVSI (0), tmp_count);
3283
  tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3284
  tmp_count = MULQI (8, SUBQI (8, 3));
3285
  tmp_mask = SRLDI (INVSI (0), tmp_count);
3286
  {
3287
    DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3288
    SET_H_GR (FLD (f_dest), opval);
3289
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3290
  }
3291
}
3292
 
3293
  return vpc;
3294
#undef FLD
3295
}
3296
 
3297
/* mextr4: mextr4 $rm, $rn, $rd */
3298
 
3299
static SEM_PC
3300
SEM_FN_NAME (sh64_media,mextr4) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3301
{
3302
#define FLD(f) abuf->fields.sfmt_add.f
3303
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3304
  int UNUSED written = 0;
3305
  IADDR UNUSED pc = abuf->addr;
3306
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3307
 
3308
{
3309
  QI tmp_count;
3310
  DI tmp_mask;
3311
  DI tmp_rhs;
3312
  tmp_count = MULQI (8, 4);
3313
  tmp_mask = SLLDI (INVSI (0), tmp_count);
3314
  tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3315
  tmp_count = MULQI (8, SUBQI (8, 4));
3316
  tmp_mask = SRLDI (INVSI (0), tmp_count);
3317
  {
3318
    DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3319
    SET_H_GR (FLD (f_dest), opval);
3320
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3321
  }
3322
}
3323
 
3324
  return vpc;
3325
#undef FLD
3326
}
3327
 
3328
/* mextr5: mextr5 $rm, $rn, $rd */
3329
 
3330
static SEM_PC
3331
SEM_FN_NAME (sh64_media,mextr5) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3332
{
3333
#define FLD(f) abuf->fields.sfmt_add.f
3334
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3335
  int UNUSED written = 0;
3336
  IADDR UNUSED pc = abuf->addr;
3337
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3338
 
3339
{
3340
  QI tmp_count;
3341
  DI tmp_mask;
3342
  DI tmp_rhs;
3343
  tmp_count = MULQI (8, 5);
3344
  tmp_mask = SLLDI (INVSI (0), tmp_count);
3345
  tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3346
  tmp_count = MULQI (8, SUBQI (8, 5));
3347
  tmp_mask = SRLDI (INVSI (0), tmp_count);
3348
  {
3349
    DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3350
    SET_H_GR (FLD (f_dest), opval);
3351
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3352
  }
3353
}
3354
 
3355
  return vpc;
3356
#undef FLD
3357
}
3358
 
3359
/* mextr6: mextr6 $rm, $rn, $rd */
3360
 
3361
static SEM_PC
3362
SEM_FN_NAME (sh64_media,mextr6) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3363
{
3364
#define FLD(f) abuf->fields.sfmt_add.f
3365
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3366
  int UNUSED written = 0;
3367
  IADDR UNUSED pc = abuf->addr;
3368
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3369
 
3370
{
3371
  QI tmp_count;
3372
  DI tmp_mask;
3373
  DI tmp_rhs;
3374
  tmp_count = MULQI (8, 6);
3375
  tmp_mask = SLLDI (INVSI (0), tmp_count);
3376
  tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3377
  tmp_count = MULQI (8, SUBQI (8, 6));
3378
  tmp_mask = SRLDI (INVSI (0), tmp_count);
3379
  {
3380
    DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3381
    SET_H_GR (FLD (f_dest), opval);
3382
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3383
  }
3384
}
3385
 
3386
  return vpc;
3387
#undef FLD
3388
}
3389
 
3390
/* mextr7: mextr7 $rm, $rn, $rd */
3391
 
3392
static SEM_PC
3393
SEM_FN_NAME (sh64_media,mextr7) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3394
{
3395
#define FLD(f) abuf->fields.sfmt_add.f
3396
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3397
  int UNUSED written = 0;
3398
  IADDR UNUSED pc = abuf->addr;
3399
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3400
 
3401
{
3402
  QI tmp_count;
3403
  DI tmp_mask;
3404
  DI tmp_rhs;
3405
  tmp_count = MULQI (8, 7);
3406
  tmp_mask = SLLDI (INVSI (0), tmp_count);
3407
  tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3408
  tmp_count = MULQI (8, SUBQI (8, 7));
3409
  tmp_mask = SRLDI (INVSI (0), tmp_count);
3410
  {
3411
    DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3412
    SET_H_GR (FLD (f_dest), opval);
3413
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3414
  }
3415
}
3416
 
3417
  return vpc;
3418
#undef FLD
3419
}
3420
 
3421
/* mmacfxwl: mmacfx.wl $rm, $rn, $rd */
3422
 
3423
static SEM_PC
3424
SEM_FN_NAME (sh64_media,mmacfxwl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3425
{
3426
#define FLD(f) abuf->fields.sfmt_add.f
3427
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3428
  int UNUSED written = 0;
3429
  IADDR UNUSED pc = abuf->addr;
3430
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3431
 
3432
{
3433
  SI tmp_temp;
3434
  SI tmp_result1;
3435
  SI tmp_result0;
3436
  tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1);
3437
  tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 0);
3438
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3439
  tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3440
  tmp_result0 = ((LTDI (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3441
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3442
  tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3443
  tmp_result1 = ((LTDI (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3444
  {
3445
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3446
    SET_H_GR (FLD (f_dest), opval);
3447
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3448
  }
3449
}
3450
 
3451
  return vpc;
3452
#undef FLD
3453
}
3454
 
3455
/* mmacnfx.wl: mmacnfx.wl $rm, $rn, $rd */
3456
 
3457
static SEM_PC
3458
SEM_FN_NAME (sh64_media,mmacnfx_wl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3459
{
3460
#define FLD(f) abuf->fields.sfmt_add.f
3461
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3462
  int UNUSED written = 0;
3463
  IADDR UNUSED pc = abuf->addr;
3464
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3465
 
3466
{
3467
  SI tmp_temp;
3468
  SI tmp_result1;
3469
  SI tmp_result0;
3470
  tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1);
3471
  tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 0);
3472
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3473
  tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3474
  tmp_result0 = ((LTDI (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3475
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3476
  tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3477
  tmp_result1 = ((LTDI (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3478
  {
3479
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3480
    SET_H_GR (FLD (f_dest), opval);
3481
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3482
  }
3483
}
3484
 
3485
  return vpc;
3486
#undef FLD
3487
}
3488
 
3489
/* mmull: mmul.l $rm, $rn, $rd */
3490
 
3491
static SEM_PC
3492
SEM_FN_NAME (sh64_media,mmull) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3493
{
3494
#define FLD(f) abuf->fields.sfmt_add.f
3495
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3496
  int UNUSED written = 0;
3497
  IADDR UNUSED pc = abuf->addr;
3498
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3499
 
3500
{
3501
  SI tmp_result1;
3502
  SI tmp_result0;
3503
  tmp_result0 = MULSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
3504
  tmp_result1 = MULSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0));
3505
  {
3506
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3507
    SET_H_GR (FLD (f_dest), opval);
3508
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3509
  }
3510
}
3511
 
3512
  return vpc;
3513
#undef FLD
3514
}
3515
 
3516
/* mmulw: mmul.w $rm, $rn, $rd */
3517
 
3518
static SEM_PC
3519
SEM_FN_NAME (sh64_media,mmulw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3520
{
3521
#define FLD(f) abuf->fields.sfmt_add.f
3522
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3523
  int UNUSED written = 0;
3524
  IADDR UNUSED pc = abuf->addr;
3525
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3526
 
3527
{
3528
  HI tmp_result3;
3529
  HI tmp_result2;
3530
  HI tmp_result1;
3531
  HI tmp_result0;
3532
  tmp_result0 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3));
3533
  tmp_result1 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2));
3534
  tmp_result2 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1));
3535
  tmp_result3 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0));
3536
  {
3537
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3538
    SET_H_GR (FLD (f_dest), opval);
3539
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3540
  }
3541
}
3542
 
3543
  return vpc;
3544
#undef FLD
3545
}
3546
 
3547
/* mmulfxl: mmulfx.l $rm, $rn, $rd */
3548
 
3549
static SEM_PC
3550
SEM_FN_NAME (sh64_media,mmulfxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3551
{
3552
#define FLD(f) abuf->fields.sfmt_add.f
3553
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3554
  int UNUSED written = 0;
3555
  IADDR UNUSED pc = abuf->addr;
3556
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3557
 
3558
{
3559
  DI tmp_temp;
3560
  SI tmp_result0;
3561
  SI tmp_result1;
3562
  tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
3563
  tmp_result0 = ((LTDI (SRADI (tmp_temp, 31), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SRADI (tmp_temp, 31), SLLDI (1, SUBSI (32, 1)))) ? (SRADI (tmp_temp, 31)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3564
  tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)));
3565
  tmp_result1 = ((LTDI (SRADI (tmp_temp, 31), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SRADI (tmp_temp, 31), SLLDI (1, SUBSI (32, 1)))) ? (SRADI (tmp_temp, 31)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3566
  {
3567
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3568
    SET_H_GR (FLD (f_dest), opval);
3569
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3570
  }
3571
}
3572
 
3573
  return vpc;
3574
#undef FLD
3575
}
3576
 
3577
/* mmulfxw: mmulfx.w $rm, $rn, $rd */
3578
 
3579
static SEM_PC
3580
SEM_FN_NAME (sh64_media,mmulfxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3581
{
3582
#define FLD(f) abuf->fields.sfmt_add.f
3583
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3584
  int UNUSED written = 0;
3585
  IADDR UNUSED pc = abuf->addr;
3586
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3587
 
3588
{
3589
  SI tmp_temp;
3590
  HI tmp_result0;
3591
  HI tmp_result1;
3592
  HI tmp_result2;
3593
  HI tmp_result3;
3594
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3595
  tmp_result0 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3596
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3597
  tmp_result1 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3598
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)));
3599
  tmp_result2 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3600
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3601
  tmp_result3 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3602
  {
3603
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3604
    SET_H_GR (FLD (f_dest), opval);
3605
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3606
  }
3607
}
3608
 
3609
  return vpc;
3610
#undef FLD
3611
}
3612
 
3613
/* mmulfxrpw: mmulfxrp.w $rm, $rn, $rd */
3614
 
3615
static SEM_PC
3616
SEM_FN_NAME (sh64_media,mmulfxrpw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3617
{
3618
#define FLD(f) abuf->fields.sfmt_add.f
3619
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3620
  int UNUSED written = 0;
3621
  IADDR UNUSED pc = abuf->addr;
3622
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3623
 
3624
{
3625
  SI tmp_temp;
3626
  HI tmp_result0;
3627
  HI tmp_result1;
3628
  HI tmp_result2;
3629
  HI tmp_result3;
3630
  HI tmp_c;
3631
  tmp_c = SLLSI (1, 14);
3632
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3633
  tmp_result0 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3634
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3635
  tmp_result1 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3636
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)));
3637
  tmp_result2 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3638
  tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3639
  tmp_result3 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3640
  {
3641
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3642
    SET_H_GR (FLD (f_dest), opval);
3643
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3644
  }
3645
}
3646
 
3647
  return vpc;
3648
#undef FLD
3649
}
3650
 
3651
/* mmulhiwl: mmulhi.wl $rm, $rn, $rd */
3652
 
3653
static SEM_PC
3654
SEM_FN_NAME (sh64_media,mmulhiwl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3655
{
3656
#define FLD(f) abuf->fields.sfmt_add.f
3657
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3658
  int UNUSED written = 0;
3659
  IADDR UNUSED pc = abuf->addr;
3660
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3661
 
3662
{
3663
  SI tmp_result1;
3664
  SI tmp_result0;
3665
  tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)));
3666
  tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3667
  {
3668
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3669
    SET_H_GR (FLD (f_dest), opval);
3670
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3671
  }
3672
}
3673
 
3674
  return vpc;
3675
#undef FLD
3676
}
3677
 
3678
/* mmullowl: mmullo.wl $rm, $rn, $rd */
3679
 
3680
static SEM_PC
3681
SEM_FN_NAME (sh64_media,mmullowl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3682
{
3683
#define FLD(f) abuf->fields.sfmt_add.f
3684
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3685
  int UNUSED written = 0;
3686
  IADDR UNUSED pc = abuf->addr;
3687
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3688
 
3689
{
3690
  SI tmp_result1;
3691
  SI tmp_result0;
3692
  tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3693
  tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3694
  {
3695
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3696
    SET_H_GR (FLD (f_dest), opval);
3697
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3698
  }
3699
}
3700
 
3701
  return vpc;
3702
#undef FLD
3703
}
3704
 
3705
/* mmulsumwq: mmulsum.wq $rm, $rn, $rd */
3706
 
3707
static SEM_PC
3708
SEM_FN_NAME (sh64_media,mmulsumwq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3709
{
3710
#define FLD(f) abuf->fields.sfmt_add.f
3711
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3712
  int UNUSED written = 0;
3713
  IADDR UNUSED pc = abuf->addr;
3714
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3715
 
3716
{
3717
  DI tmp_acc;
3718
  tmp_acc = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3719
  tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))));
3720
  tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))));
3721
  tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))));
3722
  {
3723
    DI opval = ADDDI (GET_H_GR (FLD (f_dest)), tmp_acc);
3724
    SET_H_GR (FLD (f_dest), opval);
3725
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3726
  }
3727
}
3728
 
3729
  return vpc;
3730
#undef FLD
3731
}
3732
 
3733
/* movi: movi $imm16, $rd */
3734
 
3735
static SEM_PC
3736
SEM_FN_NAME (sh64_media,movi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3737
{
3738
#define FLD(f) abuf->fields.sfmt_movi.f
3739
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3740
  int UNUSED written = 0;
3741
  IADDR UNUSED pc = abuf->addr;
3742
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3743
 
3744
  {
3745
    DI opval = EXTSIDI (FLD (f_imm16));
3746
    SET_H_GR (FLD (f_dest), opval);
3747
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3748
  }
3749
 
3750
  return vpc;
3751
#undef FLD
3752
}
3753
 
3754
/* mpermw: mperm.w $rm, $rn, $rd */
3755
 
3756
static SEM_PC
3757
SEM_FN_NAME (sh64_media,mpermw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3758
{
3759
#define FLD(f) abuf->fields.sfmt_add.f
3760
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3761
  int UNUSED written = 0;
3762
  IADDR UNUSED pc = abuf->addr;
3763
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3764
 
3765
{
3766
  QI tmp_control;
3767
  HI tmp_result3;
3768
  HI tmp_result2;
3769
  HI tmp_result1;
3770
  HI tmp_result0;
3771
  tmp_control = ANDQI (GET_H_GR (FLD (f_right)), 255);
3772
  tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (tmp_control, 3)));
3773
  tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 2), 3)));
3774
  tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 4), 3)));
3775
  tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 6), 3)));
3776
  {
3777
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3778
    SET_H_GR (FLD (f_dest), opval);
3779
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3780
  }
3781
}
3782
 
3783
  return vpc;
3784
#undef FLD
3785
}
3786
 
3787
/* msadubq: msad.ubq $rm, $rn, $rd */
3788
 
3789
static SEM_PC
3790
SEM_FN_NAME (sh64_media,msadubq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3791
{
3792
#define FLD(f) abuf->fields.sfmt_add.f
3793
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3794
  int UNUSED written = 0;
3795
  IADDR UNUSED pc = abuf->addr;
3796
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3797
 
3798
{
3799
  DI tmp_acc;
3800
  tmp_acc = ABSDI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)));
3801
  tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))));
3802
  tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))));
3803
  tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))));
3804
  tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))));
3805
  tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))));
3806
  tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))));
3807
  tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))));
3808
  {
3809
    DI opval = ADDDI (GET_H_GR (FLD (f_dest)), tmp_acc);
3810
    SET_H_GR (FLD (f_dest), opval);
3811
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3812
  }
3813
}
3814
 
3815
  return vpc;
3816
#undef FLD
3817
}
3818
 
3819
/* mshaldsl: mshalds.l $rm, $rn, $rd */
3820
 
3821
static SEM_PC
3822
SEM_FN_NAME (sh64_media,mshaldsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3823
{
3824
#define FLD(f) abuf->fields.sfmt_add.f
3825
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3826
  int UNUSED written = 0;
3827
  IADDR UNUSED pc = abuf->addr;
3828
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3829
 
3830
{
3831
  SI tmp_result1;
3832
  SI tmp_result0;
3833
  tmp_result0 = ((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3834
  tmp_result1 = ((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3835
  {
3836
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3837
    SET_H_GR (FLD (f_dest), opval);
3838
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3839
  }
3840
}
3841
 
3842
  return vpc;
3843
#undef FLD
3844
}
3845
 
3846
/* mshaldsw: mshalds.w $rm, $rn, $rd */
3847
 
3848
static SEM_PC
3849
SEM_FN_NAME (sh64_media,mshaldsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3850
{
3851
#define FLD(f) abuf->fields.sfmt_add.f
3852
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3853
  int UNUSED written = 0;
3854
  IADDR UNUSED pc = abuf->addr;
3855
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3856
 
3857
{
3858
  HI tmp_result3;
3859
  HI tmp_result2;
3860
  HI tmp_result1;
3861
  HI tmp_result0;
3862
  tmp_result0 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3863
  tmp_result1 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3864
  tmp_result2 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3865
  tmp_result3 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3866
  {
3867
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3868
    SET_H_GR (FLD (f_dest), opval);
3869
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3870
  }
3871
}
3872
 
3873
  return vpc;
3874
#undef FLD
3875
}
3876
 
3877
/* mshardl: mshard.l $rm, $rn, $rd */
3878
 
3879
static SEM_PC
3880
SEM_FN_NAME (sh64_media,mshardl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3881
{
3882
#define FLD(f) abuf->fields.sfmt_add.f
3883
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3884
  int UNUSED written = 0;
3885
  IADDR UNUSED pc = abuf->addr;
3886
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3887
 
3888
{
3889
  SI tmp_result1;
3890
  SI tmp_result0;
3891
  tmp_result0 = SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31));
3892
  tmp_result1 = SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31));
3893
  {
3894
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3895
    SET_H_GR (FLD (f_dest), opval);
3896
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3897
  }
3898
}
3899
 
3900
  return vpc;
3901
#undef FLD
3902
}
3903
 
3904
/* mshardw: mshard.w $rm, $rn, $rd */
3905
 
3906
static SEM_PC
3907
SEM_FN_NAME (sh64_media,mshardw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3908
{
3909
#define FLD(f) abuf->fields.sfmt_add.f
3910
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3911
  int UNUSED written = 0;
3912
  IADDR UNUSED pc = abuf->addr;
3913
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3914
 
3915
{
3916
  HI tmp_result3;
3917
  HI tmp_result2;
3918
  HI tmp_result1;
3919
  HI tmp_result0;
3920
  tmp_result0 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15));
3921
  tmp_result1 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15));
3922
  tmp_result2 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15));
3923
  tmp_result3 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15));
3924
  {
3925
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3926
    SET_H_GR (FLD (f_dest), opval);
3927
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3928
  }
3929
}
3930
 
3931
  return vpc;
3932
#undef FLD
3933
}
3934
 
3935
/* mshardsq: mshards.q $rm, $rn, $rd */
3936
 
3937
static SEM_PC
3938
SEM_FN_NAME (sh64_media,mshardsq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3939
{
3940
#define FLD(f) abuf->fields.sfmt_add.f
3941
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3942
  int UNUSED written = 0;
3943
  IADDR UNUSED pc = abuf->addr;
3944
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3945
 
3946
  {
3947
    DI opval = ((LTDI (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGDI (SLLDI (1, SUBSI (16, 1)))) : (((LTDI (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)), SLLDI (1, SUBSI (16, 1)))) ? (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63))) : (SUBDI (SLLDI (1, SUBSI (16, 1)), 1)))));
3948
    SET_H_GR (FLD (f_dest), opval);
3949
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3950
  }
3951
 
3952
  return vpc;
3953
#undef FLD
3954
}
3955
 
3956
/* mshfhib: mshfhi.b $rm, $rn, $rd */
3957
 
3958
static SEM_PC
3959
SEM_FN_NAME (sh64_media,mshfhib) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3960
{
3961
#define FLD(f) abuf->fields.sfmt_add.f
3962
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3963
  int UNUSED written = 0;
3964
  IADDR UNUSED pc = abuf->addr;
3965
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3966
 
3967
{
3968
  QI tmp_result7;
3969
  QI tmp_result6;
3970
  QI tmp_result5;
3971
  QI tmp_result4;
3972
  QI tmp_result3;
3973
  QI tmp_result2;
3974
  QI tmp_result1;
3975
  QI tmp_result0;
3976
  tmp_result0 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3);
3977
  tmp_result1 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3);
3978
  tmp_result2 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2);
3979
  tmp_result3 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2);
3980
  tmp_result4 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1);
3981
  tmp_result5 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1);
3982
  tmp_result6 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0);
3983
  tmp_result7 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0);
3984
  {
3985
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3986
    SET_H_GR (FLD (f_dest), opval);
3987
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3988
  }
3989
}
3990
 
3991
  return vpc;
3992
#undef FLD
3993
}
3994
 
3995
/* mshfhil: mshfhi.l $rm, $rn, $rd */
3996
 
3997
static SEM_PC
3998
SEM_FN_NAME (sh64_media,mshfhil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3999
{
4000
#define FLD(f) abuf->fields.sfmt_add.f
4001
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4002
  int UNUSED written = 0;
4003
  IADDR UNUSED pc = abuf->addr;
4004
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4005
 
4006
{
4007
  SI tmp_result1;
4008
  SI tmp_result0;
4009
  tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_left)), 0);
4010
  tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_right)), 0);
4011
  {
4012
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4013
    SET_H_GR (FLD (f_dest), opval);
4014
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4015
  }
4016
}
4017
 
4018
  return vpc;
4019
#undef FLD
4020
}
4021
 
4022
/* mshfhiw: mshfhi.w $rm, $rn, $rd */
4023
 
4024
static SEM_PC
4025
SEM_FN_NAME (sh64_media,mshfhiw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4026
{
4027
#define FLD(f) abuf->fields.sfmt_add.f
4028
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4029
  int UNUSED written = 0;
4030
  IADDR UNUSED pc = abuf->addr;
4031
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4032
 
4033
{
4034
  HI tmp_result3;
4035
  HI tmp_result2;
4036
  HI tmp_result1;
4037
  HI tmp_result0;
4038
  tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1);
4039
  tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1);
4040
  tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0);
4041
  tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0);
4042
  {
4043
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4044
    SET_H_GR (FLD (f_dest), opval);
4045
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4046
  }
4047
}
4048
 
4049
  return vpc;
4050
#undef FLD
4051
}
4052
 
4053
/* mshflob: mshflo.b $rm, $rn, $rd */
4054
 
4055
static SEM_PC
4056
SEM_FN_NAME (sh64_media,mshflob) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4057
{
4058
#define FLD(f) abuf->fields.sfmt_add.f
4059
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4060
  int UNUSED written = 0;
4061
  IADDR UNUSED pc = abuf->addr;
4062
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4063
 
4064
{
4065
  QI tmp_result7;
4066
  QI tmp_result6;
4067
  QI tmp_result5;
4068
  QI tmp_result4;
4069
  QI tmp_result3;
4070
  QI tmp_result2;
4071
  QI tmp_result1;
4072
  QI tmp_result0;
4073
  tmp_result0 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7);
4074
  tmp_result1 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7);
4075
  tmp_result2 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6);
4076
  tmp_result3 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6);
4077
  tmp_result4 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5);
4078
  tmp_result5 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5);
4079
  tmp_result6 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4);
4080
  tmp_result7 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4);
4081
  {
4082
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
4083
    SET_H_GR (FLD (f_dest), opval);
4084
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4085
  }
4086
}
4087
 
4088
  return vpc;
4089
#undef FLD
4090
}
4091
 
4092
/* mshflol: mshflo.l $rm, $rn, $rd */
4093
 
4094
static SEM_PC
4095
SEM_FN_NAME (sh64_media,mshflol) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4096
{
4097
#define FLD(f) abuf->fields.sfmt_add.f
4098
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4099
  int UNUSED written = 0;
4100
  IADDR UNUSED pc = abuf->addr;
4101
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4102
 
4103
{
4104
  SI tmp_result1;
4105
  SI tmp_result0;
4106
  tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_left)), 1);
4107
  tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_right)), 1);
4108
  {
4109
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4110
    SET_H_GR (FLD (f_dest), opval);
4111
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4112
  }
4113
}
4114
 
4115
  return vpc;
4116
#undef FLD
4117
}
4118
 
4119
/* mshflow: mshflo.w $rm, $rn, $rd */
4120
 
4121
static SEM_PC
4122
SEM_FN_NAME (sh64_media,mshflow) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4123
{
4124
#define FLD(f) abuf->fields.sfmt_add.f
4125
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4126
  int UNUSED written = 0;
4127
  IADDR UNUSED pc = abuf->addr;
4128
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4129
 
4130
{
4131
  HI tmp_result3;
4132
  HI tmp_result2;
4133
  HI tmp_result1;
4134
  HI tmp_result0;
4135
  tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3);
4136
  tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3);
4137
  tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2);
4138
  tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2);
4139
  {
4140
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4141
    SET_H_GR (FLD (f_dest), opval);
4142
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4143
  }
4144
}
4145
 
4146
  return vpc;
4147
#undef FLD
4148
}
4149
 
4150
/* mshlldl: mshlld.l $rm, $rn, $rd */
4151
 
4152
static SEM_PC
4153
SEM_FN_NAME (sh64_media,mshlldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4154
{
4155
#define FLD(f) abuf->fields.sfmt_add.f
4156
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4157
  int UNUSED written = 0;
4158
  IADDR UNUSED pc = abuf->addr;
4159
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4160
 
4161
{
4162
  SI tmp_result1;
4163
  SI tmp_result0;
4164
  tmp_result0 = SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31));
4165
  tmp_result1 = SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31));
4166
  {
4167
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4168
    SET_H_GR (FLD (f_dest), opval);
4169
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4170
  }
4171
}
4172
 
4173
  return vpc;
4174
#undef FLD
4175
}
4176
 
4177
/* mshlldw: mshlld.w $rm, $rn, $rd */
4178
 
4179
static SEM_PC
4180
SEM_FN_NAME (sh64_media,mshlldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4181
{
4182
#define FLD(f) abuf->fields.sfmt_add.f
4183
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4184
  int UNUSED written = 0;
4185
  IADDR UNUSED pc = abuf->addr;
4186
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4187
 
4188
{
4189
  HI tmp_result3;
4190
  HI tmp_result2;
4191
  HI tmp_result1;
4192
  HI tmp_result0;
4193
  tmp_result0 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15));
4194
  tmp_result1 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15));
4195
  tmp_result2 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15));
4196
  tmp_result3 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15));
4197
  {
4198
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4199
    SET_H_GR (FLD (f_dest), opval);
4200
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4201
  }
4202
}
4203
 
4204
  return vpc;
4205
#undef FLD
4206
}
4207
 
4208
/* mshlrdl: mshlrd.l $rm, $rn, $rd */
4209
 
4210
static SEM_PC
4211
SEM_FN_NAME (sh64_media,mshlrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4212
{
4213
#define FLD(f) abuf->fields.sfmt_add.f
4214
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4215
  int UNUSED written = 0;
4216
  IADDR UNUSED pc = abuf->addr;
4217
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4218
 
4219
{
4220
  SI tmp_result1;
4221
  SI tmp_result0;
4222
  tmp_result0 = SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31));
4223
  tmp_result1 = SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31));
4224
  {
4225
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4226
    SET_H_GR (FLD (f_dest), opval);
4227
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4228
  }
4229
}
4230
 
4231
  return vpc;
4232
#undef FLD
4233
}
4234
 
4235
/* mshlrdw: mshlrd.w $rm, $rn, $rd */
4236
 
4237
static SEM_PC
4238
SEM_FN_NAME (sh64_media,mshlrdw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4239
{
4240
#define FLD(f) abuf->fields.sfmt_add.f
4241
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4242
  int UNUSED written = 0;
4243
  IADDR UNUSED pc = abuf->addr;
4244
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4245
 
4246
{
4247
  HI tmp_result3;
4248
  HI tmp_result2;
4249
  HI tmp_result1;
4250
  HI tmp_result0;
4251
  tmp_result0 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15));
4252
  tmp_result1 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15));
4253
  tmp_result2 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15));
4254
  tmp_result3 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15));
4255
  {
4256
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4257
    SET_H_GR (FLD (f_dest), opval);
4258
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4259
  }
4260
}
4261
 
4262
  return vpc;
4263
#undef FLD
4264
}
4265
 
4266
/* msubl: msub.l $rm, $rn, $rd */
4267
 
4268
static SEM_PC
4269
SEM_FN_NAME (sh64_media,msubl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4270
{
4271
#define FLD(f) abuf->fields.sfmt_add.f
4272
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4273
  int UNUSED written = 0;
4274
  IADDR UNUSED pc = abuf->addr;
4275
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4276
 
4277
{
4278
  SI tmp_result1;
4279
  SI tmp_result0;
4280
  tmp_result0 = SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
4281
  tmp_result1 = SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0));
4282
  {
4283
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4284
    SET_H_GR (FLD (f_dest), opval);
4285
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4286
  }
4287
}
4288
 
4289
  return vpc;
4290
#undef FLD
4291
}
4292
 
4293
/* msubw: msub.w $rm, $rn, $rd */
4294
 
4295
static SEM_PC
4296
SEM_FN_NAME (sh64_media,msubw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4297
{
4298
#define FLD(f) abuf->fields.sfmt_add.f
4299
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4300
  int UNUSED written = 0;
4301
  IADDR UNUSED pc = abuf->addr;
4302
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4303
 
4304
{
4305
  HI tmp_result3;
4306
  HI tmp_result2;
4307
  HI tmp_result1;
4308
  HI tmp_result0;
4309
  tmp_result0 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3));
4310
  tmp_result1 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2));
4311
  tmp_result2 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1));
4312
  tmp_result3 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0));
4313
  {
4314
    DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4315
    SET_H_GR (FLD (f_dest), opval);
4316
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4317
  }
4318
}
4319
 
4320
  return vpc;
4321
#undef FLD
4322
}
4323
 
4324
/* msubsl: msubs.l $rm, $rn, $rd */
4325
 
4326
static SEM_PC
4327
SEM_FN_NAME (sh64_media,msubsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4328
{
4329
#define FLD(f) abuf->fields.sfmt_add.f
4330
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4331
  int UNUSED written = 0;
4332
  IADDR UNUSED pc = abuf->addr;
4333
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4334
 
4335
{
4336
  SI tmp_result1;
4337
  SI tmp_result0;
4338
  tmp_result0 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4339
  tmp_result1 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4340
  {
4341
    DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4342
    SET_H_GR (FLD (f_dest), opval);
4343
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4344
  }
4345
}
4346
 
4347
  return vpc;
4348
#undef FLD
4349
}
4350
 
4351
/* msubsub: msubs.ub $rm, $rn, $rd */
4352
 
4353
static SEM_PC
4354
SEM_FN_NAME (sh64_media,msubsub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4355
{
4356
#define FLD(f) abuf->fields.sfmt_add.f
4357
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4358
  int UNUSED written = 0;
4359
  IADDR UNUSED pc = abuf->addr;
4360
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4361
 
4362
{
4363
  QI tmp_result7;
4364
  QI tmp_result6;
4365
  QI tmp_result5;
4366
  QI tmp_result4;
4367
  QI tmp_result3;
4368
  QI tmp_result2;
4369
  QI tmp_result1;
4370
  QI tmp_result0;
4371
  tmp_result0 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1)))));
4372
  tmp_result1 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1)))));
4373
  tmp_result2 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1)))));
4374
  tmp_result3 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1)))));
4375
  tmp_result4 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1)))));
4376
  tmp_result5 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1)))));
4377
  tmp_result6 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1)))));
4378
  tmp_result7 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1)))));
4379
  {
4380
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
4381
    SET_H_GR (FLD (f_dest), opval);
4382
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4383
  }
4384
}
4385
 
4386
  return vpc;
4387
#undef FLD
4388
}
4389
 
4390
/* msubsw: msubs.w $rm, $rn, $rd */
4391
 
4392
static SEM_PC
4393
SEM_FN_NAME (sh64_media,msubsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4394
{
4395
#define FLD(f) abuf->fields.sfmt_add.f
4396
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4397
  int UNUSED written = 0;
4398
  IADDR UNUSED pc = abuf->addr;
4399
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4400
 
4401
{
4402
  QI tmp_result7;
4403
  QI tmp_result6;
4404
  QI tmp_result5;
4405
  QI tmp_result4;
4406
  QI tmp_result3;
4407
  QI tmp_result2;
4408
  QI tmp_result1;
4409
  QI tmp_result0;
4410
  tmp_result0 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4411
  tmp_result1 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4412
  tmp_result2 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4413
  tmp_result3 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4414
  tmp_result4 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4415
  tmp_result5 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4416
  tmp_result6 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4417
  tmp_result7 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4418
  {
4419
    DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
4420
    SET_H_GR (FLD (f_dest), opval);
4421
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4422
  }
4423
}
4424
 
4425
  return vpc;
4426
#undef FLD
4427
}
4428
 
4429
/* mulsl: muls.l $rm, $rn, $rd */
4430
 
4431
static SEM_PC
4432
SEM_FN_NAME (sh64_media,mulsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4433
{
4434
#define FLD(f) abuf->fields.sfmt_add.f
4435
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4436
  int UNUSED written = 0;
4437
  IADDR UNUSED pc = abuf->addr;
4438
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4439
 
4440
  {
4441
    DI opval = MULDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
4442
    SET_H_GR (FLD (f_dest), opval);
4443
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4444
  }
4445
 
4446
  return vpc;
4447
#undef FLD
4448
}
4449
 
4450
/* mulul: mulu.l $rm, $rn, $rd */
4451
 
4452
static SEM_PC
4453
SEM_FN_NAME (sh64_media,mulul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4454
{
4455
#define FLD(f) abuf->fields.sfmt_add.f
4456
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4457
  int UNUSED written = 0;
4458
  IADDR UNUSED pc = abuf->addr;
4459
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4460
 
4461
  {
4462
    DI opval = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
4463
    SET_H_GR (FLD (f_dest), opval);
4464
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4465
  }
4466
 
4467
  return vpc;
4468
#undef FLD
4469
}
4470
 
4471
/* nop: nop */
4472
 
4473
static SEM_PC
4474
SEM_FN_NAME (sh64_media,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4475
{
4476
#define FLD(f) abuf->fields.fmt_empty.f
4477
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4478
  int UNUSED written = 0;
4479
  IADDR UNUSED pc = abuf->addr;
4480
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4481
 
4482
((void) 0); /*nop*/
4483
 
4484
  return vpc;
4485
#undef FLD
4486
}
4487
 
4488
/* nsb: nsb $rm, $rd */
4489
 
4490
static SEM_PC
4491
SEM_FN_NAME (sh64_media,nsb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4492
{
4493
#define FLD(f) abuf->fields.sfmt_xori.f
4494
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4495
  int UNUSED written = 0;
4496
  IADDR UNUSED pc = abuf->addr;
4497
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4498
 
4499
  {
4500
    DI opval = sh64_nsb (current_cpu, GET_H_GR (FLD (f_left)));
4501
    SET_H_GR (FLD (f_dest), opval);
4502
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4503
  }
4504
 
4505
  return vpc;
4506
#undef FLD
4507
}
4508
 
4509
/* ocbi: ocbi $rm, $disp6x32 */
4510
 
4511
static SEM_PC
4512
SEM_FN_NAME (sh64_media,ocbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4513
{
4514
#define FLD(f) abuf->fields.sfmt_xori.f
4515
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4516
  int UNUSED written = 0;
4517
  IADDR UNUSED pc = abuf->addr;
4518
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4519
 
4520
{
4521
  {
4522
    DI opval = GET_H_GR (FLD (f_left));
4523
    SET_H_GR (FLD (f_left), opval);
4524
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4525
  }
4526
((void) 0); /*nop*/
4527
}
4528
 
4529
  return vpc;
4530
#undef FLD
4531
}
4532
 
4533
/* ocbp: ocbp $rm, $disp6x32 */
4534
 
4535
static SEM_PC
4536
SEM_FN_NAME (sh64_media,ocbp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4537
{
4538
#define FLD(f) abuf->fields.sfmt_xori.f
4539
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4540
  int UNUSED written = 0;
4541
  IADDR UNUSED pc = abuf->addr;
4542
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4543
 
4544
{
4545
  {
4546
    DI opval = GET_H_GR (FLD (f_left));
4547
    SET_H_GR (FLD (f_left), opval);
4548
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4549
  }
4550
((void) 0); /*nop*/
4551
}
4552
 
4553
  return vpc;
4554
#undef FLD
4555
}
4556
 
4557
/* ocbwb: ocbwb $rm, $disp6x32 */
4558
 
4559
static SEM_PC
4560
SEM_FN_NAME (sh64_media,ocbwb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4561
{
4562
#define FLD(f) abuf->fields.sfmt_xori.f
4563
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4564
  int UNUSED written = 0;
4565
  IADDR UNUSED pc = abuf->addr;
4566
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4567
 
4568
{
4569
  {
4570
    DI opval = GET_H_GR (FLD (f_left));
4571
    SET_H_GR (FLD (f_left), opval);
4572
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4573
  }
4574
((void) 0); /*nop*/
4575
}
4576
 
4577
  return vpc;
4578
#undef FLD
4579
}
4580
 
4581
/* or: or $rm, $rn, $rd */
4582
 
4583
static SEM_PC
4584
SEM_FN_NAME (sh64_media,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4585
{
4586
#define FLD(f) abuf->fields.sfmt_add.f
4587
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4588
  int UNUSED written = 0;
4589
  IADDR UNUSED pc = abuf->addr;
4590
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4591
 
4592
  {
4593
    DI opval = ORDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
4594
    SET_H_GR (FLD (f_dest), opval);
4595
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4596
  }
4597
 
4598
  return vpc;
4599
#undef FLD
4600
}
4601
 
4602
/* ori: ori $rm, $imm10, $rd */
4603
 
4604
static SEM_PC
4605
SEM_FN_NAME (sh64_media,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4606
{
4607
#define FLD(f) abuf->fields.sfmt_ori.f
4608
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4609
  int UNUSED written = 0;
4610
  IADDR UNUSED pc = abuf->addr;
4611
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4612
 
4613
  {
4614
    DI opval = ORDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm10)));
4615
    SET_H_GR (FLD (f_dest), opval);
4616
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4617
  }
4618
 
4619
  return vpc;
4620
#undef FLD
4621
}
4622
 
4623
/* prefi: prefi $rm, $disp6x32 */
4624
 
4625
static SEM_PC
4626
SEM_FN_NAME (sh64_media,prefi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4627
{
4628
#define FLD(f) abuf->fields.sfmt_xori.f
4629
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4630
  int UNUSED written = 0;
4631
  IADDR UNUSED pc = abuf->addr;
4632
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4633
 
4634
{
4635
  {
4636
    DI opval = GET_H_GR (FLD (f_left));
4637
    SET_H_GR (FLD (f_left), opval);
4638
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4639
  }
4640
((void) 0); /*nop*/
4641
}
4642
 
4643
  return vpc;
4644
#undef FLD
4645
}
4646
 
4647
/* pta: pta$likely $disp16, $tra */
4648
 
4649
static SEM_PC
4650
SEM_FN_NAME (sh64_media,pta) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4651
{
4652
#define FLD(f) abuf->fields.sfmt_pta.f
4653
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4654
  int UNUSED written = 0;
4655
  IADDR UNUSED pc = abuf->addr;
4656
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4657
 
4658
{
4659
((void) 0); /*nop*/
4660
  {
4661
    DI opval = ADDSI (FLD (f_disp16), 1);
4662
    CPU (h_tr[FLD (f_tra)]) = opval;
4663
    TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4664
  }
4665
}
4666
 
4667
  return vpc;
4668
#undef FLD
4669
}
4670
 
4671
/* ptabs: ptabs$likely $rn, $tra */
4672
 
4673
static SEM_PC
4674
SEM_FN_NAME (sh64_media,ptabs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4675
{
4676
#define FLD(f) abuf->fields.sfmt_beq.f
4677
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4678
  int UNUSED written = 0;
4679
  IADDR UNUSED pc = abuf->addr;
4680
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4681
 
4682
{
4683
((void) 0); /*nop*/
4684
  {
4685
    DI opval = GET_H_GR (FLD (f_right));
4686
    CPU (h_tr[FLD (f_tra)]) = opval;
4687
    TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4688
  }
4689
}
4690
 
4691
  return vpc;
4692
#undef FLD
4693
}
4694
 
4695
/* ptb: ptb$likely $disp16, $tra */
4696
 
4697
static SEM_PC
4698
SEM_FN_NAME (sh64_media,ptb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4699
{
4700
#define FLD(f) abuf->fields.sfmt_pta.f
4701
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4702
  int UNUSED written = 0;
4703
  IADDR UNUSED pc = abuf->addr;
4704
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4705
 
4706
{
4707
((void) 0); /*nop*/
4708
  {
4709
    DI opval = FLD (f_disp16);
4710
    CPU (h_tr[FLD (f_tra)]) = opval;
4711
    TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4712
  }
4713
}
4714
 
4715
  return vpc;
4716
#undef FLD
4717
}
4718
 
4719
/* ptrel: ptrel$likely $rn, $tra */
4720
 
4721
static SEM_PC
4722
SEM_FN_NAME (sh64_media,ptrel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4723
{
4724
#define FLD(f) abuf->fields.sfmt_beq.f
4725
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4726
  int UNUSED written = 0;
4727
  IADDR UNUSED pc = abuf->addr;
4728
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4729
 
4730
{
4731
((void) 0); /*nop*/
4732
  {
4733
    DI opval = ADDDI (pc, GET_H_GR (FLD (f_right)));
4734
    CPU (h_tr[FLD (f_tra)]) = opval;
4735
    TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4736
  }
4737
}
4738
 
4739
  return vpc;
4740
#undef FLD
4741
}
4742
 
4743
/* putcfg: putcfg $rm, $disp6, $rd */
4744
 
4745
static SEM_PC
4746
SEM_FN_NAME (sh64_media,putcfg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4747
{
4748
#define FLD(f) abuf->fields.sfmt_getcfg.f
4749
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4750
  int UNUSED written = 0;
4751
  IADDR UNUSED pc = abuf->addr;
4752
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4753
 
4754
{
4755
  SI tmp_address;
4756
  tmp_address = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
4757
((void) 0); /*nop*/
4758
  {
4759
    SI opval = GET_H_GR (FLD (f_dest));
4760
    SETMEMSI (current_cpu, pc, tmp_address, opval);
4761
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4762
  }
4763
}
4764
 
4765
  return vpc;
4766
#undef FLD
4767
}
4768
 
4769
/* putcon: putcon $rm, $crj */
4770
 
4771
static SEM_PC
4772
SEM_FN_NAME (sh64_media,putcon) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4773
{
4774
#define FLD(f) abuf->fields.sfmt_xori.f
4775
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4776
  int UNUSED written = 0;
4777
  IADDR UNUSED pc = abuf->addr;
4778
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4779
 
4780
  {
4781
    DI opval = GET_H_GR (FLD (f_left));
4782
    SET_H_CR (FLD (f_dest), opval);
4783
    TRACE_RESULT (current_cpu, abuf, "cr", 'D', opval);
4784
  }
4785
 
4786
  return vpc;
4787
#undef FLD
4788
}
4789
 
4790
/* rte: rte */
4791
 
4792
static SEM_PC
4793
SEM_FN_NAME (sh64_media,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4794
{
4795
#define FLD(f) abuf->fields.fmt_empty.f
4796
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4797
  int UNUSED written = 0;
4798
  IADDR UNUSED pc = abuf->addr;
4799
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4800
 
4801
((void) 0); /*nop*/
4802
 
4803
  return vpc;
4804
#undef FLD
4805
}
4806
 
4807
/* shard: shard $rm, $rn, $rd */
4808
 
4809
static SEM_PC
4810
SEM_FN_NAME (sh64_media,shard) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4811
{
4812
#define FLD(f) abuf->fields.sfmt_add.f
4813
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4814
  int UNUSED written = 0;
4815
  IADDR UNUSED pc = abuf->addr;
4816
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4817
 
4818
  {
4819
    DI opval = SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63));
4820
    SET_H_GR (FLD (f_dest), opval);
4821
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4822
  }
4823
 
4824
  return vpc;
4825
#undef FLD
4826
}
4827
 
4828
/* shardl: shard.l $rm, $rn, $rd */
4829
 
4830
static SEM_PC
4831
SEM_FN_NAME (sh64_media,shardl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4832
{
4833
#define FLD(f) abuf->fields.sfmt_add.f
4834
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4835
  int UNUSED written = 0;
4836
  IADDR UNUSED pc = abuf->addr;
4837
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4838
 
4839
  {
4840
    DI opval = EXTSIDI (SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63)));
4841
    SET_H_GR (FLD (f_dest), opval);
4842
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4843
  }
4844
 
4845
  return vpc;
4846
#undef FLD
4847
}
4848
 
4849
/* shari: shari $rm, $uimm6, $rd */
4850
 
4851
static SEM_PC
4852
SEM_FN_NAME (sh64_media,shari) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4853
{
4854
#define FLD(f) abuf->fields.sfmt_shari.f
4855
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4856
  int UNUSED written = 0;
4857
  IADDR UNUSED pc = abuf->addr;
4858
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4859
 
4860
  {
4861
    DI opval = SRADI (GET_H_GR (FLD (f_left)), FLD (f_uimm6));
4862
    SET_H_GR (FLD (f_dest), opval);
4863
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4864
  }
4865
 
4866
  return vpc;
4867
#undef FLD
4868
}
4869
 
4870
/* sharil: shari.l $rm, $uimm6, $rd */
4871
 
4872
static SEM_PC
4873
SEM_FN_NAME (sh64_media,sharil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4874
{
4875
#define FLD(f) abuf->fields.sfmt_shari.f
4876
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4877
  int UNUSED written = 0;
4878
  IADDR UNUSED pc = abuf->addr;
4879
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4880
 
4881
  {
4882
    DI opval = EXTSIDI (SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
4883
    SET_H_GR (FLD (f_dest), opval);
4884
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4885
  }
4886
 
4887
  return vpc;
4888
#undef FLD
4889
}
4890
 
4891
/* shlld: shlld $rm, $rn, $rd */
4892
 
4893
static SEM_PC
4894
SEM_FN_NAME (sh64_media,shlld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4895
{
4896
#define FLD(f) abuf->fields.sfmt_add.f
4897
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4898
  int UNUSED written = 0;
4899
  IADDR UNUSED pc = abuf->addr;
4900
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4901
 
4902
  {
4903
    DI opval = SLLDI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63));
4904
    SET_H_GR (FLD (f_dest), opval);
4905
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4906
  }
4907
 
4908
  return vpc;
4909
#undef FLD
4910
}
4911
 
4912
/* shlldl: shlld.l $rm, $rn, $rd */
4913
 
4914
static SEM_PC
4915
SEM_FN_NAME (sh64_media,shlldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4916
{
4917
#define FLD(f) abuf->fields.sfmt_add.f
4918
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4919
  int UNUSED written = 0;
4920
  IADDR UNUSED pc = abuf->addr;
4921
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4922
 
4923
  {
4924
    DI opval = EXTSIDI (SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63)));
4925
    SET_H_GR (FLD (f_dest), opval);
4926
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4927
  }
4928
 
4929
  return vpc;
4930
#undef FLD
4931
}
4932
 
4933
/* shlli: shlli $rm, $uimm6, $rd */
4934
 
4935
static SEM_PC
4936
SEM_FN_NAME (sh64_media,shlli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4937
{
4938
#define FLD(f) abuf->fields.sfmt_shari.f
4939
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4940
  int UNUSED written = 0;
4941
  IADDR UNUSED pc = abuf->addr;
4942
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4943
 
4944
  {
4945
    DI opval = SLLDI (GET_H_GR (FLD (f_left)), FLD (f_uimm6));
4946
    SET_H_GR (FLD (f_dest), opval);
4947
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4948
  }
4949
 
4950
  return vpc;
4951
#undef FLD
4952
}
4953
 
4954
/* shllil: shlli.l $rm, $uimm6, $rd */
4955
 
4956
static SEM_PC
4957
SEM_FN_NAME (sh64_media,shllil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4958
{
4959
#define FLD(f) abuf->fields.sfmt_shari.f
4960
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4961
  int UNUSED written = 0;
4962
  IADDR UNUSED pc = abuf->addr;
4963
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4964
 
4965
  {
4966
    DI opval = EXTSIDI (SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
4967
    SET_H_GR (FLD (f_dest), opval);
4968
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4969
  }
4970
 
4971
  return vpc;
4972
#undef FLD
4973
}
4974
 
4975
/* shlrd: shlrd $rm, $rn, $rd */
4976
 
4977
static SEM_PC
4978
SEM_FN_NAME (sh64_media,shlrd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4979
{
4980
#define FLD(f) abuf->fields.sfmt_add.f
4981
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4982
  int UNUSED written = 0;
4983
  IADDR UNUSED pc = abuf->addr;
4984
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4985
 
4986
  {
4987
    DI opval = SRLDI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63));
4988
    SET_H_GR (FLD (f_dest), opval);
4989
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4990
  }
4991
 
4992
  return vpc;
4993
#undef FLD
4994
}
4995
 
4996
/* shlrdl: shlrd.l $rm, $rn, $rd */
4997
 
4998
static SEM_PC
4999
SEM_FN_NAME (sh64_media,shlrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5000
{
5001
#define FLD(f) abuf->fields.sfmt_add.f
5002
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5003
  int UNUSED written = 0;
5004
  IADDR UNUSED pc = abuf->addr;
5005
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5006
 
5007
  {
5008
    DI opval = EXTSIDI (SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63)));
5009
    SET_H_GR (FLD (f_dest), opval);
5010
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5011
  }
5012
 
5013
  return vpc;
5014
#undef FLD
5015
}
5016
 
5017
/* shlri: shlri $rm, $uimm6, $rd */
5018
 
5019
static SEM_PC
5020
SEM_FN_NAME (sh64_media,shlri) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5021
{
5022
#define FLD(f) abuf->fields.sfmt_shari.f
5023
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5024
  int UNUSED written = 0;
5025
  IADDR UNUSED pc = abuf->addr;
5026
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5027
 
5028
  {
5029
    DI opval = SRLDI (GET_H_GR (FLD (f_left)), FLD (f_uimm6));
5030
    SET_H_GR (FLD (f_dest), opval);
5031
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5032
  }
5033
 
5034
  return vpc;
5035
#undef FLD
5036
}
5037
 
5038
/* shlril: shlri.l $rm, $uimm6, $rd */
5039
 
5040
static SEM_PC
5041
SEM_FN_NAME (sh64_media,shlril) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5042
{
5043
#define FLD(f) abuf->fields.sfmt_shari.f
5044
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5045
  int UNUSED written = 0;
5046
  IADDR UNUSED pc = abuf->addr;
5047
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5048
 
5049
  {
5050
    DI opval = EXTSIDI (SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
5051
    SET_H_GR (FLD (f_dest), opval);
5052
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5053
  }
5054
 
5055
  return vpc;
5056
#undef FLD
5057
}
5058
 
5059
/* shori: shori $uimm16, $rd */
5060
 
5061
static SEM_PC
5062
SEM_FN_NAME (sh64_media,shori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5063
{
5064
#define FLD(f) abuf->fields.sfmt_shori.f
5065
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5066
  int UNUSED written = 0;
5067
  IADDR UNUSED pc = abuf->addr;
5068
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5069
 
5070
  {
5071
    DI opval = ORDI (SLLDI (GET_H_GR (FLD (f_dest)), 16), ZEXTSIDI (FLD (f_uimm16)));
5072
    SET_H_GR (FLD (f_dest), opval);
5073
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5074
  }
5075
 
5076
  return vpc;
5077
#undef FLD
5078
}
5079
 
5080
/* sleep: sleep */
5081
 
5082
static SEM_PC
5083
SEM_FN_NAME (sh64_media,sleep) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5084
{
5085
#define FLD(f) abuf->fields.fmt_empty.f
5086
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5087
  int UNUSED written = 0;
5088
  IADDR UNUSED pc = abuf->addr;
5089
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5090
 
5091
((void) 0); /*nop*/
5092
 
5093
  return vpc;
5094
#undef FLD
5095
}
5096
 
5097
/* stb: st.b $rm, $disp10, $rd */
5098
 
5099
static SEM_PC
5100
SEM_FN_NAME (sh64_media,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5101
{
5102
#define FLD(f) abuf->fields.sfmt_addi.f
5103
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5104
  int UNUSED written = 0;
5105
  IADDR UNUSED pc = abuf->addr;
5106
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5107
 
5108
  {
5109
    UQI opval = ANDQI (GET_H_GR (FLD (f_dest)), 255);
5110
    SETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10))), opval);
5111
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5112
  }
5113
 
5114
  return vpc;
5115
#undef FLD
5116
}
5117
 
5118
/* stl: st.l $rm, $disp10x4, $rd */
5119
 
5120
static SEM_PC
5121
SEM_FN_NAME (sh64_media,stl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5122
{
5123
#define FLD(f) abuf->fields.sfmt_flds.f
5124
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5125
  int UNUSED written = 0;
5126
  IADDR UNUSED pc = abuf->addr;
5127
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5128
 
5129
  {
5130
    SI opval = ANDSI (GET_H_GR (FLD (f_dest)), 0xffffffff);
5131
    SETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x4))), opval);
5132
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5133
  }
5134
 
5135
  return vpc;
5136
#undef FLD
5137
}
5138
 
5139
/* stq: st.q $rm, $disp10x8, $rd */
5140
 
5141
static SEM_PC
5142
SEM_FN_NAME (sh64_media,stq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5143
{
5144
#define FLD(f) abuf->fields.sfmt_fldd.f
5145
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5146
  int UNUSED written = 0;
5147
  IADDR UNUSED pc = abuf->addr;
5148
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5149
 
5150
  {
5151
    DI opval = GET_H_GR (FLD (f_dest));
5152
    SETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))), opval);
5153
    TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5154
  }
5155
 
5156
  return vpc;
5157
#undef FLD
5158
}
5159
 
5160
/* stw: st.w $rm, $disp10x2, $rd */
5161
 
5162
static SEM_PC
5163
SEM_FN_NAME (sh64_media,stw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5164
{
5165
#define FLD(f) abuf->fields.sfmt_lduw.f
5166
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5167
  int UNUSED written = 0;
5168
  IADDR UNUSED pc = abuf->addr;
5169
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5170
 
5171
  {
5172
    HI opval = ANDHI (GET_H_GR (FLD (f_dest)), 65535);
5173
    SETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2))), opval);
5174
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5175
  }
5176
 
5177
  return vpc;
5178
#undef FLD
5179
}
5180
 
5181
/* sthil: sthi.l $rm, $disp6, $rd */
5182
 
5183
static SEM_PC
5184
SEM_FN_NAME (sh64_media,sthil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5185
{
5186
#define FLD(f) abuf->fields.sfmt_getcfg.f
5187
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5188
  int UNUSED written = 0;
5189
  IADDR UNUSED pc = abuf->addr;
5190
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5191
 
5192
{
5193
  DI tmp_addr;
5194
  QI tmp_bytecount;
5195
  DI tmp_val;
5196
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5197
  tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1);
5198
if (ANDQI (tmp_bytecount, 4)) {
5199
  {
5200
    SI opval = GET_H_GR (FLD (f_dest));
5201
    SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5202
    written |= (1 << 5);
5203
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5204
  }
5205
} else {
5206
if (GET_H_ENDIAN ()) {
5207
{
5208
  tmp_val = GET_H_GR (FLD (f_dest));
5209
if (ANDQI (tmp_bytecount, 1)) {
5210
{
5211
  {
5212
    UQI opval = ANDQI (tmp_val, 255);
5213
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5214
    written |= (1 << 6);
5215
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5216
  }
5217
  tmp_val = SRLDI (tmp_val, 8);
5218
}
5219
}
5220
if (ANDQI (tmp_bytecount, 2)) {
5221
{
5222
  {
5223
    HI opval = ANDHI (tmp_val, 65535);
5224
    SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5225
    written |= (1 << 4);
5226
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5227
  }
5228
  tmp_val = SRLDI (tmp_val, 16);
5229
}
5230
}
5231
}
5232
} else {
5233
{
5234
  tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount)));
5235
if (ANDQI (tmp_bytecount, 2)) {
5236
{
5237
  {
5238
    HI opval = ANDHI (tmp_val, 65535);
5239
    SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5240
    written |= (1 << 4);
5241
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5242
  }
5243
  tmp_val = SRLDI (tmp_val, 16);
5244
}
5245
}
5246
if (ANDQI (tmp_bytecount, 1)) {
5247
{
5248
  {
5249
    UQI opval = ANDQI (tmp_val, 255);
5250
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5251
    written |= (1 << 6);
5252
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5253
  }
5254
  tmp_val = SRLDI (tmp_val, 8);
5255
}
5256
}
5257
}
5258
}
5259
}
5260
}
5261
 
5262
  abuf->written = written;
5263
  return vpc;
5264
#undef FLD
5265
}
5266
 
5267
/* sthiq: sthi.q $rm, $disp6, $rd */
5268
 
5269
static SEM_PC
5270
SEM_FN_NAME (sh64_media,sthiq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5271
{
5272
#define FLD(f) abuf->fields.sfmt_getcfg.f
5273
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5274
  int UNUSED written = 0;
5275
  IADDR UNUSED pc = abuf->addr;
5276
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5277
 
5278
{
5279
  DI tmp_addr;
5280
  QI tmp_bytecount;
5281
  DI tmp_val;
5282
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5283
  tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1);
5284
if (ANDQI (tmp_bytecount, 8)) {
5285
  {
5286
    DI opval = GET_H_GR (FLD (f_dest));
5287
    SETMEMDI (current_cpu, pc, ANDDI (tmp_addr, -8), opval);
5288
    written |= (1 << 4);
5289
    TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5290
  }
5291
} else {
5292
if (GET_H_ENDIAN ()) {
5293
{
5294
  tmp_val = GET_H_GR (FLD (f_dest));
5295
if (ANDQI (tmp_bytecount, 1)) {
5296
{
5297
  {
5298
    UQI opval = ANDQI (tmp_val, 255);
5299
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5300
    written |= (1 << 7);
5301
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5302
  }
5303
  tmp_val = SRLDI (tmp_val, 8);
5304
}
5305
}
5306
if (ANDQI (tmp_bytecount, 2)) {
5307
{
5308
  {
5309
    HI opval = ANDHI (tmp_val, 65535);
5310
    SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5311
    written |= (1 << 5);
5312
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5313
  }
5314
  tmp_val = SRLDI (tmp_val, 16);
5315
}
5316
}
5317
if (ANDQI (tmp_bytecount, 4)) {
5318
{
5319
  {
5320
    SI opval = ANDSI (tmp_val, 0xffffffff);
5321
    SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8), opval);
5322
    written |= (1 << 6);
5323
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5324
  }
5325
  tmp_val = SRLDI (tmp_val, 32);
5326
}
5327
}
5328
}
5329
} else {
5330
{
5331
  tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount)));
5332
if (ANDQI (tmp_bytecount, 4)) {
5333
{
5334
  {
5335
    SI opval = ANDSI (tmp_val, 0xffffffff);
5336
    SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8), opval);
5337
    written |= (1 << 6);
5338
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5339
  }
5340
  tmp_val = SRLDI (tmp_val, 32);
5341
}
5342
}
5343
if (ANDQI (tmp_bytecount, 2)) {
5344
{
5345
  {
5346
    HI opval = ANDHI (tmp_val, 65535);
5347
    SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5348
    written |= (1 << 5);
5349
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5350
  }
5351
  tmp_val = SRLDI (tmp_val, 16);
5352
}
5353
}
5354
if (ANDQI (tmp_bytecount, 1)) {
5355
{
5356
  {
5357
    UQI opval = ANDQI (tmp_val, 255);
5358
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5359
    written |= (1 << 7);
5360
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5361
  }
5362
  tmp_val = SRLDI (tmp_val, 8);
5363
}
5364
}
5365
}
5366
}
5367
}
5368
}
5369
 
5370
  abuf->written = written;
5371
  return vpc;
5372
#undef FLD
5373
}
5374
 
5375
/* stlol: stlo.l $rm, $disp6, $rd */
5376
 
5377
static SEM_PC
5378
SEM_FN_NAME (sh64_media,stlol) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5379
{
5380
#define FLD(f) abuf->fields.sfmt_getcfg.f
5381
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5382
  int UNUSED written = 0;
5383
  IADDR UNUSED pc = abuf->addr;
5384
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5385
 
5386
{
5387
  DI tmp_addr;
5388
  QI tmp_bytecount;
5389
  DI tmp_val;
5390
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5391
  tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3));
5392
if (ANDQI (tmp_bytecount, 4)) {
5393
  {
5394
    USI opval = GET_H_GR (FLD (f_dest));
5395
    SETMEMUSI (current_cpu, pc, tmp_addr, opval);
5396
    written |= (1 << 6);
5397
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5398
  }
5399
} else {
5400
if (GET_H_ENDIAN ()) {
5401
{
5402
  tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount)));
5403
if (ANDQI (tmp_bytecount, 2)) {
5404
{
5405
  {
5406
    UHI opval = ANDHI (tmp_val, 65535);
5407
    SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5408
    written |= (1 << 4);
5409
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5410
  }
5411
  tmp_val = SRLDI (tmp_val, 16);
5412
}
5413
}
5414
if (ANDQI (tmp_bytecount, 1)) {
5415
{
5416
  {
5417
    UQI opval = ANDQI (tmp_val, 255);
5418
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5419
    written |= (1 << 5);
5420
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5421
  }
5422
  tmp_val = SRLDI (tmp_val, 8);
5423
}
5424
}
5425
}
5426
} else {
5427
{
5428
  tmp_val = GET_H_GR (FLD (f_dest));
5429
if (ANDQI (tmp_bytecount, 1)) {
5430
{
5431
  {
5432
    UQI opval = ANDQI (tmp_val, 255);
5433
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5434
    written |= (1 << 5);
5435
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5436
  }
5437
  tmp_val = SRLDI (tmp_val, 8);
5438
}
5439
}
5440
if (ANDQI (tmp_bytecount, 2)) {
5441
{
5442
  {
5443
    UHI opval = ANDHI (tmp_val, 65535);
5444
    SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5445
    written |= (1 << 4);
5446
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5447
  }
5448
  tmp_val = SRLDI (tmp_val, 16);
5449
}
5450
}
5451
}
5452
}
5453
}
5454
}
5455
 
5456
  abuf->written = written;
5457
  return vpc;
5458
#undef FLD
5459
}
5460
 
5461
/* stloq: stlo.q $rm, $disp6, $rd */
5462
 
5463
static SEM_PC
5464
SEM_FN_NAME (sh64_media,stloq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5465
{
5466
#define FLD(f) abuf->fields.sfmt_getcfg.f
5467
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5468
  int UNUSED written = 0;
5469
  IADDR UNUSED pc = abuf->addr;
5470
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5471
 
5472
{
5473
  DI tmp_addr;
5474
  QI tmp_bytecount;
5475
  DI tmp_val;
5476
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5477
  tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7));
5478
if (ANDQI (tmp_bytecount, 8)) {
5479
  {
5480
    UDI opval = GET_H_GR (FLD (f_dest));
5481
    SETMEMUDI (current_cpu, pc, tmp_addr, opval);
5482
    written |= (1 << 4);
5483
    TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5484
  }
5485
} else {
5486
if (GET_H_ENDIAN ()) {
5487
{
5488
  tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount)));
5489
if (ANDQI (tmp_bytecount, 4)) {
5490
{
5491
  {
5492
    USI opval = ANDSI (tmp_val, 0xffffffff);
5493
    SETMEMUSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval);
5494
    written |= (1 << 7);
5495
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5496
  }
5497
  tmp_val = SRLDI (tmp_val, 32);
5498
}
5499
}
5500
if (ANDQI (tmp_bytecount, 2)) {
5501
{
5502
  {
5503
    UHI opval = ANDHI (tmp_val, 65535);
5504
    SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5505
    written |= (1 << 5);
5506
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5507
  }
5508
  tmp_val = SRLDI (tmp_val, 16);
5509
}
5510
}
5511
if (ANDQI (tmp_bytecount, 1)) {
5512
{
5513
  {
5514
    UQI opval = ANDQI (tmp_val, 255);
5515
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5516
    written |= (1 << 6);
5517
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5518
  }
5519
  tmp_val = SRLDI (tmp_val, 8);
5520
}
5521
}
5522
}
5523
} else {
5524
{
5525
  tmp_val = GET_H_GR (FLD (f_dest));
5526
if (ANDQI (tmp_bytecount, 1)) {
5527
{
5528
  {
5529
    UQI opval = ANDQI (tmp_val, 255);
5530
    SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5531
    written |= (1 << 6);
5532
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5533
  }
5534
  tmp_val = SRLDI (tmp_val, 8);
5535
}
5536
}
5537
if (ANDQI (tmp_bytecount, 2)) {
5538
{
5539
  {
5540
    UHI opval = ANDHI (tmp_val, 65535);
5541
    SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5542
    written |= (1 << 5);
5543
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5544
  }
5545
  tmp_val = SRLDI (tmp_val, 16);
5546
}
5547
}
5548
if (ANDQI (tmp_bytecount, 4)) {
5549
{
5550
  {
5551
    USI opval = ANDSI (tmp_val, 0xffffffff);
5552
    SETMEMUSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval);
5553
    written |= (1 << 7);
5554
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5555
  }
5556
  tmp_val = SRLDI (tmp_val, 32);
5557
}
5558
}
5559
}
5560
}
5561
}
5562
}
5563
 
5564
  abuf->written = written;
5565
  return vpc;
5566
#undef FLD
5567
}
5568
 
5569
/* stxb: stx.b $rm, $rn, $rd */
5570
 
5571
static SEM_PC
5572
SEM_FN_NAME (sh64_media,stxb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5573
{
5574
#define FLD(f) abuf->fields.sfmt_add.f
5575
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5576
  int UNUSED written = 0;
5577
  IADDR UNUSED pc = abuf->addr;
5578
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5579
 
5580
  {
5581
    UQI opval = SUBWORDDIQI (GET_H_GR (FLD (f_dest)), 7);
5582
    SETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5583
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5584
  }
5585
 
5586
  return vpc;
5587
#undef FLD
5588
}
5589
 
5590
/* stxl: stx.l $rm, $rn, $rd */
5591
 
5592
static SEM_PC
5593
SEM_FN_NAME (sh64_media,stxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5594
{
5595
#define FLD(f) abuf->fields.sfmt_add.f
5596
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5597
  int UNUSED written = 0;
5598
  IADDR UNUSED pc = abuf->addr;
5599
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5600
 
5601
  {
5602
    SI opval = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1);
5603
    SETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5604
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5605
  }
5606
 
5607
  return vpc;
5608
#undef FLD
5609
}
5610
 
5611
/* stxq: stx.q $rm, $rn, $rd */
5612
 
5613
static SEM_PC
5614
SEM_FN_NAME (sh64_media,stxq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5615
{
5616
#define FLD(f) abuf->fields.sfmt_add.f
5617
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5618
  int UNUSED written = 0;
5619
  IADDR UNUSED pc = abuf->addr;
5620
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5621
 
5622
  {
5623
    DI opval = GET_H_GR (FLD (f_dest));
5624
    SETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5625
    TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5626
  }
5627
 
5628
  return vpc;
5629
#undef FLD
5630
}
5631
 
5632
/* stxw: stx.w $rm, $rn, $rd */
5633
 
5634
static SEM_PC
5635
SEM_FN_NAME (sh64_media,stxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5636
{
5637
#define FLD(f) abuf->fields.sfmt_add.f
5638
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5639
  int UNUSED written = 0;
5640
  IADDR UNUSED pc = abuf->addr;
5641
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5642
 
5643
  {
5644
    HI opval = SUBWORDDIHI (GET_H_GR (FLD (f_dest)), 3);
5645
    SETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5646
    TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5647
  }
5648
 
5649
  return vpc;
5650
#undef FLD
5651
}
5652
 
5653
/* sub: sub $rm, $rn, $rd */
5654
 
5655
static SEM_PC
5656
SEM_FN_NAME (sh64_media,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5657
{
5658
#define FLD(f) abuf->fields.sfmt_add.f
5659
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5660
  int UNUSED written = 0;
5661
  IADDR UNUSED pc = abuf->addr;
5662
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5663
 
5664
  {
5665
    DI opval = SUBDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
5666
    SET_H_GR (FLD (f_dest), opval);
5667
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5668
  }
5669
 
5670
  return vpc;
5671
#undef FLD
5672
}
5673
 
5674
/* subl: sub.l $rm, $rn, $rd */
5675
 
5676
static SEM_PC
5677
SEM_FN_NAME (sh64_media,subl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5678
{
5679
#define FLD(f) abuf->fields.sfmt_add.f
5680
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5681
  int UNUSED written = 0;
5682
  IADDR UNUSED pc = abuf->addr;
5683
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5684
 
5685
  {
5686
    DI opval = EXTSIDI (SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
5687
    SET_H_GR (FLD (f_dest), opval);
5688
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5689
  }
5690
 
5691
  return vpc;
5692
#undef FLD
5693
}
5694
 
5695
/* swapq: swap.q $rm, $rn, $rd */
5696
 
5697
static SEM_PC
5698
SEM_FN_NAME (sh64_media,swapq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5699
{
5700
#define FLD(f) abuf->fields.sfmt_add.f
5701
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5702
  int UNUSED written = 0;
5703
  IADDR UNUSED pc = abuf->addr;
5704
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5705
 
5706
{
5707
  DI tmp_addr;
5708
  DI tmp_temp;
5709
  tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
5710
  tmp_temp = GETMEMDI (current_cpu, pc, tmp_addr);
5711
  {
5712
    DI opval = GET_H_GR (FLD (f_dest));
5713
    SETMEMDI (current_cpu, pc, tmp_addr, opval);
5714
    TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5715
  }
5716
  {
5717
    DI opval = tmp_temp;
5718
    SET_H_GR (FLD (f_dest), opval);
5719
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5720
  }
5721
}
5722
 
5723
  return vpc;
5724
#undef FLD
5725
}
5726
 
5727
/* synci: synci */
5728
 
5729
static SEM_PC
5730
SEM_FN_NAME (sh64_media,synci) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5731
{
5732
#define FLD(f) abuf->fields.fmt_empty.f
5733
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5734
  int UNUSED written = 0;
5735
  IADDR UNUSED pc = abuf->addr;
5736
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5737
 
5738
((void) 0); /*nop*/
5739
 
5740
  return vpc;
5741
#undef FLD
5742
}
5743
 
5744
/* synco: synco */
5745
 
5746
static SEM_PC
5747
SEM_FN_NAME (sh64_media,synco) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5748
{
5749
#define FLD(f) abuf->fields.fmt_empty.f
5750
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5751
  int UNUSED written = 0;
5752
  IADDR UNUSED pc = abuf->addr;
5753
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5754
 
5755
((void) 0); /*nop*/
5756
 
5757
  return vpc;
5758
#undef FLD
5759
}
5760
 
5761
/* trapa: trapa $rm */
5762
 
5763
static SEM_PC
5764
SEM_FN_NAME (sh64_media,trapa) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5765
{
5766
#define FLD(f) abuf->fields.sfmt_xori.f
5767
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5768
  int UNUSED written = 0;
5769
  IADDR UNUSED pc = abuf->addr;
5770
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5771
 
5772
sh64_trapa (current_cpu, GET_H_GR (FLD (f_left)), pc);
5773
 
5774
  return vpc;
5775
#undef FLD
5776
}
5777
 
5778
/* xor: xor $rm, $rn, $rd */
5779
 
5780
static SEM_PC
5781
SEM_FN_NAME (sh64_media,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5782
{
5783
#define FLD(f) abuf->fields.sfmt_add.f
5784
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5785
  int UNUSED written = 0;
5786
  IADDR UNUSED pc = abuf->addr;
5787
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5788
 
5789
  {
5790
    DI opval = XORDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
5791
    SET_H_GR (FLD (f_dest), opval);
5792
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5793
  }
5794
 
5795
  return vpc;
5796
#undef FLD
5797
}
5798
 
5799
/* xori: xori $rm, $imm6, $rd */
5800
 
5801
static SEM_PC
5802
SEM_FN_NAME (sh64_media,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5803
{
5804
#define FLD(f) abuf->fields.sfmt_xori.f
5805
  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5806
  int UNUSED written = 0;
5807
  IADDR UNUSED pc = abuf->addr;
5808
  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5809
 
5810
  {
5811
    DI opval = XORDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)));
5812
    SET_H_GR (FLD (f_dest), opval);
5813
    TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5814
  }
5815
 
5816
  return vpc;
5817
#undef FLD
5818
}
5819
 
5820
/* Table of all semantic fns.  */
5821
 
5822
static const struct sem_fn_desc sem_fns[] = {
5823
  { SH64_MEDIA_INSN_X_INVALID, SEM_FN_NAME (sh64_media,x_invalid) },
5824
  { SH64_MEDIA_INSN_X_AFTER, SEM_FN_NAME (sh64_media,x_after) },
5825
  { SH64_MEDIA_INSN_X_BEFORE, SEM_FN_NAME (sh64_media,x_before) },
5826
  { SH64_MEDIA_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_media,x_cti_chain) },
5827
  { SH64_MEDIA_INSN_X_CHAIN, SEM_FN_NAME (sh64_media,x_chain) },
5828
  { SH64_MEDIA_INSN_X_BEGIN, SEM_FN_NAME (sh64_media,x_begin) },
5829
  { SH64_MEDIA_INSN_ADD, SEM_FN_NAME (sh64_media,add) },
5830
  { SH64_MEDIA_INSN_ADDL, SEM_FN_NAME (sh64_media,addl) },
5831
  { SH64_MEDIA_INSN_ADDI, SEM_FN_NAME (sh64_media,addi) },
5832
  { SH64_MEDIA_INSN_ADDIL, SEM_FN_NAME (sh64_media,addil) },
5833
  { SH64_MEDIA_INSN_ADDZL, SEM_FN_NAME (sh64_media,addzl) },
5834
  { SH64_MEDIA_INSN_ALLOCO, SEM_FN_NAME (sh64_media,alloco) },
5835
  { SH64_MEDIA_INSN_AND, SEM_FN_NAME (sh64_media,and) },
5836
  { SH64_MEDIA_INSN_ANDC, SEM_FN_NAME (sh64_media,andc) },
5837
  { SH64_MEDIA_INSN_ANDI, SEM_FN_NAME (sh64_media,andi) },
5838
  { SH64_MEDIA_INSN_BEQ, SEM_FN_NAME (sh64_media,beq) },
5839
  { SH64_MEDIA_INSN_BEQI, SEM_FN_NAME (sh64_media,beqi) },
5840
  { SH64_MEDIA_INSN_BGE, SEM_FN_NAME (sh64_media,bge) },
5841
  { SH64_MEDIA_INSN_BGEU, SEM_FN_NAME (sh64_media,bgeu) },
5842
  { SH64_MEDIA_INSN_BGT, SEM_FN_NAME (sh64_media,bgt) },
5843
  { SH64_MEDIA_INSN_BGTU, SEM_FN_NAME (sh64_media,bgtu) },
5844
  { SH64_MEDIA_INSN_BLINK, SEM_FN_NAME (sh64_media,blink) },
5845
  { SH64_MEDIA_INSN_BNE, SEM_FN_NAME (sh64_media,bne) },
5846
  { SH64_MEDIA_INSN_BNEI, SEM_FN_NAME (sh64_media,bnei) },
5847
  { SH64_MEDIA_INSN_BRK, SEM_FN_NAME (sh64_media,brk) },
5848
  { SH64_MEDIA_INSN_BYTEREV, SEM_FN_NAME (sh64_media,byterev) },
5849
  { SH64_MEDIA_INSN_CMPEQ, SEM_FN_NAME (sh64_media,cmpeq) },
5850
  { SH64_MEDIA_INSN_CMPGT, SEM_FN_NAME (sh64_media,cmpgt) },
5851
  { SH64_MEDIA_INSN_CMPGTU, SEM_FN_NAME (sh64_media,cmpgtu) },
5852
  { SH64_MEDIA_INSN_CMVEQ, SEM_FN_NAME (sh64_media,cmveq) },
5853
  { SH64_MEDIA_INSN_CMVNE, SEM_FN_NAME (sh64_media,cmvne) },
5854
  { SH64_MEDIA_INSN_FABSD, SEM_FN_NAME (sh64_media,fabsd) },
5855
  { SH64_MEDIA_INSN_FABSS, SEM_FN_NAME (sh64_media,fabss) },
5856
  { SH64_MEDIA_INSN_FADDD, SEM_FN_NAME (sh64_media,faddd) },
5857
  { SH64_MEDIA_INSN_FADDS, SEM_FN_NAME (sh64_media,fadds) },
5858
  { SH64_MEDIA_INSN_FCMPEQD, SEM_FN_NAME (sh64_media,fcmpeqd) },
5859
  { SH64_MEDIA_INSN_FCMPEQS, SEM_FN_NAME (sh64_media,fcmpeqs) },
5860
  { SH64_MEDIA_INSN_FCMPGED, SEM_FN_NAME (sh64_media,fcmpged) },
5861
  { SH64_MEDIA_INSN_FCMPGES, SEM_FN_NAME (sh64_media,fcmpges) },
5862
  { SH64_MEDIA_INSN_FCMPGTD, SEM_FN_NAME (sh64_media,fcmpgtd) },
5863
  { SH64_MEDIA_INSN_FCMPGTS, SEM_FN_NAME (sh64_media,fcmpgts) },
5864
  { SH64_MEDIA_INSN_FCMPUND, SEM_FN_NAME (sh64_media,fcmpund) },
5865
  { SH64_MEDIA_INSN_FCMPUNS, SEM_FN_NAME (sh64_media,fcmpuns) },
5866
  { SH64_MEDIA_INSN_FCNVDS, SEM_FN_NAME (sh64_media,fcnvds) },
5867
  { SH64_MEDIA_INSN_FCNVSD, SEM_FN_NAME (sh64_media,fcnvsd) },
5868
  { SH64_MEDIA_INSN_FDIVD, SEM_FN_NAME (sh64_media,fdivd) },
5869
  { SH64_MEDIA_INSN_FDIVS, SEM_FN_NAME (sh64_media,fdivs) },
5870
  { SH64_MEDIA_INSN_FGETSCR, SEM_FN_NAME (sh64_media,fgetscr) },
5871
  { SH64_MEDIA_INSN_FIPRS, SEM_FN_NAME (sh64_media,fiprs) },
5872
  { SH64_MEDIA_INSN_FLDD, SEM_FN_NAME (sh64_media,fldd) },
5873
  { SH64_MEDIA_INSN_FLDP, SEM_FN_NAME (sh64_media,fldp) },
5874
  { SH64_MEDIA_INSN_FLDS, SEM_FN_NAME (sh64_media,flds) },
5875
  { SH64_MEDIA_INSN_FLDXD, SEM_FN_NAME (sh64_media,fldxd) },
5876
  { SH64_MEDIA_INSN_FLDXP, SEM_FN_NAME (sh64_media,fldxp) },
5877
  { SH64_MEDIA_INSN_FLDXS, SEM_FN_NAME (sh64_media,fldxs) },
5878
  { SH64_MEDIA_INSN_FLOATLD, SEM_FN_NAME (sh64_media,floatld) },
5879
  { SH64_MEDIA_INSN_FLOATLS, SEM_FN_NAME (sh64_media,floatls) },
5880
  { SH64_MEDIA_INSN_FLOATQD, SEM_FN_NAME (sh64_media,floatqd) },
5881
  { SH64_MEDIA_INSN_FLOATQS, SEM_FN_NAME (sh64_media,floatqs) },
5882
  { SH64_MEDIA_INSN_FMACS, SEM_FN_NAME (sh64_media,fmacs) },
5883
  { SH64_MEDIA_INSN_FMOVD, SEM_FN_NAME (sh64_media,fmovd) },
5884
  { SH64_MEDIA_INSN_FMOVDQ, SEM_FN_NAME (sh64_media,fmovdq) },
5885
  { SH64_MEDIA_INSN_FMOVLS, SEM_FN_NAME (sh64_media,fmovls) },
5886
  { SH64_MEDIA_INSN_FMOVQD, SEM_FN_NAME (sh64_media,fmovqd) },
5887
  { SH64_MEDIA_INSN_FMOVS, SEM_FN_NAME (sh64_media,fmovs) },
5888
  { SH64_MEDIA_INSN_FMOVSL, SEM_FN_NAME (sh64_media,fmovsl) },
5889
  { SH64_MEDIA_INSN_FMULD, SEM_FN_NAME (sh64_media,fmuld) },
5890
  { SH64_MEDIA_INSN_FMULS, SEM_FN_NAME (sh64_media,fmuls) },
5891
  { SH64_MEDIA_INSN_FNEGD, SEM_FN_NAME (sh64_media,fnegd) },
5892
  { SH64_MEDIA_INSN_FNEGS, SEM_FN_NAME (sh64_media,fnegs) },
5893
  { SH64_MEDIA_INSN_FPUTSCR, SEM_FN_NAME (sh64_media,fputscr) },
5894
  { SH64_MEDIA_INSN_FSQRTD, SEM_FN_NAME (sh64_media,fsqrtd) },
5895
  { SH64_MEDIA_INSN_FSQRTS, SEM_FN_NAME (sh64_media,fsqrts) },
5896
  { SH64_MEDIA_INSN_FSTD, SEM_FN_NAME (sh64_media,fstd) },
5897
  { SH64_MEDIA_INSN_FSTP, SEM_FN_NAME (sh64_media,fstp) },
5898
  { SH64_MEDIA_INSN_FSTS, SEM_FN_NAME (sh64_media,fsts) },
5899
  { SH64_MEDIA_INSN_FSTXD, SEM_FN_NAME (sh64_media,fstxd) },
5900
  { SH64_MEDIA_INSN_FSTXP, SEM_FN_NAME (sh64_media,fstxp) },
5901
  { SH64_MEDIA_INSN_FSTXS, SEM_FN_NAME (sh64_media,fstxs) },
5902
  { SH64_MEDIA_INSN_FSUBD, SEM_FN_NAME (sh64_media,fsubd) },
5903
  { SH64_MEDIA_INSN_FSUBS, SEM_FN_NAME (sh64_media,fsubs) },
5904
  { SH64_MEDIA_INSN_FTRCDL, SEM_FN_NAME (sh64_media,ftrcdl) },
5905
  { SH64_MEDIA_INSN_FTRCSL, SEM_FN_NAME (sh64_media,ftrcsl) },
5906
  { SH64_MEDIA_INSN_FTRCDQ, SEM_FN_NAME (sh64_media,ftrcdq) },
5907
  { SH64_MEDIA_INSN_FTRCSQ, SEM_FN_NAME (sh64_media,ftrcsq) },
5908
  { SH64_MEDIA_INSN_FTRVS, SEM_FN_NAME (sh64_media,ftrvs) },
5909
  { SH64_MEDIA_INSN_GETCFG, SEM_FN_NAME (sh64_media,getcfg) },
5910
  { SH64_MEDIA_INSN_GETCON, SEM_FN_NAME (sh64_media,getcon) },
5911
  { SH64_MEDIA_INSN_GETTR, SEM_FN_NAME (sh64_media,gettr) },
5912
  { SH64_MEDIA_INSN_ICBI, SEM_FN_NAME (sh64_media,icbi) },
5913
  { SH64_MEDIA_INSN_LDB, SEM_FN_NAME (sh64_media,ldb) },
5914
  { SH64_MEDIA_INSN_LDL, SEM_FN_NAME (sh64_media,ldl) },
5915
  { SH64_MEDIA_INSN_LDQ, SEM_FN_NAME (sh64_media,ldq) },
5916
  { SH64_MEDIA_INSN_LDUB, SEM_FN_NAME (sh64_media,ldub) },
5917
  { SH64_MEDIA_INSN_LDUW, SEM_FN_NAME (sh64_media,lduw) },
5918
  { SH64_MEDIA_INSN_LDW, SEM_FN_NAME (sh64_media,ldw) },
5919
  { SH64_MEDIA_INSN_LDHIL, SEM_FN_NAME (sh64_media,ldhil) },
5920
  { SH64_MEDIA_INSN_LDHIQ, SEM_FN_NAME (sh64_media,ldhiq) },
5921
  { SH64_MEDIA_INSN_LDLOL, SEM_FN_NAME (sh64_media,ldlol) },
5922
  { SH64_MEDIA_INSN_LDLOQ, SEM_FN_NAME (sh64_media,ldloq) },
5923
  { SH64_MEDIA_INSN_LDXB, SEM_FN_NAME (sh64_media,ldxb) },
5924
  { SH64_MEDIA_INSN_LDXL, SEM_FN_NAME (sh64_media,ldxl) },
5925
  { SH64_MEDIA_INSN_LDXQ, SEM_FN_NAME (sh64_media,ldxq) },
5926
  { SH64_MEDIA_INSN_LDXUB, SEM_FN_NAME (sh64_media,ldxub) },
5927
  { SH64_MEDIA_INSN_LDXUW, SEM_FN_NAME (sh64_media,ldxuw) },
5928
  { SH64_MEDIA_INSN_LDXW, SEM_FN_NAME (sh64_media,ldxw) },
5929
  { SH64_MEDIA_INSN_MABSL, SEM_FN_NAME (sh64_media,mabsl) },
5930
  { SH64_MEDIA_INSN_MABSW, SEM_FN_NAME (sh64_media,mabsw) },
5931
  { SH64_MEDIA_INSN_MADDL, SEM_FN_NAME (sh64_media,maddl) },
5932
  { SH64_MEDIA_INSN_MADDW, SEM_FN_NAME (sh64_media,maddw) },
5933
  { SH64_MEDIA_INSN_MADDSL, SEM_FN_NAME (sh64_media,maddsl) },
5934
  { SH64_MEDIA_INSN_MADDSUB, SEM_FN_NAME (sh64_media,maddsub) },
5935
  { SH64_MEDIA_INSN_MADDSW, SEM_FN_NAME (sh64_media,maddsw) },
5936
  { SH64_MEDIA_INSN_MCMPEQB, SEM_FN_NAME (sh64_media,mcmpeqb) },
5937
  { SH64_MEDIA_INSN_MCMPEQL, SEM_FN_NAME (sh64_media,mcmpeql) },
5938
  { SH64_MEDIA_INSN_MCMPEQW, SEM_FN_NAME (sh64_media,mcmpeqw) },
5939
  { SH64_MEDIA_INSN_MCMPGTL, SEM_FN_NAME (sh64_media,mcmpgtl) },
5940
  { SH64_MEDIA_INSN_MCMPGTUB, SEM_FN_NAME (sh64_media,mcmpgtub) },
5941
  { SH64_MEDIA_INSN_MCMPGTW, SEM_FN_NAME (sh64_media,mcmpgtw) },
5942
  { SH64_MEDIA_INSN_MCMV, SEM_FN_NAME (sh64_media,mcmv) },
5943
  { SH64_MEDIA_INSN_MCNVSLW, SEM_FN_NAME (sh64_media,mcnvslw) },
5944
  { SH64_MEDIA_INSN_MCNVSWB, SEM_FN_NAME (sh64_media,mcnvswb) },
5945
  { SH64_MEDIA_INSN_MCNVSWUB, SEM_FN_NAME (sh64_media,mcnvswub) },
5946
  { SH64_MEDIA_INSN_MEXTR1, SEM_FN_NAME (sh64_media,mextr1) },
5947
  { SH64_MEDIA_INSN_MEXTR2, SEM_FN_NAME (sh64_media,mextr2) },
5948
  { SH64_MEDIA_INSN_MEXTR3, SEM_FN_NAME (sh64_media,mextr3) },
5949
  { SH64_MEDIA_INSN_MEXTR4, SEM_FN_NAME (sh64_media,mextr4) },
5950
  { SH64_MEDIA_INSN_MEXTR5, SEM_FN_NAME (sh64_media,mextr5) },
5951
  { SH64_MEDIA_INSN_MEXTR6, SEM_FN_NAME (sh64_media,mextr6) },
5952
  { SH64_MEDIA_INSN_MEXTR7, SEM_FN_NAME (sh64_media,mextr7) },
5953
  { SH64_MEDIA_INSN_MMACFXWL, SEM_FN_NAME (sh64_media,mmacfxwl) },
5954
  { SH64_MEDIA_INSN_MMACNFX_WL, SEM_FN_NAME (sh64_media,mmacnfx_wl) },
5955
  { SH64_MEDIA_INSN_MMULL, SEM_FN_NAME (sh64_media,mmull) },
5956
  { SH64_MEDIA_INSN_MMULW, SEM_FN_NAME (sh64_media,mmulw) },
5957
  { SH64_MEDIA_INSN_MMULFXL, SEM_FN_NAME (sh64_media,mmulfxl) },
5958
  { SH64_MEDIA_INSN_MMULFXW, SEM_FN_NAME (sh64_media,mmulfxw) },
5959
  { SH64_MEDIA_INSN_MMULFXRPW, SEM_FN_NAME (sh64_media,mmulfxrpw) },
5960
  { SH64_MEDIA_INSN_MMULHIWL, SEM_FN_NAME (sh64_media,mmulhiwl) },
5961
  { SH64_MEDIA_INSN_MMULLOWL, SEM_FN_NAME (sh64_media,mmullowl) },
5962
  { SH64_MEDIA_INSN_MMULSUMWQ, SEM_FN_NAME (sh64_media,mmulsumwq) },
5963
  { SH64_MEDIA_INSN_MOVI, SEM_FN_NAME (sh64_media,movi) },
5964
  { SH64_MEDIA_INSN_MPERMW, SEM_FN_NAME (sh64_media,mpermw) },
5965
  { SH64_MEDIA_INSN_MSADUBQ, SEM_FN_NAME (sh64_media,msadubq) },
5966
  { SH64_MEDIA_INSN_MSHALDSL, SEM_FN_NAME (sh64_media,mshaldsl) },
5967
  { SH64_MEDIA_INSN_MSHALDSW, SEM_FN_NAME (sh64_media,mshaldsw) },
5968
  { SH64_MEDIA_INSN_MSHARDL, SEM_FN_NAME (sh64_media,mshardl) },
5969
  { SH64_MEDIA_INSN_MSHARDW, SEM_FN_NAME (sh64_media,mshardw) },
5970
  { SH64_MEDIA_INSN_MSHARDSQ, SEM_FN_NAME (sh64_media,mshardsq) },
5971
  { SH64_MEDIA_INSN_MSHFHIB, SEM_FN_NAME (sh64_media,mshfhib) },
5972
  { SH64_MEDIA_INSN_MSHFHIL, SEM_FN_NAME (sh64_media,mshfhil) },
5973
  { SH64_MEDIA_INSN_MSHFHIW, SEM_FN_NAME (sh64_media,mshfhiw) },
5974
  { SH64_MEDIA_INSN_MSHFLOB, SEM_FN_NAME (sh64_media,mshflob) },
5975
  { SH64_MEDIA_INSN_MSHFLOL, SEM_FN_NAME (sh64_media,mshflol) },
5976
  { SH64_MEDIA_INSN_MSHFLOW, SEM_FN_NAME (sh64_media,mshflow) },
5977
  { SH64_MEDIA_INSN_MSHLLDL, SEM_FN_NAME (sh64_media,mshlldl) },
5978
  { SH64_MEDIA_INSN_MSHLLDW, SEM_FN_NAME (sh64_media,mshlldw) },
5979
  { SH64_MEDIA_INSN_MSHLRDL, SEM_FN_NAME (sh64_media,mshlrdl) },
5980
  { SH64_MEDIA_INSN_MSHLRDW, SEM_FN_NAME (sh64_media,mshlrdw) },
5981
  { SH64_MEDIA_INSN_MSUBL, SEM_FN_NAME (sh64_media,msubl) },
5982
  { SH64_MEDIA_INSN_MSUBW, SEM_FN_NAME (sh64_media,msubw) },
5983
  { SH64_MEDIA_INSN_MSUBSL, SEM_FN_NAME (sh64_media,msubsl) },
5984
  { SH64_MEDIA_INSN_MSUBSUB, SEM_FN_NAME (sh64_media,msubsub) },
5985
  { SH64_MEDIA_INSN_MSUBSW, SEM_FN_NAME (sh64_media,msubsw) },
5986
  { SH64_MEDIA_INSN_MULSL, SEM_FN_NAME (sh64_media,mulsl) },
5987
  { SH64_MEDIA_INSN_MULUL, SEM_FN_NAME (sh64_media,mulul) },
5988
  { SH64_MEDIA_INSN_NOP, SEM_FN_NAME (sh64_media,nop) },
5989
  { SH64_MEDIA_INSN_NSB, SEM_FN_NAME (sh64_media,nsb) },
5990
  { SH64_MEDIA_INSN_OCBI, SEM_FN_NAME (sh64_media,ocbi) },
5991
  { SH64_MEDIA_INSN_OCBP, SEM_FN_NAME (sh64_media,ocbp) },
5992
  { SH64_MEDIA_INSN_OCBWB, SEM_FN_NAME (sh64_media,ocbwb) },
5993
  { SH64_MEDIA_INSN_OR, SEM_FN_NAME (sh64_media,or) },
5994
  { SH64_MEDIA_INSN_ORI, SEM_FN_NAME (sh64_media,ori) },
5995
  { SH64_MEDIA_INSN_PREFI, SEM_FN_NAME (sh64_media,prefi) },
5996
  { SH64_MEDIA_INSN_PTA, SEM_FN_NAME (sh64_media,pta) },
5997
  { SH64_MEDIA_INSN_PTABS, SEM_FN_NAME (sh64_media,ptabs) },
5998
  { SH64_MEDIA_INSN_PTB, SEM_FN_NAME (sh64_media,ptb) },
5999
  { SH64_MEDIA_INSN_PTREL, SEM_FN_NAME (sh64_media,ptrel) },
6000
  { SH64_MEDIA_INSN_PUTCFG, SEM_FN_NAME (sh64_media,putcfg) },
6001
  { SH64_MEDIA_INSN_PUTCON, SEM_FN_NAME (sh64_media,putcon) },
6002
  { SH64_MEDIA_INSN_RTE, SEM_FN_NAME (sh64_media,rte) },
6003
  { SH64_MEDIA_INSN_SHARD, SEM_FN_NAME (sh64_media,shard) },
6004
  { SH64_MEDIA_INSN_SHARDL, SEM_FN_NAME (sh64_media,shardl) },
6005
  { SH64_MEDIA_INSN_SHARI, SEM_FN_NAME (sh64_media,shari) },
6006
  { SH64_MEDIA_INSN_SHARIL, SEM_FN_NAME (sh64_media,sharil) },
6007
  { SH64_MEDIA_INSN_SHLLD, SEM_FN_NAME (sh64_media,shlld) },
6008
  { SH64_MEDIA_INSN_SHLLDL, SEM_FN_NAME (sh64_media,shlldl) },
6009
  { SH64_MEDIA_INSN_SHLLI, SEM_FN_NAME (sh64_media,shlli) },
6010
  { SH64_MEDIA_INSN_SHLLIL, SEM_FN_NAME (sh64_media,shllil) },
6011
  { SH64_MEDIA_INSN_SHLRD, SEM_FN_NAME (sh64_media,shlrd) },
6012
  { SH64_MEDIA_INSN_SHLRDL, SEM_FN_NAME (sh64_media,shlrdl) },
6013
  { SH64_MEDIA_INSN_SHLRI, SEM_FN_NAME (sh64_media,shlri) },
6014
  { SH64_MEDIA_INSN_SHLRIL, SEM_FN_NAME (sh64_media,shlril) },
6015
  { SH64_MEDIA_INSN_SHORI, SEM_FN_NAME (sh64_media,shori) },
6016
  { SH64_MEDIA_INSN_SLEEP, SEM_FN_NAME (sh64_media,sleep) },
6017
  { SH64_MEDIA_INSN_STB, SEM_FN_NAME (sh64_media,stb) },
6018
  { SH64_MEDIA_INSN_STL, SEM_FN_NAME (sh64_media,stl) },
6019
  { SH64_MEDIA_INSN_STQ, SEM_FN_NAME (sh64_media,stq) },
6020
  { SH64_MEDIA_INSN_STW, SEM_FN_NAME (sh64_media,stw) },
6021
  { SH64_MEDIA_INSN_STHIL, SEM_FN_NAME (sh64_media,sthil) },
6022
  { SH64_MEDIA_INSN_STHIQ, SEM_FN_NAME (sh64_media,sthiq) },
6023
  { SH64_MEDIA_INSN_STLOL, SEM_FN_NAME (sh64_media,stlol) },
6024
  { SH64_MEDIA_INSN_STLOQ, SEM_FN_NAME (sh64_media,stloq) },
6025
  { SH64_MEDIA_INSN_STXB, SEM_FN_NAME (sh64_media,stxb) },
6026
  { SH64_MEDIA_INSN_STXL, SEM_FN_NAME (sh64_media,stxl) },
6027
  { SH64_MEDIA_INSN_STXQ, SEM_FN_NAME (sh64_media,stxq) },
6028
  { SH64_MEDIA_INSN_STXW, SEM_FN_NAME (sh64_media,stxw) },
6029
  { SH64_MEDIA_INSN_SUB, SEM_FN_NAME (sh64_media,sub) },
6030
  { SH64_MEDIA_INSN_SUBL, SEM_FN_NAME (sh64_media,subl) },
6031
  { SH64_MEDIA_INSN_SWAPQ, SEM_FN_NAME (sh64_media,swapq) },
6032
  { SH64_MEDIA_INSN_SYNCI, SEM_FN_NAME (sh64_media,synci) },
6033
  { SH64_MEDIA_INSN_SYNCO, SEM_FN_NAME (sh64_media,synco) },
6034
  { SH64_MEDIA_INSN_TRAPA, SEM_FN_NAME (sh64_media,trapa) },
6035
  { SH64_MEDIA_INSN_XOR, SEM_FN_NAME (sh64_media,xor) },
6036
  { SH64_MEDIA_INSN_XORI, SEM_FN_NAME (sh64_media,xori) },
6037
  { 0, 0 }
6038
};
6039
 
6040
/* Add the semantic fns to IDESC_TABLE.  */
6041
 
6042
void
6043
SEM_FN_NAME (sh64_media,init_idesc_table) (SIM_CPU *current_cpu)
6044
{
6045
  IDESC *idesc_table = CPU_IDESC (current_cpu);
6046
  const struct sem_fn_desc *sf;
6047
  int mach_num = MACH_NUM (CPU_MACH (current_cpu));
6048
 
6049
  for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
6050
    {
6051
      const CGEN_INSN *insn = idesc_table[sf->index].idata;
6052
      int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
6053
                     || CGEN_INSN_MACH_HAS_P (insn, mach_num));
6054
#if FAST_P
6055
      if (valid_p)
6056
        idesc_table[sf->index].sem_fast = sf->fn;
6057
      else
6058
        idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_media,x_invalid);
6059
#else
6060
      if (valid_p)
6061
        idesc_table[sf->index].sem_full = sf->fn;
6062
      else
6063
        idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_media,x_invalid);
6064
#endif
6065
    }
6066
}
6067
 

powered by: WebSVN 2.1.0

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