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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [sh64/] [sem-media.c] - Blame information for rev 851

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

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

powered by: WebSVN 2.1.0

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