Remove -pie from command line of fatal-warnings 1a and 1b tests.
[binutils-gdb.git] / sim / or1k / sem.c
blobc913ee4cdde9991d7eca86619114cc4be7415953
1 /* Simulator instruction semantics for or1k32bf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 1996-2024 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
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.
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.
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.
25 #define WANT_CPU or1k32bf
26 #define WANT_CPU_OR1K32BF
28 #include "sim-main.h"
29 #include "cgen-mem.h"
30 #include "cgen-ops.h"
32 #undef GET_ATTR
33 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
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 CGEN_TRACE_RESULT
41 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
42 #else
43 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
44 #endif
46 /* x-invalid: --invalid-- */
48 static SEM_PC
49 SEM_FN_NAME (or1k32bf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
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);
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);
69 return vpc;
70 #undef FLD
73 /* x-after: --after-- */
75 static SEM_PC
76 SEM_FN_NAME (or1k32bf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
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);
85 #if WITH_SCACHE_PBB_OR1K32BF
86 or1k32bf_pbb_after (current_cpu, sem_arg);
87 #endif
90 return vpc;
91 #undef FLD
94 /* x-before: --before-- */
96 static SEM_PC
97 SEM_FN_NAME (or1k32bf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
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);
106 #if WITH_SCACHE_PBB_OR1K32BF
107 or1k32bf_pbb_before (current_cpu, sem_arg);
108 #endif
111 return vpc;
112 #undef FLD
115 /* x-cti-chain: --cti-chain-- */
117 static SEM_PC
118 SEM_FN_NAME (or1k32bf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
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);
127 #if WITH_SCACHE_PBB_OR1K32BF
128 #ifdef DEFINE_SWITCH
129 vpc = or1k32bf_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 = or1k32bf_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
141 return vpc;
142 #undef FLD
145 /* x-chain: --chain-- */
147 static SEM_PC
148 SEM_FN_NAME (or1k32bf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
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);
157 #if WITH_SCACHE_PBB_OR1K32BF
158 vpc = or1k32bf_pbb_chain (current_cpu, sem_arg);
159 #ifdef DEFINE_SWITCH
160 BREAK (sem);
161 #endif
162 #endif
165 return vpc;
166 #undef FLD
169 /* x-begin: --begin-- */
171 static SEM_PC
172 SEM_FN_NAME (or1k32bf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
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);
181 #if WITH_SCACHE_PBB_OR1K32BF
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 = or1k32bf_pbb_begin (current_cpu, FAST_P);
186 #else
187 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
188 vpc = or1k32bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
189 #else
190 vpc = or1k32bf_pbb_begin (current_cpu, 0);
191 #endif
192 #endif
193 #endif
196 return vpc;
197 #undef FLD
200 /* l-j: l.j ${disp26} */
202 static SEM_PC
203 SEM_FN_NAME (or1k32bf,l_j) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
205 #define FLD(f) abuf->fields.sfmt_l_j.f
206 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
207 int UNUSED written = 0;
208 IADDR UNUSED pc = abuf->addr;
209 SEM_BRANCH_INIT
210 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
215 USI opval = FLD (i_disp26);
216 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
217 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
220 if (GET_H_SYS_CPUCFGR_ND ()) {
221 if (1)
222 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
226 SEM_BRANCH_FINI (vpc);
227 return vpc;
228 #undef FLD
231 /* l-adrp: l.adrp $rD,${disp21} */
233 static SEM_PC
234 SEM_FN_NAME (or1k32bf,l_adrp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
236 #define FLD(f) abuf->fields.sfmt_l_adrp.f
237 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
238 int UNUSED written = 0;
239 IADDR UNUSED pc = abuf->addr;
240 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
243 USI opval = FLD (i_disp21);
244 SET_H_GPR (FLD (f_r1), opval);
245 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
248 return vpc;
249 #undef FLD
252 /* l-jal: l.jal ${disp26} */
254 static SEM_PC
255 SEM_FN_NAME (or1k32bf,l_jal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
257 #define FLD(f) abuf->fields.sfmt_l_j.f
258 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
259 int UNUSED written = 0;
260 IADDR UNUSED pc = abuf->addr;
261 SEM_BRANCH_INIT
262 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
266 USI opval = ADDSI (pc, ((GET_H_SYS_CPUCFGR_ND ()) ? (4) : (8)));
267 SET_H_GPR (((UINT) 9), opval);
268 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
273 USI opval = FLD (i_disp26);
274 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
275 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
278 if (GET_H_SYS_CPUCFGR_ND ()) {
279 if (1)
280 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
285 SEM_BRANCH_FINI (vpc);
286 return vpc;
287 #undef FLD
290 /* l-jr: l.jr $rB */
292 static SEM_PC
293 SEM_FN_NAME (or1k32bf,l_jr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
295 #define FLD(f) abuf->fields.sfmt_l_sll.f
296 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
297 int UNUSED written = 0;
298 IADDR UNUSED pc = abuf->addr;
299 SEM_BRANCH_INIT
300 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
305 USI opval = GET_H_GPR (FLD (f_r3));
306 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
307 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
310 if (GET_H_SYS_CPUCFGR_ND ()) {
311 if (1)
312 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
316 SEM_BRANCH_FINI (vpc);
317 return vpc;
318 #undef FLD
321 /* l-jalr: l.jalr $rB */
323 static SEM_PC
324 SEM_FN_NAME (or1k32bf,l_jalr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
326 #define FLD(f) abuf->fields.sfmt_l_sll.f
327 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
328 int UNUSED written = 0;
329 IADDR UNUSED pc = abuf->addr;
330 SEM_BRANCH_INIT
331 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
335 USI opval = ADDSI (pc, ((GET_H_SYS_CPUCFGR_ND ()) ? (4) : (8)));
336 SET_H_GPR (((UINT) 9), opval);
337 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
342 USI opval = GET_H_GPR (FLD (f_r3));
343 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
344 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
347 if (GET_H_SYS_CPUCFGR_ND ()) {
348 if (1)
349 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
354 SEM_BRANCH_FINI (vpc);
355 return vpc;
356 #undef FLD
359 /* l-bnf: l.bnf ${disp26} */
361 static SEM_PC
362 SEM_FN_NAME (or1k32bf,l_bnf) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
364 #define FLD(f) abuf->fields.sfmt_l_j.f
365 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
366 int UNUSED written = 0;
367 IADDR UNUSED pc = abuf->addr;
368 SEM_BRANCH_INIT
369 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
372 if (NOTSI (GET_H_SYS_SR_F ())) {
375 USI opval = FLD (i_disp26);
376 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
377 written |= (1 << 4);
378 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
381 } else {
382 if (GET_H_SYS_CPUCFGR_ND ()) {
385 USI opval = ADDSI (pc, 4);
386 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
387 written |= (1 << 4);
388 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
393 if (GET_H_SYS_CPUCFGR_ND ()) {
394 if (1)
395 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
399 abuf->written = written;
400 SEM_BRANCH_FINI (vpc);
401 return vpc;
402 #undef FLD
405 /* l-bf: l.bf ${disp26} */
407 static SEM_PC
408 SEM_FN_NAME (or1k32bf,l_bf) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
410 #define FLD(f) abuf->fields.sfmt_l_j.f
411 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
412 int UNUSED written = 0;
413 IADDR UNUSED pc = abuf->addr;
414 SEM_BRANCH_INIT
415 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
418 if (GET_H_SYS_SR_F ()) {
421 USI opval = FLD (i_disp26);
422 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
423 written |= (1 << 4);
424 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
427 } else {
428 if (GET_H_SYS_CPUCFGR_ND ()) {
431 USI opval = ADDSI (pc, 4);
432 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
433 written |= (1 << 4);
434 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
439 if (GET_H_SYS_CPUCFGR_ND ()) {
440 if (1)
441 SEM_SKIP_INSN (current_cpu, sem_arg, vpc);
445 abuf->written = written;
446 SEM_BRANCH_FINI (vpc);
447 return vpc;
448 #undef FLD
451 /* l-trap: l.trap ${uimm16} */
453 static SEM_PC
454 SEM_FN_NAME (or1k32bf,l_trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
456 #define FLD(f) abuf->fields.sfmt_empty.f
457 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
458 int UNUSED written = 0;
459 IADDR UNUSED pc = abuf->addr;
460 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
462 or1k32bf_exception (current_cpu, pc, EXCEPT_TRAP);
464 return vpc;
465 #undef FLD
468 /* l-sys: l.sys ${uimm16} */
470 static SEM_PC
471 SEM_FN_NAME (or1k32bf,l_sys) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
473 #define FLD(f) abuf->fields.sfmt_empty.f
474 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
475 int UNUSED written = 0;
476 IADDR UNUSED pc = abuf->addr;
477 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
479 or1k32bf_exception (current_cpu, pc, EXCEPT_SYSCALL);
481 return vpc;
482 #undef FLD
485 /* l-msync: l.msync */
487 static SEM_PC
488 SEM_FN_NAME (or1k32bf,l_msync) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
490 #define FLD(f) abuf->fields.sfmt_empty.f
491 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
492 int UNUSED written = 0;
493 IADDR UNUSED pc = abuf->addr;
494 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
496 ((void) 0); /*nop*/
498 return vpc;
499 #undef FLD
502 /* l-psync: l.psync */
504 static SEM_PC
505 SEM_FN_NAME (or1k32bf,l_psync) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
507 #define FLD(f) abuf->fields.sfmt_empty.f
508 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
509 int UNUSED written = 0;
510 IADDR UNUSED pc = abuf->addr;
511 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
513 ((void) 0); /*nop*/
515 return vpc;
516 #undef FLD
519 /* l-csync: l.csync */
521 static SEM_PC
522 SEM_FN_NAME (or1k32bf,l_csync) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
524 #define FLD(f) abuf->fields.sfmt_empty.f
525 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
526 int UNUSED written = 0;
527 IADDR UNUSED pc = abuf->addr;
528 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
530 ((void) 0); /*nop*/
532 return vpc;
533 #undef FLD
536 /* l-rfe: l.rfe */
538 static SEM_PC
539 SEM_FN_NAME (or1k32bf,l_rfe) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
541 #define FLD(f) abuf->fields.sfmt_empty.f
542 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
543 int UNUSED written = 0;
544 IADDR UNUSED pc = abuf->addr;
545 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
547 or1k32bf_rfe (current_cpu);
549 return vpc;
550 #undef FLD
553 /* l-nop-imm: l.nop ${uimm16} */
555 static SEM_PC
556 SEM_FN_NAME (or1k32bf,l_nop_imm) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
558 #define FLD(f) abuf->fields.sfmt_l_mfspr.f
559 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
560 int UNUSED written = 0;
561 IADDR UNUSED pc = abuf->addr;
562 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
564 or1k32bf_nop (current_cpu, ZEXTSISI (FLD (f_uimm16)));
566 return vpc;
567 #undef FLD
570 /* l-movhi: l.movhi $rD,$uimm16 */
572 static SEM_PC
573 SEM_FN_NAME (or1k32bf,l_movhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
575 #define FLD(f) abuf->fields.sfmt_l_mfspr.f
576 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
577 int UNUSED written = 0;
578 IADDR UNUSED pc = abuf->addr;
579 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
582 USI opval = SLLSI (ZEXTSISI (FLD (f_uimm16)), 16);
583 SET_H_GPR (FLD (f_r1), opval);
584 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
587 return vpc;
588 #undef FLD
591 /* l-macrc: l.macrc $rD */
593 static SEM_PC
594 SEM_FN_NAME (or1k32bf,l_macrc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
596 #define FLD(f) abuf->fields.sfmt_l_adrp.f
597 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
598 int UNUSED written = 0;
599 IADDR UNUSED pc = abuf->addr;
600 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
604 USI opval = GET_H_MAC_MACLO ();
605 SET_H_GPR (FLD (f_r1), opval);
606 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
609 USI opval = 0;
610 SET_H_MAC_MACLO (opval);
611 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
614 USI opval = 0;
615 SET_H_MAC_MACHI (opval);
616 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
620 return vpc;
621 #undef FLD
624 /* l-mfspr: l.mfspr $rD,$rA,${uimm16} */
626 static SEM_PC
627 SEM_FN_NAME (or1k32bf,l_mfspr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
629 #define FLD(f) abuf->fields.sfmt_l_mfspr.f
630 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
631 int UNUSED written = 0;
632 IADDR UNUSED pc = abuf->addr;
633 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
636 USI opval = or1k32bf_mfspr (current_cpu, ORSI (GET_H_GPR (FLD (f_r2)), ZEXTSISI (FLD (f_uimm16))));
637 SET_H_GPR (FLD (f_r1), opval);
638 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
641 return vpc;
642 #undef FLD
645 /* l-mtspr: l.mtspr $rA,$rB,${uimm16-split} */
647 static SEM_PC
648 SEM_FN_NAME (or1k32bf,l_mtspr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
650 #define FLD(f) abuf->fields.sfmt_l_mtspr.f
651 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
652 int UNUSED written = 0;
653 IADDR UNUSED pc = abuf->addr;
654 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
656 or1k32bf_mtspr (current_cpu, ORSI (GET_H_GPR (FLD (f_r2)), ZEXTSISI (FLD (f_uimm16_split))), GET_H_GPR (FLD (f_r3)));
658 return vpc;
659 #undef FLD
662 /* l-lwz: l.lwz $rD,${simm16}($rA) */
664 static SEM_PC
665 SEM_FN_NAME (or1k32bf,l_lwz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
667 #define FLD(f) abuf->fields.sfmt_l_lwz.f
668 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
669 int UNUSED written = 0;
670 IADDR UNUSED pc = abuf->addr;
671 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
674 USI opval = ZEXTSISI (GETMEMUSI (current_cpu, pc, or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 4)));
675 SET_H_GPR (FLD (f_r1), opval);
676 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
679 return vpc;
680 #undef FLD
683 /* l-lws: l.lws $rD,${simm16}($rA) */
685 static SEM_PC
686 SEM_FN_NAME (or1k32bf,l_lws) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
688 #define FLD(f) abuf->fields.sfmt_l_lwz.f
689 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
690 int UNUSED written = 0;
691 IADDR UNUSED pc = abuf->addr;
692 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
695 SI opval = EXTSISI (GETMEMSI (current_cpu, pc, or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 4)));
696 SET_H_GPR (FLD (f_r1), opval);
697 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
700 return vpc;
701 #undef FLD
704 /* l-lwa: l.lwa $rD,${simm16}($rA) */
706 static SEM_PC
707 SEM_FN_NAME (or1k32bf,l_lwa) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
709 #define FLD(f) abuf->fields.sfmt_l_lwz.f
710 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
711 int UNUSED written = 0;
712 IADDR UNUSED pc = abuf->addr;
713 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
717 USI opval = ZEXTSISI (GETMEMUSI (current_cpu, pc, or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 4)));
718 SET_H_GPR (FLD (f_r1), opval);
719 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
722 BI opval = 1;
723 CPU (h_atomic_reserve) = opval;
724 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-reserve", 'x', opval);
727 SI opval = or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 4);
728 CPU (h_atomic_address) = opval;
729 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-address", 'x', opval);
733 return vpc;
734 #undef FLD
737 /* l-lbz: l.lbz $rD,${simm16}($rA) */
739 static SEM_PC
740 SEM_FN_NAME (or1k32bf,l_lbz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
742 #define FLD(f) abuf->fields.sfmt_l_lwz.f
743 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
744 int UNUSED written = 0;
745 IADDR UNUSED pc = abuf->addr;
746 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
749 USI opval = ZEXTQISI (GETMEMUQI (current_cpu, pc, or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 1)));
750 SET_H_GPR (FLD (f_r1), opval);
751 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
754 return vpc;
755 #undef FLD
758 /* l-lbs: l.lbs $rD,${simm16}($rA) */
760 static SEM_PC
761 SEM_FN_NAME (or1k32bf,l_lbs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
763 #define FLD(f) abuf->fields.sfmt_l_lwz.f
764 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
765 int UNUSED written = 0;
766 IADDR UNUSED pc = abuf->addr;
767 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
770 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 1)));
771 SET_H_GPR (FLD (f_r1), opval);
772 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
775 return vpc;
776 #undef FLD
779 /* l-lhz: l.lhz $rD,${simm16}($rA) */
781 static SEM_PC
782 SEM_FN_NAME (or1k32bf,l_lhz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
784 #define FLD(f) abuf->fields.sfmt_l_lwz.f
785 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
786 int UNUSED written = 0;
787 IADDR UNUSED pc = abuf->addr;
788 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
791 USI opval = ZEXTHISI (GETMEMUHI (current_cpu, pc, or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 2)));
792 SET_H_GPR (FLD (f_r1), opval);
793 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
796 return vpc;
797 #undef FLD
800 /* l-lhs: l.lhs $rD,${simm16}($rA) */
802 static SEM_PC
803 SEM_FN_NAME (or1k32bf,l_lhs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
805 #define FLD(f) abuf->fields.sfmt_l_lwz.f
806 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
807 int UNUSED written = 0;
808 IADDR UNUSED pc = abuf->addr;
809 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
812 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 2)));
813 SET_H_GPR (FLD (f_r1), opval);
814 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
817 return vpc;
818 #undef FLD
821 /* l-sw: l.sw ${simm16-split}($rA),$rB */
823 static SEM_PC
824 SEM_FN_NAME (or1k32bf,l_sw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
826 #define FLD(f) abuf->fields.sfmt_l_sw.f
827 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
828 int UNUSED written = 0;
829 IADDR UNUSED pc = abuf->addr;
830 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
833 SI tmp_addr;
834 tmp_addr = or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16_split)), 4);
836 USI opval = TRUNCSISI (GET_H_GPR (FLD (f_r3)));
837 SETMEMUSI (current_cpu, pc, tmp_addr, opval);
838 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
840 if (EQSI (ANDSI (tmp_addr, 268435452), CPU (h_atomic_address))) {
842 BI opval = 0;
843 CPU (h_atomic_reserve) = opval;
844 written |= (1 << 4);
845 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-reserve", 'x', opval);
850 abuf->written = written;
851 return vpc;
852 #undef FLD
855 /* l-sb: l.sb ${simm16-split}($rA),$rB */
857 static SEM_PC
858 SEM_FN_NAME (or1k32bf,l_sb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
860 #define FLD(f) abuf->fields.sfmt_l_sw.f
861 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
862 int UNUSED written = 0;
863 IADDR UNUSED pc = abuf->addr;
864 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
867 SI tmp_addr;
868 tmp_addr = or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16_split)), 1);
870 UQI opval = TRUNCSIQI (GET_H_GPR (FLD (f_r3)));
871 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
872 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
874 if (EQSI (ANDSI (tmp_addr, 268435452), CPU (h_atomic_address))) {
876 BI opval = 0;
877 CPU (h_atomic_reserve) = opval;
878 written |= (1 << 4);
879 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-reserve", 'x', opval);
884 abuf->written = written;
885 return vpc;
886 #undef FLD
889 /* l-sh: l.sh ${simm16-split}($rA),$rB */
891 static SEM_PC
892 SEM_FN_NAME (or1k32bf,l_sh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
894 #define FLD(f) abuf->fields.sfmt_l_sw.f
895 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
896 int UNUSED written = 0;
897 IADDR UNUSED pc = abuf->addr;
898 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
901 SI tmp_addr;
902 tmp_addr = or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16_split)), 2);
904 UHI opval = TRUNCSIHI (GET_H_GPR (FLD (f_r3)));
905 SETMEMUHI (current_cpu, pc, tmp_addr, opval);
906 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
908 if (EQSI (ANDSI (tmp_addr, 268435452), CPU (h_atomic_address))) {
910 BI opval = 0;
911 CPU (h_atomic_reserve) = opval;
912 written |= (1 << 4);
913 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-reserve", 'x', opval);
918 abuf->written = written;
919 return vpc;
920 #undef FLD
923 /* l-swa: l.swa ${simm16-split}($rA),$rB */
925 static SEM_PC
926 SEM_FN_NAME (or1k32bf,l_swa) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
928 #define FLD(f) abuf->fields.sfmt_l_sw.f
929 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
930 int UNUSED written = 0;
931 IADDR UNUSED pc = abuf->addr;
932 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
935 SI tmp_addr;
936 tmp_addr = or1k32bf_make_load_store_addr (current_cpu, GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16_split)), 4);
938 USI opval = ANDBI (CPU (h_atomic_reserve), EQSI (tmp_addr, CPU (h_atomic_address)));
939 SET_H_SYS_SR_F (opval);
940 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
942 if (GET_H_SYS_SR_F ()) {
944 USI opval = TRUNCSISI (GET_H_GPR (FLD (f_r3)));
945 SETMEMUSI (current_cpu, pc, tmp_addr, opval);
946 written |= (1 << 7);
947 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
951 BI opval = 0;
952 CPU (h_atomic_reserve) = opval;
953 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-reserve", 'x', opval);
957 abuf->written = written;
958 return vpc;
959 #undef FLD
962 /* l-sll: l.sll $rD,$rA,$rB */
964 static SEM_PC
965 SEM_FN_NAME (or1k32bf,l_sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
967 #define FLD(f) abuf->fields.sfmt_l_sll.f
968 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
969 int UNUSED written = 0;
970 IADDR UNUSED pc = abuf->addr;
971 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
974 USI opval = SLLSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
975 SET_H_GPR (FLD (f_r1), opval);
976 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
979 return vpc;
980 #undef FLD
983 /* l-slli: l.slli $rD,$rA,${uimm6} */
985 static SEM_PC
986 SEM_FN_NAME (or1k32bf,l_slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
988 #define FLD(f) abuf->fields.sfmt_l_slli.f
989 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
990 int UNUSED written = 0;
991 IADDR UNUSED pc = abuf->addr;
992 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
995 USI opval = SLLSI (GET_H_GPR (FLD (f_r2)), FLD (f_uimm6));
996 SET_H_GPR (FLD (f_r1), opval);
997 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1000 return vpc;
1001 #undef FLD
1004 /* l-srl: l.srl $rD,$rA,$rB */
1006 static SEM_PC
1007 SEM_FN_NAME (or1k32bf,l_srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1009 #define FLD(f) abuf->fields.sfmt_l_sll.f
1010 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1011 int UNUSED written = 0;
1012 IADDR UNUSED pc = abuf->addr;
1013 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1016 USI opval = SRLSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1017 SET_H_GPR (FLD (f_r1), opval);
1018 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1021 return vpc;
1022 #undef FLD
1025 /* l-srli: l.srli $rD,$rA,${uimm6} */
1027 static SEM_PC
1028 SEM_FN_NAME (or1k32bf,l_srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1030 #define FLD(f) abuf->fields.sfmt_l_slli.f
1031 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1032 int UNUSED written = 0;
1033 IADDR UNUSED pc = abuf->addr;
1034 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1037 USI opval = SRLSI (GET_H_GPR (FLD (f_r2)), FLD (f_uimm6));
1038 SET_H_GPR (FLD (f_r1), opval);
1039 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1042 return vpc;
1043 #undef FLD
1046 /* l-sra: l.sra $rD,$rA,$rB */
1048 static SEM_PC
1049 SEM_FN_NAME (or1k32bf,l_sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1051 #define FLD(f) abuf->fields.sfmt_l_sll.f
1052 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1053 int UNUSED written = 0;
1054 IADDR UNUSED pc = abuf->addr;
1055 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1058 USI opval = SRASI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1059 SET_H_GPR (FLD (f_r1), opval);
1060 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1063 return vpc;
1064 #undef FLD
1067 /* l-srai: l.srai $rD,$rA,${uimm6} */
1069 static SEM_PC
1070 SEM_FN_NAME (or1k32bf,l_srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1072 #define FLD(f) abuf->fields.sfmt_l_slli.f
1073 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1074 int UNUSED written = 0;
1075 IADDR UNUSED pc = abuf->addr;
1076 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1079 USI opval = SRASI (GET_H_GPR (FLD (f_r2)), FLD (f_uimm6));
1080 SET_H_GPR (FLD (f_r1), opval);
1081 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1084 return vpc;
1085 #undef FLD
1088 /* l-ror: l.ror $rD,$rA,$rB */
1090 static SEM_PC
1091 SEM_FN_NAME (or1k32bf,l_ror) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1093 #define FLD(f) abuf->fields.sfmt_l_sll.f
1094 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1095 int UNUSED written = 0;
1096 IADDR UNUSED pc = abuf->addr;
1097 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1100 USI opval = RORSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1101 SET_H_GPR (FLD (f_r1), opval);
1102 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1105 return vpc;
1106 #undef FLD
1109 /* l-rori: l.rori $rD,$rA,${uimm6} */
1111 static SEM_PC
1112 SEM_FN_NAME (or1k32bf,l_rori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1114 #define FLD(f) abuf->fields.sfmt_l_slli.f
1115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1116 int UNUSED written = 0;
1117 IADDR UNUSED pc = abuf->addr;
1118 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1121 USI opval = RORSI (GET_H_GPR (FLD (f_r2)), FLD (f_uimm6));
1122 SET_H_GPR (FLD (f_r1), opval);
1123 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1126 return vpc;
1127 #undef FLD
1130 /* l-and: l.and $rD,$rA,$rB */
1132 static SEM_PC
1133 SEM_FN_NAME (or1k32bf,l_and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1135 #define FLD(f) abuf->fields.sfmt_l_sll.f
1136 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1137 int UNUSED written = 0;
1138 IADDR UNUSED pc = abuf->addr;
1139 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1142 USI opval = ANDSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1143 SET_H_GPR (FLD (f_r1), opval);
1144 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1147 return vpc;
1148 #undef FLD
1151 /* l-or: l.or $rD,$rA,$rB */
1153 static SEM_PC
1154 SEM_FN_NAME (or1k32bf,l_or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1156 #define FLD(f) abuf->fields.sfmt_l_sll.f
1157 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1158 int UNUSED written = 0;
1159 IADDR UNUSED pc = abuf->addr;
1160 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1163 USI opval = ORSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1164 SET_H_GPR (FLD (f_r1), opval);
1165 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1168 return vpc;
1169 #undef FLD
1172 /* l-xor: l.xor $rD,$rA,$rB */
1174 static SEM_PC
1175 SEM_FN_NAME (or1k32bf,l_xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1177 #define FLD(f) abuf->fields.sfmt_l_sll.f
1178 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1179 int UNUSED written = 0;
1180 IADDR UNUSED pc = abuf->addr;
1181 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1184 USI opval = XORSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1185 SET_H_GPR (FLD (f_r1), opval);
1186 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1189 return vpc;
1190 #undef FLD
1193 /* l-add: l.add $rD,$rA,$rB */
1195 static SEM_PC
1196 SEM_FN_NAME (or1k32bf,l_add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1198 #define FLD(f) abuf->fields.sfmt_l_sll.f
1199 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1200 int UNUSED written = 0;
1201 IADDR UNUSED pc = abuf->addr;
1202 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1207 BI opval = ADDCFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)), 0);
1208 SET_H_SYS_SR_CY (opval);
1209 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1212 BI opval = ADDOFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)), 0);
1213 SET_H_SYS_SR_OV (opval);
1214 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1217 USI opval = ADDSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1218 SET_H_GPR (FLD (f_r1), opval);
1219 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1222 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
1223 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1227 return vpc;
1228 #undef FLD
1231 /* l-sub: l.sub $rD,$rA,$rB */
1233 static SEM_PC
1234 SEM_FN_NAME (or1k32bf,l_sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1236 #define FLD(f) abuf->fields.sfmt_l_sll.f
1237 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1238 int UNUSED written = 0;
1239 IADDR UNUSED pc = abuf->addr;
1240 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1245 BI opval = SUBCFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)), 0);
1246 SET_H_SYS_SR_CY (opval);
1247 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1250 BI opval = SUBOFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)), 0);
1251 SET_H_SYS_SR_OV (opval);
1252 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1255 USI opval = SUBSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1256 SET_H_GPR (FLD (f_r1), opval);
1257 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1260 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
1261 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1265 return vpc;
1266 #undef FLD
1269 /* l-addc: l.addc $rD,$rA,$rB */
1271 static SEM_PC
1272 SEM_FN_NAME (or1k32bf,l_addc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1274 #define FLD(f) abuf->fields.sfmt_l_sll.f
1275 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1276 int UNUSED written = 0;
1277 IADDR UNUSED pc = abuf->addr;
1278 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1282 BI tmp_tmp_sys_sr_cy;
1283 tmp_tmp_sys_sr_cy = GET_H_SYS_SR_CY ();
1285 BI opval = ADDCFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)), tmp_tmp_sys_sr_cy);
1286 SET_H_SYS_SR_CY (opval);
1287 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1290 BI opval = ADDOFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)), tmp_tmp_sys_sr_cy);
1291 SET_H_SYS_SR_OV (opval);
1292 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1295 USI opval = ADDCSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)), tmp_tmp_sys_sr_cy);
1296 SET_H_GPR (FLD (f_r1), opval);
1297 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1300 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
1301 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1305 return vpc;
1306 #undef FLD
1309 /* l-mul: l.mul $rD,$rA,$rB */
1311 static SEM_PC
1312 SEM_FN_NAME (or1k32bf,l_mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1314 #define FLD(f) abuf->fields.sfmt_l_sll.f
1315 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1316 int UNUSED written = 0;
1317 IADDR UNUSED pc = abuf->addr;
1318 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1323 BI opval = MUL2OFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1324 SET_H_SYS_SR_OV (opval);
1325 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1328 USI opval = MULSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1329 SET_H_GPR (FLD (f_r1), opval);
1330 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1333 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
1334 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1338 return vpc;
1339 #undef FLD
1342 /* l-muld: l.muld $rA,$rB */
1344 static SEM_PC
1345 SEM_FN_NAME (or1k32bf,l_muld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1347 #define FLD(f) abuf->fields.sfmt_l_sll.f
1348 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1349 int UNUSED written = 0;
1350 IADDR UNUSED pc = abuf->addr;
1351 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1354 DI tmp_result;
1355 tmp_result = MULDI (EXTSIDI (GET_H_GPR (FLD (f_r2))), EXTSIDI (GET_H_GPR (FLD (f_r3))));
1357 SI opval = SUBWORDDISI (tmp_result, 0);
1358 SET_H_MAC_MACHI (opval);
1359 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
1362 SI opval = SUBWORDDISI (tmp_result, 1);
1363 SET_H_MAC_MACLO (opval);
1364 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
1368 return vpc;
1369 #undef FLD
1372 /* l-mulu: l.mulu $rD,$rA,$rB */
1374 static SEM_PC
1375 SEM_FN_NAME (or1k32bf,l_mulu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1377 #define FLD(f) abuf->fields.sfmt_l_sll.f
1378 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1379 int UNUSED written = 0;
1380 IADDR UNUSED pc = abuf->addr;
1381 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1386 BI opval = MUL1OFSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1387 SET_H_SYS_SR_CY (opval);
1388 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1391 USI opval = MULSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1392 SET_H_GPR (FLD (f_r1), opval);
1393 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1396 if (ANDIF (GET_H_SYS_SR_CY (), GET_H_SYS_SR_OVE ())) {
1397 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1401 return vpc;
1402 #undef FLD
1405 /* l-muldu: l.muldu $rA,$rB */
1407 static SEM_PC
1408 SEM_FN_NAME (or1k32bf,l_muldu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1410 #define FLD(f) abuf->fields.sfmt_l_sll.f
1411 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1412 int UNUSED written = 0;
1413 IADDR UNUSED pc = abuf->addr;
1414 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1417 DI tmp_result;
1418 tmp_result = MULDI (ZEXTSIDI (GET_H_GPR (FLD (f_r2))), ZEXTSIDI (GET_H_GPR (FLD (f_r3))));
1420 SI opval = SUBWORDDISI (tmp_result, 0);
1421 SET_H_MAC_MACHI (opval);
1422 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
1425 SI opval = SUBWORDDISI (tmp_result, 1);
1426 SET_H_MAC_MACLO (opval);
1427 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
1431 return vpc;
1432 #undef FLD
1435 /* l-div: l.div $rD,$rA,$rB */
1437 static SEM_PC
1438 SEM_FN_NAME (or1k32bf,l_div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1440 #define FLD(f) abuf->fields.sfmt_l_sll.f
1441 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1442 int UNUSED written = 0;
1443 IADDR UNUSED pc = abuf->addr;
1444 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1446 if (NESI (GET_H_GPR (FLD (f_r3)), 0)) {
1449 BI opval = 0;
1450 SET_H_SYS_SR_OV (opval);
1451 written |= (1 << 5);
1452 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1455 SI opval = DIVSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1456 SET_H_GPR (FLD (f_r1), opval);
1457 written |= (1 << 4);
1458 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1461 } else {
1464 BI opval = 1;
1465 SET_H_SYS_SR_OV (opval);
1466 written |= (1 << 5);
1467 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1469 if (GET_H_SYS_SR_OVE ()) {
1470 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1475 abuf->written = written;
1476 return vpc;
1477 #undef FLD
1480 /* l-divu: l.divu $rD,$rA,$rB */
1482 static SEM_PC
1483 SEM_FN_NAME (or1k32bf,l_divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1485 #define FLD(f) abuf->fields.sfmt_l_sll.f
1486 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1487 int UNUSED written = 0;
1488 IADDR UNUSED pc = abuf->addr;
1489 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1491 if (NESI (GET_H_GPR (FLD (f_r3)), 0)) {
1494 BI opval = 0;
1495 SET_H_SYS_SR_CY (opval);
1496 written |= (1 << 5);
1497 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1500 USI opval = UDIVSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1501 SET_H_GPR (FLD (f_r1), opval);
1502 written |= (1 << 4);
1503 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1506 } else {
1509 BI opval = 1;
1510 SET_H_SYS_SR_CY (opval);
1511 written |= (1 << 5);
1512 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1514 if (GET_H_SYS_SR_OVE ()) {
1515 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1520 abuf->written = written;
1521 return vpc;
1522 #undef FLD
1525 /* l-ff1: l.ff1 $rD,$rA */
1527 static SEM_PC
1528 SEM_FN_NAME (or1k32bf,l_ff1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1530 #define FLD(f) abuf->fields.sfmt_l_slli.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);
1537 USI opval = or1k32bf_ff1 (current_cpu, GET_H_GPR (FLD (f_r2)));
1538 SET_H_GPR (FLD (f_r1), opval);
1539 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1542 return vpc;
1543 #undef FLD
1546 /* l-fl1: l.fl1 $rD,$rA */
1548 static SEM_PC
1549 SEM_FN_NAME (or1k32bf,l_fl1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1551 #define FLD(f) abuf->fields.sfmt_l_slli.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);
1558 USI opval = or1k32bf_fl1 (current_cpu, GET_H_GPR (FLD (f_r2)));
1559 SET_H_GPR (FLD (f_r1), opval);
1560 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1563 return vpc;
1564 #undef FLD
1567 /* l-andi: l.andi $rD,$rA,$uimm16 */
1569 static SEM_PC
1570 SEM_FN_NAME (or1k32bf,l_andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1572 #define FLD(f) abuf->fields.sfmt_l_mfspr.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);
1579 USI opval = ANDSI (GET_H_GPR (FLD (f_r2)), ZEXTSISI (FLD (f_uimm16)));
1580 SET_H_GPR (FLD (f_r1), opval);
1581 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1584 return vpc;
1585 #undef FLD
1588 /* l-ori: l.ori $rD,$rA,$uimm16 */
1590 static SEM_PC
1591 SEM_FN_NAME (or1k32bf,l_ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1593 #define FLD(f) abuf->fields.sfmt_l_mfspr.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);
1600 USI opval = ORSI (GET_H_GPR (FLD (f_r2)), ZEXTSISI (FLD (f_uimm16)));
1601 SET_H_GPR (FLD (f_r1), opval);
1602 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1605 return vpc;
1606 #undef FLD
1609 /* l-xori: l.xori $rD,$rA,$simm16 */
1611 static SEM_PC
1612 SEM_FN_NAME (or1k32bf,l_xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1614 #define FLD(f) abuf->fields.sfmt_l_lwz.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);
1621 USI opval = XORSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
1622 SET_H_GPR (FLD (f_r1), opval);
1623 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1626 return vpc;
1627 #undef FLD
1630 /* l-addi: l.addi $rD,$rA,$simm16 */
1632 static SEM_PC
1633 SEM_FN_NAME (or1k32bf,l_addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1635 #define FLD(f) abuf->fields.sfmt_l_lwz.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);
1644 BI opval = ADDCFSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 0);
1645 SET_H_SYS_SR_CY (opval);
1646 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1649 BI opval = ADDOFSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), 0);
1650 SET_H_SYS_SR_OV (opval);
1651 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1654 USI opval = ADDSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
1655 SET_H_GPR (FLD (f_r1), opval);
1656 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1659 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
1660 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1664 return vpc;
1665 #undef FLD
1668 /* l-addic: l.addic $rD,$rA,$simm16 */
1670 static SEM_PC
1671 SEM_FN_NAME (or1k32bf,l_addic) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1673 #define FLD(f) abuf->fields.sfmt_l_lwz.f
1674 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1675 int UNUSED written = 0;
1676 IADDR UNUSED pc = abuf->addr;
1677 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1681 BI tmp_tmp_sys_sr_cy;
1682 tmp_tmp_sys_sr_cy = GET_H_SYS_SR_CY ();
1684 BI opval = ADDCFSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), tmp_tmp_sys_sr_cy);
1685 SET_H_SYS_SR_CY (opval);
1686 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
1689 BI opval = ADDOFSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), tmp_tmp_sys_sr_cy);
1690 SET_H_SYS_SR_OV (opval);
1691 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1694 SI opval = ADDCSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)), tmp_tmp_sys_sr_cy);
1695 SET_H_GPR (FLD (f_r1), opval);
1696 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1699 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
1700 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1704 return vpc;
1705 #undef FLD
1708 /* l-muli: l.muli $rD,$rA,$simm16 */
1710 static SEM_PC
1711 SEM_FN_NAME (or1k32bf,l_muli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1713 #define FLD(f) abuf->fields.sfmt_l_lwz.f
1714 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1715 int UNUSED written = 0;
1716 IADDR UNUSED pc = abuf->addr;
1717 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1722 USI opval = MUL2OFSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
1723 SET_H_SYS_SR_OV (opval);
1724 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
1727 USI opval = MULSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
1728 SET_H_GPR (FLD (f_r1), opval);
1729 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1732 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
1733 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
1737 return vpc;
1738 #undef FLD
1741 /* l-exths: l.exths $rD,$rA */
1743 static SEM_PC
1744 SEM_FN_NAME (or1k32bf,l_exths) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1746 #define FLD(f) abuf->fields.sfmt_l_slli.f
1747 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1748 int UNUSED written = 0;
1749 IADDR UNUSED pc = abuf->addr;
1750 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1753 USI opval = EXTHISI (TRUNCSIHI (GET_H_GPR (FLD (f_r2))));
1754 SET_H_GPR (FLD (f_r1), opval);
1755 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1758 return vpc;
1759 #undef FLD
1762 /* l-extbs: l.extbs $rD,$rA */
1764 static SEM_PC
1765 SEM_FN_NAME (or1k32bf,l_extbs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1767 #define FLD(f) abuf->fields.sfmt_l_slli.f
1768 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1769 int UNUSED written = 0;
1770 IADDR UNUSED pc = abuf->addr;
1771 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1774 USI opval = EXTQISI (TRUNCSIQI (GET_H_GPR (FLD (f_r2))));
1775 SET_H_GPR (FLD (f_r1), opval);
1776 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1779 return vpc;
1780 #undef FLD
1783 /* l-exthz: l.exthz $rD,$rA */
1785 static SEM_PC
1786 SEM_FN_NAME (or1k32bf,l_exthz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1788 #define FLD(f) abuf->fields.sfmt_l_slli.f
1789 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1790 int UNUSED written = 0;
1791 IADDR UNUSED pc = abuf->addr;
1792 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1795 USI opval = ZEXTHISI (TRUNCSIHI (GET_H_GPR (FLD (f_r2))));
1796 SET_H_GPR (FLD (f_r1), opval);
1797 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1800 return vpc;
1801 #undef FLD
1804 /* l-extbz: l.extbz $rD,$rA */
1806 static SEM_PC
1807 SEM_FN_NAME (or1k32bf,l_extbz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1809 #define FLD(f) abuf->fields.sfmt_l_slli.f
1810 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1811 int UNUSED written = 0;
1812 IADDR UNUSED pc = abuf->addr;
1813 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1816 USI opval = ZEXTQISI (TRUNCSIQI (GET_H_GPR (FLD (f_r2))));
1817 SET_H_GPR (FLD (f_r1), opval);
1818 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1821 return vpc;
1822 #undef FLD
1825 /* l-extws: l.extws $rD,$rA */
1827 static SEM_PC
1828 SEM_FN_NAME (or1k32bf,l_extws) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1830 #define FLD(f) abuf->fields.sfmt_l_slli.f
1831 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1832 int UNUSED written = 0;
1833 IADDR UNUSED pc = abuf->addr;
1834 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1837 USI opval = EXTSISI (TRUNCSISI (GET_H_GPR (FLD (f_r2))));
1838 SET_H_GPR (FLD (f_r1), opval);
1839 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1842 return vpc;
1843 #undef FLD
1846 /* l-extwz: l.extwz $rD,$rA */
1848 static SEM_PC
1849 SEM_FN_NAME (or1k32bf,l_extwz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1851 #define FLD(f) abuf->fields.sfmt_l_slli.f
1852 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1853 int UNUSED written = 0;
1854 IADDR UNUSED pc = abuf->addr;
1855 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1858 USI opval = ZEXTSISI (TRUNCSISI (GET_H_GPR (FLD (f_r2))));
1859 SET_H_GPR (FLD (f_r1), opval);
1860 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1863 return vpc;
1864 #undef FLD
1867 /* l-cmov: l.cmov $rD,$rA,$rB */
1869 static SEM_PC
1870 SEM_FN_NAME (or1k32bf,l_cmov) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1872 #define FLD(f) abuf->fields.sfmt_l_sll.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);
1878 if (GET_H_SYS_SR_F ()) {
1880 USI opval = GET_H_GPR (FLD (f_r2));
1881 SET_H_GPR (FLD (f_r1), opval);
1882 written |= (1 << 3);
1883 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1885 } else {
1887 USI opval = GET_H_GPR (FLD (f_r3));
1888 SET_H_GPR (FLD (f_r1), opval);
1889 written |= (1 << 3);
1890 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
1894 abuf->written = written;
1895 return vpc;
1896 #undef FLD
1899 /* l-sfgts: l.sfgts $rA,$rB */
1901 static SEM_PC
1902 SEM_FN_NAME (or1k32bf,l_sfgts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1904 #define FLD(f) abuf->fields.sfmt_l_sll.f
1905 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1906 int UNUSED written = 0;
1907 IADDR UNUSED pc = abuf->addr;
1908 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1911 USI opval = GTSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1912 SET_H_SYS_SR_F (opval);
1913 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
1916 return vpc;
1917 #undef FLD
1920 /* l-sfgtsi: l.sfgtsi $rA,$simm16 */
1922 static SEM_PC
1923 SEM_FN_NAME (or1k32bf,l_sfgtsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1925 #define FLD(f) abuf->fields.sfmt_l_lwz.f
1926 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1927 int UNUSED written = 0;
1928 IADDR UNUSED pc = abuf->addr;
1929 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1932 USI opval = GTSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
1933 SET_H_SYS_SR_F (opval);
1934 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
1937 return vpc;
1938 #undef FLD
1941 /* l-sfgtu: l.sfgtu $rA,$rB */
1943 static SEM_PC
1944 SEM_FN_NAME (or1k32bf,l_sfgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1946 #define FLD(f) abuf->fields.sfmt_l_sll.f
1947 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1948 int UNUSED written = 0;
1949 IADDR UNUSED pc = abuf->addr;
1950 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1953 USI opval = GTUSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1954 SET_H_SYS_SR_F (opval);
1955 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
1958 return vpc;
1959 #undef FLD
1962 /* l-sfgtui: l.sfgtui $rA,$simm16 */
1964 static SEM_PC
1965 SEM_FN_NAME (or1k32bf,l_sfgtui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1967 #define FLD(f) abuf->fields.sfmt_l_lwz.f
1968 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1969 int UNUSED written = 0;
1970 IADDR UNUSED pc = abuf->addr;
1971 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1974 USI opval = GTUSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
1975 SET_H_SYS_SR_F (opval);
1976 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
1979 return vpc;
1980 #undef FLD
1983 /* l-sfges: l.sfges $rA,$rB */
1985 static SEM_PC
1986 SEM_FN_NAME (or1k32bf,l_sfges) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1988 #define FLD(f) abuf->fields.sfmt_l_sll.f
1989 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1990 int UNUSED written = 0;
1991 IADDR UNUSED pc = abuf->addr;
1992 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1995 USI opval = GESI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
1996 SET_H_SYS_SR_F (opval);
1997 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2000 return vpc;
2001 #undef FLD
2004 /* l-sfgesi: l.sfgesi $rA,$simm16 */
2006 static SEM_PC
2007 SEM_FN_NAME (or1k32bf,l_sfgesi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2009 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2010 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2011 int UNUSED written = 0;
2012 IADDR UNUSED pc = abuf->addr;
2013 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2016 USI opval = GESI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2017 SET_H_SYS_SR_F (opval);
2018 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2021 return vpc;
2022 #undef FLD
2025 /* l-sfgeu: l.sfgeu $rA,$rB */
2027 static SEM_PC
2028 SEM_FN_NAME (or1k32bf,l_sfgeu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2030 #define FLD(f) abuf->fields.sfmt_l_sll.f
2031 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2032 int UNUSED written = 0;
2033 IADDR UNUSED pc = abuf->addr;
2034 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2037 USI opval = GEUSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
2038 SET_H_SYS_SR_F (opval);
2039 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2042 return vpc;
2043 #undef FLD
2046 /* l-sfgeui: l.sfgeui $rA,$simm16 */
2048 static SEM_PC
2049 SEM_FN_NAME (or1k32bf,l_sfgeui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2051 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2052 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2053 int UNUSED written = 0;
2054 IADDR UNUSED pc = abuf->addr;
2055 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2058 USI opval = GEUSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2059 SET_H_SYS_SR_F (opval);
2060 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2063 return vpc;
2064 #undef FLD
2067 /* l-sflts: l.sflts $rA,$rB */
2069 static SEM_PC
2070 SEM_FN_NAME (or1k32bf,l_sflts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2072 #define FLD(f) abuf->fields.sfmt_l_sll.f
2073 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2074 int UNUSED written = 0;
2075 IADDR UNUSED pc = abuf->addr;
2076 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2079 USI opval = LTSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
2080 SET_H_SYS_SR_F (opval);
2081 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2084 return vpc;
2085 #undef FLD
2088 /* l-sfltsi: l.sfltsi $rA,$simm16 */
2090 static SEM_PC
2091 SEM_FN_NAME (or1k32bf,l_sfltsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2093 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2094 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2095 int UNUSED written = 0;
2096 IADDR UNUSED pc = abuf->addr;
2097 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2100 USI opval = LTSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2101 SET_H_SYS_SR_F (opval);
2102 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2105 return vpc;
2106 #undef FLD
2109 /* l-sfltu: l.sfltu $rA,$rB */
2111 static SEM_PC
2112 SEM_FN_NAME (or1k32bf,l_sfltu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2114 #define FLD(f) abuf->fields.sfmt_l_sll.f
2115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2116 int UNUSED written = 0;
2117 IADDR UNUSED pc = abuf->addr;
2118 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2121 USI opval = LTUSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
2122 SET_H_SYS_SR_F (opval);
2123 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2126 return vpc;
2127 #undef FLD
2130 /* l-sfltui: l.sfltui $rA,$simm16 */
2132 static SEM_PC
2133 SEM_FN_NAME (or1k32bf,l_sfltui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2135 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2136 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2137 int UNUSED written = 0;
2138 IADDR UNUSED pc = abuf->addr;
2139 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2142 USI opval = LTUSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2143 SET_H_SYS_SR_F (opval);
2144 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2147 return vpc;
2148 #undef FLD
2151 /* l-sfles: l.sfles $rA,$rB */
2153 static SEM_PC
2154 SEM_FN_NAME (or1k32bf,l_sfles) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2156 #define FLD(f) abuf->fields.sfmt_l_sll.f
2157 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2158 int UNUSED written = 0;
2159 IADDR UNUSED pc = abuf->addr;
2160 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2163 USI opval = LESI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
2164 SET_H_SYS_SR_F (opval);
2165 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2168 return vpc;
2169 #undef FLD
2172 /* l-sflesi: l.sflesi $rA,$simm16 */
2174 static SEM_PC
2175 SEM_FN_NAME (or1k32bf,l_sflesi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2177 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2178 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2179 int UNUSED written = 0;
2180 IADDR UNUSED pc = abuf->addr;
2181 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2184 USI opval = LESI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2185 SET_H_SYS_SR_F (opval);
2186 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2189 return vpc;
2190 #undef FLD
2193 /* l-sfleu: l.sfleu $rA,$rB */
2195 static SEM_PC
2196 SEM_FN_NAME (or1k32bf,l_sfleu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2198 #define FLD(f) abuf->fields.sfmt_l_sll.f
2199 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2200 int UNUSED written = 0;
2201 IADDR UNUSED pc = abuf->addr;
2202 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2205 USI opval = LEUSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
2206 SET_H_SYS_SR_F (opval);
2207 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2210 return vpc;
2211 #undef FLD
2214 /* l-sfleui: l.sfleui $rA,$simm16 */
2216 static SEM_PC
2217 SEM_FN_NAME (or1k32bf,l_sfleui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2219 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2220 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2221 int UNUSED written = 0;
2222 IADDR UNUSED pc = abuf->addr;
2223 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2226 USI opval = LEUSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2227 SET_H_SYS_SR_F (opval);
2228 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2231 return vpc;
2232 #undef FLD
2235 /* l-sfeq: l.sfeq $rA,$rB */
2237 static SEM_PC
2238 SEM_FN_NAME (or1k32bf,l_sfeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2240 #define FLD(f) abuf->fields.sfmt_l_sll.f
2241 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2242 int UNUSED written = 0;
2243 IADDR UNUSED pc = abuf->addr;
2244 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2247 USI opval = EQSI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
2248 SET_H_SYS_SR_F (opval);
2249 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2252 return vpc;
2253 #undef FLD
2256 /* l-sfeqi: l.sfeqi $rA,$simm16 */
2258 static SEM_PC
2259 SEM_FN_NAME (or1k32bf,l_sfeqi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2261 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2262 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2263 int UNUSED written = 0;
2264 IADDR UNUSED pc = abuf->addr;
2265 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2268 USI opval = EQSI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2269 SET_H_SYS_SR_F (opval);
2270 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2273 return vpc;
2274 #undef FLD
2277 /* l-sfne: l.sfne $rA,$rB */
2279 static SEM_PC
2280 SEM_FN_NAME (or1k32bf,l_sfne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2282 #define FLD(f) abuf->fields.sfmt_l_sll.f
2283 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2284 int UNUSED written = 0;
2285 IADDR UNUSED pc = abuf->addr;
2286 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2289 USI opval = NESI (GET_H_GPR (FLD (f_r2)), GET_H_GPR (FLD (f_r3)));
2290 SET_H_SYS_SR_F (opval);
2291 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2294 return vpc;
2295 #undef FLD
2298 /* l-sfnei: l.sfnei $rA,$simm16 */
2300 static SEM_PC
2301 SEM_FN_NAME (or1k32bf,l_sfnei) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2303 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2304 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2305 int UNUSED written = 0;
2306 IADDR UNUSED pc = abuf->addr;
2307 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2310 USI opval = NESI (GET_H_GPR (FLD (f_r2)), EXTSISI (FLD (f_simm16)));
2311 SET_H_SYS_SR_F (opval);
2312 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2315 return vpc;
2316 #undef FLD
2319 /* l-mac: l.mac $rA,$rB */
2321 static SEM_PC
2322 SEM_FN_NAME (or1k32bf,l_mac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2324 #define FLD(f) abuf->fields.sfmt_l_sll.f
2325 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2326 int UNUSED written = 0;
2327 IADDR UNUSED pc = abuf->addr;
2328 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2332 DI tmp_prod;
2333 DI tmp_mac;
2334 DI tmp_result;
2335 tmp_prod = MULDI (EXTSIDI (GET_H_GPR (FLD (f_r2))), EXTSIDI (GET_H_GPR (FLD (f_r3))));
2336 tmp_mac = JOINSIDI (GET_H_MAC_MACHI (), GET_H_MAC_MACLO ());
2337 tmp_result = ADDDI (tmp_prod, tmp_mac);
2339 SI opval = SUBWORDDISI (tmp_result, 0);
2340 SET_H_MAC_MACHI (opval);
2341 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
2344 SI opval = SUBWORDDISI (tmp_result, 1);
2345 SET_H_MAC_MACLO (opval);
2346 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
2349 BI opval = ADDOFDI (tmp_prod, tmp_mac, 0);
2350 SET_H_SYS_SR_OV (opval);
2351 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
2354 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
2355 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
2359 return vpc;
2360 #undef FLD
2363 /* l-maci: l.maci $rA,${simm16} */
2365 static SEM_PC
2366 SEM_FN_NAME (or1k32bf,l_maci) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2368 #define FLD(f) abuf->fields.sfmt_l_lwz.f
2369 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2370 int UNUSED written = 0;
2371 IADDR UNUSED pc = abuf->addr;
2372 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2376 DI tmp_prod;
2377 DI tmp_mac;
2378 DI tmp_result;
2379 tmp_prod = MULDI (EXTSIDI (GET_H_GPR (FLD (f_r2))), EXTSIDI (FLD (f_simm16)));
2380 tmp_mac = JOINSIDI (GET_H_MAC_MACHI (), GET_H_MAC_MACLO ());
2381 tmp_result = ADDDI (tmp_mac, tmp_prod);
2383 SI opval = SUBWORDDISI (tmp_result, 0);
2384 SET_H_MAC_MACHI (opval);
2385 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
2388 SI opval = SUBWORDDISI (tmp_result, 1);
2389 SET_H_MAC_MACLO (opval);
2390 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
2393 BI opval = ADDOFDI (tmp_prod, tmp_mac, 0);
2394 SET_H_SYS_SR_OV (opval);
2395 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
2398 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
2399 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
2403 return vpc;
2404 #undef FLD
2407 /* l-macu: l.macu $rA,$rB */
2409 static SEM_PC
2410 SEM_FN_NAME (or1k32bf,l_macu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2412 #define FLD(f) abuf->fields.sfmt_l_sll.f
2413 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2414 int UNUSED written = 0;
2415 IADDR UNUSED pc = abuf->addr;
2416 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2420 DI tmp_prod;
2421 DI tmp_mac;
2422 DI tmp_result;
2423 tmp_prod = MULDI (ZEXTSIDI (GET_H_GPR (FLD (f_r2))), ZEXTSIDI (GET_H_GPR (FLD (f_r3))));
2424 tmp_mac = JOINSIDI (GET_H_MAC_MACHI (), GET_H_MAC_MACLO ());
2425 tmp_result = ADDDI (tmp_prod, tmp_mac);
2427 SI opval = SUBWORDDISI (tmp_result, 0);
2428 SET_H_MAC_MACHI (opval);
2429 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
2432 SI opval = SUBWORDDISI (tmp_result, 1);
2433 SET_H_MAC_MACLO (opval);
2434 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
2437 BI opval = ADDCFDI (tmp_prod, tmp_mac, 0);
2438 SET_H_SYS_SR_CY (opval);
2439 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
2442 if (ANDIF (GET_H_SYS_SR_CY (), GET_H_SYS_SR_OVE ())) {
2443 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
2447 return vpc;
2448 #undef FLD
2451 /* l-msb: l.msb $rA,$rB */
2453 static SEM_PC
2454 SEM_FN_NAME (or1k32bf,l_msb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2456 #define FLD(f) abuf->fields.sfmt_l_sll.f
2457 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2458 int UNUSED written = 0;
2459 IADDR UNUSED pc = abuf->addr;
2460 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2464 DI tmp_prod;
2465 DI tmp_mac;
2466 DI tmp_result;
2467 tmp_prod = MULDI (EXTSIDI (GET_H_GPR (FLD (f_r2))), EXTSIDI (GET_H_GPR (FLD (f_r3))));
2468 tmp_mac = JOINSIDI (GET_H_MAC_MACHI (), GET_H_MAC_MACLO ());
2469 tmp_result = SUBDI (tmp_mac, tmp_prod);
2471 SI opval = SUBWORDDISI (tmp_result, 0);
2472 SET_H_MAC_MACHI (opval);
2473 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
2476 SI opval = SUBWORDDISI (tmp_result, 1);
2477 SET_H_MAC_MACLO (opval);
2478 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
2481 BI opval = SUBOFDI (tmp_mac, tmp_result, 0);
2482 SET_H_SYS_SR_OV (opval);
2483 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-ov", 'x', opval);
2486 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) {
2487 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
2491 return vpc;
2492 #undef FLD
2495 /* l-msbu: l.msbu $rA,$rB */
2497 static SEM_PC
2498 SEM_FN_NAME (or1k32bf,l_msbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2500 #define FLD(f) abuf->fields.sfmt_l_sll.f
2501 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2502 int UNUSED written = 0;
2503 IADDR UNUSED pc = abuf->addr;
2504 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2508 DI tmp_prod;
2509 DI tmp_mac;
2510 DI tmp_result;
2511 tmp_prod = MULDI (ZEXTSIDI (GET_H_GPR (FLD (f_r2))), ZEXTSIDI (GET_H_GPR (FLD (f_r3))));
2512 tmp_mac = JOINSIDI (GET_H_MAC_MACHI (), GET_H_MAC_MACLO ());
2513 tmp_result = SUBDI (tmp_mac, tmp_prod);
2515 SI opval = SUBWORDDISI (tmp_result, 0);
2516 SET_H_MAC_MACHI (opval);
2517 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval);
2520 SI opval = SUBWORDDISI (tmp_result, 1);
2521 SET_H_MAC_MACLO (opval);
2522 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval);
2525 BI opval = SUBCFDI (tmp_mac, tmp_result, 0);
2526 SET_H_SYS_SR_CY (opval);
2527 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-cy", 'x', opval);
2530 if (ANDIF (GET_H_SYS_SR_CY (), GET_H_SYS_SR_OVE ())) {
2531 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE);
2535 return vpc;
2536 #undef FLD
2539 /* l-cust1: l.cust1 */
2541 static SEM_PC
2542 SEM_FN_NAME (or1k32bf,l_cust1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2544 #define FLD(f) abuf->fields.sfmt_empty.f
2545 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2546 int UNUSED written = 0;
2547 IADDR UNUSED pc = abuf->addr;
2548 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2550 ((void) 0); /*nop*/
2552 return vpc;
2553 #undef FLD
2556 /* l-cust2: l.cust2 */
2558 static SEM_PC
2559 SEM_FN_NAME (or1k32bf,l_cust2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2561 #define FLD(f) abuf->fields.sfmt_empty.f
2562 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2563 int UNUSED written = 0;
2564 IADDR UNUSED pc = abuf->addr;
2565 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2567 ((void) 0); /*nop*/
2569 return vpc;
2570 #undef FLD
2573 /* l-cust3: l.cust3 */
2575 static SEM_PC
2576 SEM_FN_NAME (or1k32bf,l_cust3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2578 #define FLD(f) abuf->fields.sfmt_empty.f
2579 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2580 int UNUSED written = 0;
2581 IADDR UNUSED pc = abuf->addr;
2582 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2584 ((void) 0); /*nop*/
2586 return vpc;
2587 #undef FLD
2590 /* l-cust4: l.cust4 */
2592 static SEM_PC
2593 SEM_FN_NAME (or1k32bf,l_cust4) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2595 #define FLD(f) abuf->fields.sfmt_empty.f
2596 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2597 int UNUSED written = 0;
2598 IADDR UNUSED pc = abuf->addr;
2599 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2601 ((void) 0); /*nop*/
2603 return vpc;
2604 #undef FLD
2607 /* l-cust5: l.cust5 */
2609 static SEM_PC
2610 SEM_FN_NAME (or1k32bf,l_cust5) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2612 #define FLD(f) abuf->fields.sfmt_empty.f
2613 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2614 int UNUSED written = 0;
2615 IADDR UNUSED pc = abuf->addr;
2616 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2618 ((void) 0); /*nop*/
2620 return vpc;
2621 #undef FLD
2624 /* l-cust6: l.cust6 */
2626 static SEM_PC
2627 SEM_FN_NAME (or1k32bf,l_cust6) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2629 #define FLD(f) abuf->fields.sfmt_empty.f
2630 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2631 int UNUSED written = 0;
2632 IADDR UNUSED pc = abuf->addr;
2633 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2635 ((void) 0); /*nop*/
2637 return vpc;
2638 #undef FLD
2641 /* l-cust7: l.cust7 */
2643 static SEM_PC
2644 SEM_FN_NAME (or1k32bf,l_cust7) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2646 #define FLD(f) abuf->fields.sfmt_empty.f
2647 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2648 int UNUSED written = 0;
2649 IADDR UNUSED pc = abuf->addr;
2650 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2652 ((void) 0); /*nop*/
2654 return vpc;
2655 #undef FLD
2658 /* l-cust8: l.cust8 */
2660 static SEM_PC
2661 SEM_FN_NAME (or1k32bf,l_cust8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2663 #define FLD(f) abuf->fields.sfmt_empty.f
2664 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2665 int UNUSED written = 0;
2666 IADDR UNUSED pc = abuf->addr;
2667 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2669 ((void) 0); /*nop*/
2671 return vpc;
2672 #undef FLD
2675 /* lf-add-s: lf.add.s $rDSF,$rASF,$rBSF */
2677 static SEM_PC
2678 SEM_FN_NAME (or1k32bf,lf_add_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2680 #define FLD(f) abuf->fields.sfmt_l_sll.f
2681 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2682 int UNUSED written = 0;
2683 IADDR UNUSED pc = abuf->addr;
2684 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2687 SF opval = CGEN_CPU_FPU (current_cpu)->ops->addsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
2688 SET_H_FSR (FLD (f_r1), opval);
2689 CGEN_TRACE_RESULT (current_cpu, abuf, "fsr", 'f', opval);
2692 return vpc;
2693 #undef FLD
2696 /* lf-add-d32: lf.add.d $rDD32F,$rAD32F,$rBD32F */
2698 static SEM_PC
2699 SEM_FN_NAME (or1k32bf,lf_add_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2701 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
2702 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2703 int UNUSED written = 0;
2704 IADDR UNUSED pc = abuf->addr;
2705 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2708 DF opval = CGEN_CPU_FPU (current_cpu)->ops->adddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
2709 SET_H_FD32R (FLD (f_rdd32), opval);
2710 CGEN_TRACE_RESULT (current_cpu, abuf, "fd32r", 'f', opval);
2713 return vpc;
2714 #undef FLD
2717 /* lf-sub-s: lf.sub.s $rDSF,$rASF,$rBSF */
2719 static SEM_PC
2720 SEM_FN_NAME (or1k32bf,lf_sub_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2722 #define FLD(f) abuf->fields.sfmt_l_sll.f
2723 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2724 int UNUSED written = 0;
2725 IADDR UNUSED pc = abuf->addr;
2726 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2729 SF opval = CGEN_CPU_FPU (current_cpu)->ops->subsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
2730 SET_H_FSR (FLD (f_r1), opval);
2731 CGEN_TRACE_RESULT (current_cpu, abuf, "fsr", 'f', opval);
2734 return vpc;
2735 #undef FLD
2738 /* lf-sub-d32: lf.sub.d $rDD32F,$rAD32F,$rBD32F */
2740 static SEM_PC
2741 SEM_FN_NAME (or1k32bf,lf_sub_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2743 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
2744 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2745 int UNUSED written = 0;
2746 IADDR UNUSED pc = abuf->addr;
2747 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2750 DF opval = CGEN_CPU_FPU (current_cpu)->ops->subdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
2751 SET_H_FD32R (FLD (f_rdd32), opval);
2752 CGEN_TRACE_RESULT (current_cpu, abuf, "fd32r", 'f', opval);
2755 return vpc;
2756 #undef FLD
2759 /* lf-mul-s: lf.mul.s $rDSF,$rASF,$rBSF */
2761 static SEM_PC
2762 SEM_FN_NAME (or1k32bf,lf_mul_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2764 #define FLD(f) abuf->fields.sfmt_l_sll.f
2765 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2766 int UNUSED written = 0;
2767 IADDR UNUSED pc = abuf->addr;
2768 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2771 SF opval = CGEN_CPU_FPU (current_cpu)->ops->mulsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
2772 SET_H_FSR (FLD (f_r1), opval);
2773 CGEN_TRACE_RESULT (current_cpu, abuf, "fsr", 'f', opval);
2776 return vpc;
2777 #undef FLD
2780 /* lf-mul-d32: lf.mul.d $rDD32F,$rAD32F,$rBD32F */
2782 static SEM_PC
2783 SEM_FN_NAME (or1k32bf,lf_mul_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2785 #define FLD(f) abuf->fields.sfmt_lf_add_d32.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);
2792 DF opval = CGEN_CPU_FPU (current_cpu)->ops->muldf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
2793 SET_H_FD32R (FLD (f_rdd32), opval);
2794 CGEN_TRACE_RESULT (current_cpu, abuf, "fd32r", 'f', opval);
2797 return vpc;
2798 #undef FLD
2801 /* lf-div-s: lf.div.s $rDSF,$rASF,$rBSF */
2803 static SEM_PC
2804 SEM_FN_NAME (or1k32bf,lf_div_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2806 #define FLD(f) abuf->fields.sfmt_l_sll.f
2807 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2808 int UNUSED written = 0;
2809 IADDR UNUSED pc = abuf->addr;
2810 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2813 SF opval = CGEN_CPU_FPU (current_cpu)->ops->divsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
2814 SET_H_FSR (FLD (f_r1), opval);
2815 CGEN_TRACE_RESULT (current_cpu, abuf, "fsr", 'f', opval);
2818 return vpc;
2819 #undef FLD
2822 /* lf-div-d32: lf.div.d $rDD32F,$rAD32F,$rBD32F */
2824 static SEM_PC
2825 SEM_FN_NAME (or1k32bf,lf_div_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2827 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
2828 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2829 int UNUSED written = 0;
2830 IADDR UNUSED pc = abuf->addr;
2831 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2834 DF opval = CGEN_CPU_FPU (current_cpu)->ops->divdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
2835 SET_H_FD32R (FLD (f_rdd32), opval);
2836 CGEN_TRACE_RESULT (current_cpu, abuf, "fd32r", 'f', opval);
2839 return vpc;
2840 #undef FLD
2843 /* lf-rem-s: lf.rem.s $rDSF,$rASF,$rBSF */
2845 static SEM_PC
2846 SEM_FN_NAME (or1k32bf,lf_rem_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2848 #define FLD(f) abuf->fields.sfmt_l_sll.f
2849 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2850 int UNUSED written = 0;
2851 IADDR UNUSED pc = abuf->addr;
2852 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2855 SF opval = CGEN_CPU_FPU (current_cpu)->ops->remsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
2856 SET_H_FSR (FLD (f_r1), opval);
2857 CGEN_TRACE_RESULT (current_cpu, abuf, "fsr", 'f', opval);
2860 return vpc;
2861 #undef FLD
2864 /* lf-rem-d32: lf.rem.d $rDD32F,$rAD32F,$rBD32F */
2866 static SEM_PC
2867 SEM_FN_NAME (or1k32bf,lf_rem_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2869 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
2870 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2871 int UNUSED written = 0;
2872 IADDR UNUSED pc = abuf->addr;
2873 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2876 DF opval = CGEN_CPU_FPU (current_cpu)->ops->remdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
2877 SET_H_FD32R (FLD (f_rdd32), opval);
2878 CGEN_TRACE_RESULT (current_cpu, abuf, "fd32r", 'f', opval);
2881 return vpc;
2882 #undef FLD
2885 /* lf-itof-s: lf.itof.s $rDSF,$rA */
2887 static SEM_PC
2888 SEM_FN_NAME (or1k32bf,lf_itof_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2890 #define FLD(f) abuf->fields.sfmt_l_slli.f
2891 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2892 int UNUSED written = 0;
2893 IADDR UNUSED pc = abuf->addr;
2894 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2897 SF opval = CGEN_CPU_FPU (current_cpu)->ops->floatsisf (CGEN_CPU_FPU (current_cpu), (GET_H_SYS_FPCSR_RM () == 0) ? (1) : (GET_H_SYS_FPCSR_RM () == 1) ? (3) : (GET_H_SYS_FPCSR_RM () == 2) ? (4) : (5), TRUNCSISI (GET_H_GPR (FLD (f_r2))));
2898 SET_H_FSR (FLD (f_r1), opval);
2899 CGEN_TRACE_RESULT (current_cpu, abuf, "fsr", 'f', opval);
2902 return vpc;
2903 #undef FLD
2906 /* lf-itof-d32: lf.itof.d $rDD32F,$rADI */
2908 static SEM_PC
2909 SEM_FN_NAME (or1k32bf,lf_itof_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2911 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
2912 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2913 int UNUSED written = 0;
2914 IADDR UNUSED pc = abuf->addr;
2915 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2918 DF opval = CGEN_CPU_FPU (current_cpu)->ops->floatdidf (CGEN_CPU_FPU (current_cpu), (GET_H_SYS_FPCSR_RM () == 0) ? (1) : (GET_H_SYS_FPCSR_RM () == 1) ? (3) : (GET_H_SYS_FPCSR_RM () == 2) ? (4) : (5), GET_H_I64R (FLD (f_rad32)));
2919 SET_H_FD32R (FLD (f_rdd32), opval);
2920 CGEN_TRACE_RESULT (current_cpu, abuf, "fd32r", 'f', opval);
2923 return vpc;
2924 #undef FLD
2927 /* lf-ftoi-s: lf.ftoi.s $rD,$rASF */
2929 static SEM_PC
2930 SEM_FN_NAME (or1k32bf,lf_ftoi_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2932 #define FLD(f) abuf->fields.sfmt_l_slli.f
2933 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2934 int UNUSED written = 0;
2935 IADDR UNUSED pc = abuf->addr;
2936 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2939 SI opval = EXTSISI (CGEN_CPU_FPU (current_cpu)->ops->fixsfsi (CGEN_CPU_FPU (current_cpu), (GET_H_SYS_FPCSR_RM () == 0) ? (1) : (GET_H_SYS_FPCSR_RM () == 1) ? (3) : (GET_H_SYS_FPCSR_RM () == 2) ? (4) : (5), GET_H_FSR (FLD (f_r2))));
2940 SET_H_GPR (FLD (f_r1), opval);
2941 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval);
2944 return vpc;
2945 #undef FLD
2948 /* lf-ftoi-d32: lf.ftoi.d $rDDI,$rAD32F */
2950 static SEM_PC
2951 SEM_FN_NAME (or1k32bf,lf_ftoi_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2953 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
2954 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2955 int UNUSED written = 0;
2956 IADDR UNUSED pc = abuf->addr;
2957 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2960 DI opval = CGEN_CPU_FPU (current_cpu)->ops->fixdfdi (CGEN_CPU_FPU (current_cpu), (GET_H_SYS_FPCSR_RM () == 0) ? (1) : (GET_H_SYS_FPCSR_RM () == 1) ? (3) : (GET_H_SYS_FPCSR_RM () == 2) ? (4) : (5), GET_H_FD32R (FLD (f_rad32)));
2961 SET_H_I64R (FLD (f_rdd32), opval);
2962 CGEN_TRACE_RESULT (current_cpu, abuf, "i64r", 'D', opval);
2965 return vpc;
2966 #undef FLD
2969 /* lf-sfeq-s: lf.sfeq.s $rASF,$rBSF */
2971 static SEM_PC
2972 SEM_FN_NAME (or1k32bf,lf_sfeq_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2974 #define FLD(f) abuf->fields.sfmt_l_sll.f
2975 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2976 int UNUSED written = 0;
2977 IADDR UNUSED pc = abuf->addr;
2978 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2981 BI opval = CGEN_CPU_FPU (current_cpu)->ops->eqsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
2982 SET_H_SYS_SR_F (opval);
2983 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
2986 return vpc;
2987 #undef FLD
2990 /* lf-sfeq-d32: lf.sfeq.d $rAD32F,$rBD32F */
2992 static SEM_PC
2993 SEM_FN_NAME (or1k32bf,lf_sfeq_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2995 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
2996 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2997 int UNUSED written = 0;
2998 IADDR UNUSED pc = abuf->addr;
2999 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3002 BI opval = CGEN_CPU_FPU (current_cpu)->ops->eqdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
3003 SET_H_SYS_SR_F (opval);
3004 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3007 return vpc;
3008 #undef FLD
3011 /* lf-sfne-s: lf.sfne.s $rASF,$rBSF */
3013 static SEM_PC
3014 SEM_FN_NAME (or1k32bf,lf_sfne_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3016 #define FLD(f) abuf->fields.sfmt_l_sll.f
3017 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3018 int UNUSED written = 0;
3019 IADDR UNUSED pc = abuf->addr;
3020 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3023 BI opval = CGEN_CPU_FPU (current_cpu)->ops->nesf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
3024 SET_H_SYS_SR_F (opval);
3025 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3028 return vpc;
3029 #undef FLD
3032 /* lf-sfne-d32: lf.sfne.d $rAD32F,$rBD32F */
3034 static SEM_PC
3035 SEM_FN_NAME (or1k32bf,lf_sfne_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3037 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3038 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3039 int UNUSED written = 0;
3040 IADDR UNUSED pc = abuf->addr;
3041 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3044 BI opval = CGEN_CPU_FPU (current_cpu)->ops->nedf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
3045 SET_H_SYS_SR_F (opval);
3046 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3049 return vpc;
3050 #undef FLD
3053 /* lf-sfge-s: lf.sfge.s $rASF,$rBSF */
3055 static SEM_PC
3056 SEM_FN_NAME (or1k32bf,lf_sfge_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3058 #define FLD(f) abuf->fields.sfmt_l_sll.f
3059 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3060 int UNUSED written = 0;
3061 IADDR UNUSED pc = abuf->addr;
3062 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3065 BI opval = CGEN_CPU_FPU (current_cpu)->ops->gesf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
3066 SET_H_SYS_SR_F (opval);
3067 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3070 return vpc;
3071 #undef FLD
3074 /* lf-sfge-d32: lf.sfge.d $rAD32F,$rBD32F */
3076 static SEM_PC
3077 SEM_FN_NAME (or1k32bf,lf_sfge_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3079 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3080 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3081 int UNUSED written = 0;
3082 IADDR UNUSED pc = abuf->addr;
3083 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3086 BI opval = CGEN_CPU_FPU (current_cpu)->ops->gedf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
3087 SET_H_SYS_SR_F (opval);
3088 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3091 return vpc;
3092 #undef FLD
3095 /* lf-sfgt-s: lf.sfgt.s $rASF,$rBSF */
3097 static SEM_PC
3098 SEM_FN_NAME (or1k32bf,lf_sfgt_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3100 #define FLD(f) abuf->fields.sfmt_l_sll.f
3101 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3102 int UNUSED written = 0;
3103 IADDR UNUSED pc = abuf->addr;
3104 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3107 BI opval = CGEN_CPU_FPU (current_cpu)->ops->gtsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
3108 SET_H_SYS_SR_F (opval);
3109 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3112 return vpc;
3113 #undef FLD
3116 /* lf-sfgt-d32: lf.sfgt.d $rAD32F,$rBD32F */
3118 static SEM_PC
3119 SEM_FN_NAME (or1k32bf,lf_sfgt_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3121 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3122 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3123 int UNUSED written = 0;
3124 IADDR UNUSED pc = abuf->addr;
3125 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3128 BI opval = CGEN_CPU_FPU (current_cpu)->ops->gtdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
3129 SET_H_SYS_SR_F (opval);
3130 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3133 return vpc;
3134 #undef FLD
3137 /* lf-sflt-s: lf.sflt.s $rASF,$rBSF */
3139 static SEM_PC
3140 SEM_FN_NAME (or1k32bf,lf_sflt_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3142 #define FLD(f) abuf->fields.sfmt_l_sll.f
3143 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3144 int UNUSED written = 0;
3145 IADDR UNUSED pc = abuf->addr;
3146 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3149 BI opval = CGEN_CPU_FPU (current_cpu)->ops->ltsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
3150 SET_H_SYS_SR_F (opval);
3151 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3154 return vpc;
3155 #undef FLD
3158 /* lf-sflt-d32: lf.sflt.d $rAD32F,$rBD32F */
3160 static SEM_PC
3161 SEM_FN_NAME (or1k32bf,lf_sflt_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3163 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3164 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3165 int UNUSED written = 0;
3166 IADDR UNUSED pc = abuf->addr;
3167 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3170 BI opval = CGEN_CPU_FPU (current_cpu)->ops->ltdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
3171 SET_H_SYS_SR_F (opval);
3172 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3175 return vpc;
3176 #undef FLD
3179 /* lf-sfle-s: lf.sfle.s $rASF,$rBSF */
3181 static SEM_PC
3182 SEM_FN_NAME (or1k32bf,lf_sfle_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3184 #define FLD(f) abuf->fields.sfmt_l_sll.f
3185 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3186 int UNUSED written = 0;
3187 IADDR UNUSED pc = abuf->addr;
3188 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3191 BI opval = CGEN_CPU_FPU (current_cpu)->ops->lesf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
3192 SET_H_SYS_SR_F (opval);
3193 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3196 return vpc;
3197 #undef FLD
3200 /* lf-sfle-d32: lf.sfle.d $rAD32F,$rBD32F */
3202 static SEM_PC
3203 SEM_FN_NAME (or1k32bf,lf_sfle_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3205 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3206 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3207 int UNUSED written = 0;
3208 IADDR UNUSED pc = abuf->addr;
3209 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3212 BI opval = CGEN_CPU_FPU (current_cpu)->ops->ledf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
3213 SET_H_SYS_SR_F (opval);
3214 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3217 return vpc;
3218 #undef FLD
3221 /* lf-sfueq-s: lf.sfueq.s $rASF,$rBSF */
3223 static SEM_PC
3224 SEM_FN_NAME (or1k32bf,lf_sfueq_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3226 #define FLD(f) abuf->fields.sfmt_l_sll.f
3227 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3228 int UNUSED written = 0;
3229 IADDR UNUSED pc = abuf->addr;
3230 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3233 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unorderedsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))), CGEN_CPU_FPU (current_cpu)->ops->eqsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))));
3234 SET_H_SYS_SR_F (opval);
3235 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3238 return vpc;
3239 #undef FLD
3242 /* lf-sfueq-d32: lf.sfueq.d $rAD32F,$rBD32F */
3244 static SEM_PC
3245 SEM_FN_NAME (or1k32bf,lf_sfueq_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3247 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3248 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3249 int UNUSED written = 0;
3250 IADDR UNUSED pc = abuf->addr;
3251 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3254 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unordereddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))), CGEN_CPU_FPU (current_cpu)->ops->eqdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))));
3255 SET_H_SYS_SR_F (opval);
3256 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3259 return vpc;
3260 #undef FLD
3263 /* lf-sfune-s: lf.sfune.s $rASF,$rBSF */
3265 static SEM_PC
3266 SEM_FN_NAME (or1k32bf,lf_sfune_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3268 #define FLD(f) abuf->fields.sfmt_l_sll.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);
3275 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unorderedsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))), CGEN_CPU_FPU (current_cpu)->ops->nesf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))));
3276 SET_H_SYS_SR_F (opval);
3277 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3280 return vpc;
3281 #undef FLD
3284 /* lf-sfune-d32: lf.sfune.d $rAD32F,$rBD32F */
3286 static SEM_PC
3287 SEM_FN_NAME (or1k32bf,lf_sfune_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3289 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3290 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3291 int UNUSED written = 0;
3292 IADDR UNUSED pc = abuf->addr;
3293 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3296 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unordereddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))), CGEN_CPU_FPU (current_cpu)->ops->nedf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))));
3297 SET_H_SYS_SR_F (opval);
3298 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3301 return vpc;
3302 #undef FLD
3305 /* lf-sfugt-s: lf.sfugt.s $rASF,$rBSF */
3307 static SEM_PC
3308 SEM_FN_NAME (or1k32bf,lf_sfugt_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3310 #define FLD(f) abuf->fields.sfmt_l_sll.f
3311 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3312 int UNUSED written = 0;
3313 IADDR UNUSED pc = abuf->addr;
3314 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3317 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unorderedsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))), CGEN_CPU_FPU (current_cpu)->ops->gtsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))));
3318 SET_H_SYS_SR_F (opval);
3319 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3322 return vpc;
3323 #undef FLD
3326 /* lf-sfugt-d32: lf.sfugt.d $rAD32F,$rBD32F */
3328 static SEM_PC
3329 SEM_FN_NAME (or1k32bf,lf_sfugt_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3331 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3332 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3333 int UNUSED written = 0;
3334 IADDR UNUSED pc = abuf->addr;
3335 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3338 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unordereddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))), CGEN_CPU_FPU (current_cpu)->ops->gtdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))));
3339 SET_H_SYS_SR_F (opval);
3340 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3343 return vpc;
3344 #undef FLD
3347 /* lf-sfuge-s: lf.sfuge.s $rASF,$rBSF */
3349 static SEM_PC
3350 SEM_FN_NAME (or1k32bf,lf_sfuge_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3352 #define FLD(f) abuf->fields.sfmt_l_sll.f
3353 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3354 int UNUSED written = 0;
3355 IADDR UNUSED pc = abuf->addr;
3356 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3359 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unorderedsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))), CGEN_CPU_FPU (current_cpu)->ops->gesf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))));
3360 SET_H_SYS_SR_F (opval);
3361 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3364 return vpc;
3365 #undef FLD
3368 /* lf-sfuge-d32: lf.sfuge.d $rAD32F,$rBD32F */
3370 static SEM_PC
3371 SEM_FN_NAME (or1k32bf,lf_sfuge_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3373 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3374 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3375 int UNUSED written = 0;
3376 IADDR UNUSED pc = abuf->addr;
3377 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3380 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unordereddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))), CGEN_CPU_FPU (current_cpu)->ops->gedf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))));
3381 SET_H_SYS_SR_F (opval);
3382 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3385 return vpc;
3386 #undef FLD
3389 /* lf-sfult-s: lf.sfult.s $rASF,$rBSF */
3391 static SEM_PC
3392 SEM_FN_NAME (or1k32bf,lf_sfult_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3394 #define FLD(f) abuf->fields.sfmt_l_sll.f
3395 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3396 int UNUSED written = 0;
3397 IADDR UNUSED pc = abuf->addr;
3398 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3401 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unorderedsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))), CGEN_CPU_FPU (current_cpu)->ops->ltsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))));
3402 SET_H_SYS_SR_F (opval);
3403 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3406 return vpc;
3407 #undef FLD
3410 /* lf-sfult-d32: lf.sfult.d $rAD32F,$rBD32F */
3412 static SEM_PC
3413 SEM_FN_NAME (or1k32bf,lf_sfult_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3415 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3416 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3417 int UNUSED written = 0;
3418 IADDR UNUSED pc = abuf->addr;
3419 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3422 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unordereddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))), CGEN_CPU_FPU (current_cpu)->ops->ltdf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))));
3423 SET_H_SYS_SR_F (opval);
3424 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3427 return vpc;
3428 #undef FLD
3431 /* lf-sfule-s: lf.sfule.s $rASF,$rBSF */
3433 static SEM_PC
3434 SEM_FN_NAME (or1k32bf,lf_sfule_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3436 #define FLD(f) abuf->fields.sfmt_l_sll.f
3437 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3438 int UNUSED written = 0;
3439 IADDR UNUSED pc = abuf->addr;
3440 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3443 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unorderedsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))), CGEN_CPU_FPU (current_cpu)->ops->lesf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))));
3444 SET_H_SYS_SR_F (opval);
3445 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3448 return vpc;
3449 #undef FLD
3452 /* lf-sfule-d32: lf.sfule.d $rAD32F,$rBD32F */
3454 static SEM_PC
3455 SEM_FN_NAME (or1k32bf,lf_sfule_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3457 #define FLD(f) abuf->fields.sfmt_lf_add_d32.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);
3464 BI opval = ORBI (CGEN_CPU_FPU (current_cpu)->ops->unordereddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))), CGEN_CPU_FPU (current_cpu)->ops->ledf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))));
3465 SET_H_SYS_SR_F (opval);
3466 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3469 return vpc;
3470 #undef FLD
3473 /* lf-sfun-s: lf.sfun.s $rASF,$rBSF */
3475 static SEM_PC
3476 SEM_FN_NAME (or1k32bf,lf_sfun_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3478 #define FLD(f) abuf->fields.sfmt_l_sll.f
3479 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3480 int UNUSED written = 0;
3481 IADDR UNUSED pc = abuf->addr;
3482 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3485 BI opval = CGEN_CPU_FPU (current_cpu)->ops->unorderedsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3)));
3486 SET_H_SYS_SR_F (opval);
3487 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3490 return vpc;
3491 #undef FLD
3494 /* lf-sfun-d32: lf.sfun.d $rAD32F,$rBD32F */
3496 static SEM_PC
3497 SEM_FN_NAME (or1k32bf,lf_sfun_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3499 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3500 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3501 int UNUSED written = 0;
3502 IADDR UNUSED pc = abuf->addr;
3503 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3506 BI opval = CGEN_CPU_FPU (current_cpu)->ops->unordereddf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32)));
3507 SET_H_SYS_SR_F (opval);
3508 CGEN_TRACE_RESULT (current_cpu, abuf, "sys-sr-f", 'x', opval);
3511 return vpc;
3512 #undef FLD
3515 /* lf-madd-s: lf.madd.s $rDSF,$rASF,$rBSF */
3517 static SEM_PC
3518 SEM_FN_NAME (or1k32bf,lf_madd_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3520 #define FLD(f) abuf->fields.sfmt_l_sll.f
3521 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3522 int UNUSED written = 0;
3523 IADDR UNUSED pc = abuf->addr;
3524 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3527 SF opval = CGEN_CPU_FPU (current_cpu)->ops->addsf (CGEN_CPU_FPU (current_cpu), CGEN_CPU_FPU (current_cpu)->ops->mulsf (CGEN_CPU_FPU (current_cpu), GET_H_FSR (FLD (f_r2)), GET_H_FSR (FLD (f_r3))), GET_H_FSR (FLD (f_r1)));
3528 SET_H_FSR (FLD (f_r1), opval);
3529 CGEN_TRACE_RESULT (current_cpu, abuf, "fsr", 'f', opval);
3532 return vpc;
3533 #undef FLD
3536 /* lf-madd-d32: lf.madd.d $rDD32F,$rAD32F,$rBD32F */
3538 static SEM_PC
3539 SEM_FN_NAME (or1k32bf,lf_madd_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3541 #define FLD(f) abuf->fields.sfmt_lf_add_d32.f
3542 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3543 int UNUSED written = 0;
3544 IADDR UNUSED pc = abuf->addr;
3545 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3548 DF opval = CGEN_CPU_FPU (current_cpu)->ops->adddf (CGEN_CPU_FPU (current_cpu), CGEN_CPU_FPU (current_cpu)->ops->muldf (CGEN_CPU_FPU (current_cpu), GET_H_FD32R (FLD (f_rad32)), GET_H_FD32R (FLD (f_rbd32))), GET_H_FD32R (FLD (f_rdd32)));
3549 SET_H_FD32R (FLD (f_rdd32), opval);
3550 CGEN_TRACE_RESULT (current_cpu, abuf, "fd32r", 'f', opval);
3553 return vpc;
3554 #undef FLD
3557 /* lf-cust1-s: lf.cust1.s $rASF,$rBSF */
3559 static SEM_PC
3560 SEM_FN_NAME (or1k32bf,lf_cust1_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3562 #define FLD(f) abuf->fields.sfmt_empty.f
3563 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3564 int UNUSED written = 0;
3565 IADDR UNUSED pc = abuf->addr;
3566 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3568 ((void) 0); /*nop*/
3570 return vpc;
3571 #undef FLD
3574 /* lf-cust1-d32: lf.cust1.d */
3576 static SEM_PC
3577 SEM_FN_NAME (or1k32bf,lf_cust1_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3579 #define FLD(f) abuf->fields.sfmt_empty.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);
3585 ((void) 0); /*nop*/
3587 return vpc;
3588 #undef FLD
3591 /* Table of all semantic fns. */
3593 static const struct sem_fn_desc sem_fns[] = {
3594 { OR1K32BF_INSN_X_INVALID, SEM_FN_NAME (or1k32bf,x_invalid) },
3595 { OR1K32BF_INSN_X_AFTER, SEM_FN_NAME (or1k32bf,x_after) },
3596 { OR1K32BF_INSN_X_BEFORE, SEM_FN_NAME (or1k32bf,x_before) },
3597 { OR1K32BF_INSN_X_CTI_CHAIN, SEM_FN_NAME (or1k32bf,x_cti_chain) },
3598 { OR1K32BF_INSN_X_CHAIN, SEM_FN_NAME (or1k32bf,x_chain) },
3599 { OR1K32BF_INSN_X_BEGIN, SEM_FN_NAME (or1k32bf,x_begin) },
3600 { OR1K32BF_INSN_L_J, SEM_FN_NAME (or1k32bf,l_j) },
3601 { OR1K32BF_INSN_L_ADRP, SEM_FN_NAME (or1k32bf,l_adrp) },
3602 { OR1K32BF_INSN_L_JAL, SEM_FN_NAME (or1k32bf,l_jal) },
3603 { OR1K32BF_INSN_L_JR, SEM_FN_NAME (or1k32bf,l_jr) },
3604 { OR1K32BF_INSN_L_JALR, SEM_FN_NAME (or1k32bf,l_jalr) },
3605 { OR1K32BF_INSN_L_BNF, SEM_FN_NAME (or1k32bf,l_bnf) },
3606 { OR1K32BF_INSN_L_BF, SEM_FN_NAME (or1k32bf,l_bf) },
3607 { OR1K32BF_INSN_L_TRAP, SEM_FN_NAME (or1k32bf,l_trap) },
3608 { OR1K32BF_INSN_L_SYS, SEM_FN_NAME (or1k32bf,l_sys) },
3609 { OR1K32BF_INSN_L_MSYNC, SEM_FN_NAME (or1k32bf,l_msync) },
3610 { OR1K32BF_INSN_L_PSYNC, SEM_FN_NAME (or1k32bf,l_psync) },
3611 { OR1K32BF_INSN_L_CSYNC, SEM_FN_NAME (or1k32bf,l_csync) },
3612 { OR1K32BF_INSN_L_RFE, SEM_FN_NAME (or1k32bf,l_rfe) },
3613 { OR1K32BF_INSN_L_NOP_IMM, SEM_FN_NAME (or1k32bf,l_nop_imm) },
3614 { OR1K32BF_INSN_L_MOVHI, SEM_FN_NAME (or1k32bf,l_movhi) },
3615 { OR1K32BF_INSN_L_MACRC, SEM_FN_NAME (or1k32bf,l_macrc) },
3616 { OR1K32BF_INSN_L_MFSPR, SEM_FN_NAME (or1k32bf,l_mfspr) },
3617 { OR1K32BF_INSN_L_MTSPR, SEM_FN_NAME (or1k32bf,l_mtspr) },
3618 { OR1K32BF_INSN_L_LWZ, SEM_FN_NAME (or1k32bf,l_lwz) },
3619 { OR1K32BF_INSN_L_LWS, SEM_FN_NAME (or1k32bf,l_lws) },
3620 { OR1K32BF_INSN_L_LWA, SEM_FN_NAME (or1k32bf,l_lwa) },
3621 { OR1K32BF_INSN_L_LBZ, SEM_FN_NAME (or1k32bf,l_lbz) },
3622 { OR1K32BF_INSN_L_LBS, SEM_FN_NAME (or1k32bf,l_lbs) },
3623 { OR1K32BF_INSN_L_LHZ, SEM_FN_NAME (or1k32bf,l_lhz) },
3624 { OR1K32BF_INSN_L_LHS, SEM_FN_NAME (or1k32bf,l_lhs) },
3625 { OR1K32BF_INSN_L_SW, SEM_FN_NAME (or1k32bf,l_sw) },
3626 { OR1K32BF_INSN_L_SB, SEM_FN_NAME (or1k32bf,l_sb) },
3627 { OR1K32BF_INSN_L_SH, SEM_FN_NAME (or1k32bf,l_sh) },
3628 { OR1K32BF_INSN_L_SWA, SEM_FN_NAME (or1k32bf,l_swa) },
3629 { OR1K32BF_INSN_L_SLL, SEM_FN_NAME (or1k32bf,l_sll) },
3630 { OR1K32BF_INSN_L_SLLI, SEM_FN_NAME (or1k32bf,l_slli) },
3631 { OR1K32BF_INSN_L_SRL, SEM_FN_NAME (or1k32bf,l_srl) },
3632 { OR1K32BF_INSN_L_SRLI, SEM_FN_NAME (or1k32bf,l_srli) },
3633 { OR1K32BF_INSN_L_SRA, SEM_FN_NAME (or1k32bf,l_sra) },
3634 { OR1K32BF_INSN_L_SRAI, SEM_FN_NAME (or1k32bf,l_srai) },
3635 { OR1K32BF_INSN_L_ROR, SEM_FN_NAME (or1k32bf,l_ror) },
3636 { OR1K32BF_INSN_L_RORI, SEM_FN_NAME (or1k32bf,l_rori) },
3637 { OR1K32BF_INSN_L_AND, SEM_FN_NAME (or1k32bf,l_and) },
3638 { OR1K32BF_INSN_L_OR, SEM_FN_NAME (or1k32bf,l_or) },
3639 { OR1K32BF_INSN_L_XOR, SEM_FN_NAME (or1k32bf,l_xor) },
3640 { OR1K32BF_INSN_L_ADD, SEM_FN_NAME (or1k32bf,l_add) },
3641 { OR1K32BF_INSN_L_SUB, SEM_FN_NAME (or1k32bf,l_sub) },
3642 { OR1K32BF_INSN_L_ADDC, SEM_FN_NAME (or1k32bf,l_addc) },
3643 { OR1K32BF_INSN_L_MUL, SEM_FN_NAME (or1k32bf,l_mul) },
3644 { OR1K32BF_INSN_L_MULD, SEM_FN_NAME (or1k32bf,l_muld) },
3645 { OR1K32BF_INSN_L_MULU, SEM_FN_NAME (or1k32bf,l_mulu) },
3646 { OR1K32BF_INSN_L_MULDU, SEM_FN_NAME (or1k32bf,l_muldu) },
3647 { OR1K32BF_INSN_L_DIV, SEM_FN_NAME (or1k32bf,l_div) },
3648 { OR1K32BF_INSN_L_DIVU, SEM_FN_NAME (or1k32bf,l_divu) },
3649 { OR1K32BF_INSN_L_FF1, SEM_FN_NAME (or1k32bf,l_ff1) },
3650 { OR1K32BF_INSN_L_FL1, SEM_FN_NAME (or1k32bf,l_fl1) },
3651 { OR1K32BF_INSN_L_ANDI, SEM_FN_NAME (or1k32bf,l_andi) },
3652 { OR1K32BF_INSN_L_ORI, SEM_FN_NAME (or1k32bf,l_ori) },
3653 { OR1K32BF_INSN_L_XORI, SEM_FN_NAME (or1k32bf,l_xori) },
3654 { OR1K32BF_INSN_L_ADDI, SEM_FN_NAME (or1k32bf,l_addi) },
3655 { OR1K32BF_INSN_L_ADDIC, SEM_FN_NAME (or1k32bf,l_addic) },
3656 { OR1K32BF_INSN_L_MULI, SEM_FN_NAME (or1k32bf,l_muli) },
3657 { OR1K32BF_INSN_L_EXTHS, SEM_FN_NAME (or1k32bf,l_exths) },
3658 { OR1K32BF_INSN_L_EXTBS, SEM_FN_NAME (or1k32bf,l_extbs) },
3659 { OR1K32BF_INSN_L_EXTHZ, SEM_FN_NAME (or1k32bf,l_exthz) },
3660 { OR1K32BF_INSN_L_EXTBZ, SEM_FN_NAME (or1k32bf,l_extbz) },
3661 { OR1K32BF_INSN_L_EXTWS, SEM_FN_NAME (or1k32bf,l_extws) },
3662 { OR1K32BF_INSN_L_EXTWZ, SEM_FN_NAME (or1k32bf,l_extwz) },
3663 { OR1K32BF_INSN_L_CMOV, SEM_FN_NAME (or1k32bf,l_cmov) },
3664 { OR1K32BF_INSN_L_SFGTS, SEM_FN_NAME (or1k32bf,l_sfgts) },
3665 { OR1K32BF_INSN_L_SFGTSI, SEM_FN_NAME (or1k32bf,l_sfgtsi) },
3666 { OR1K32BF_INSN_L_SFGTU, SEM_FN_NAME (or1k32bf,l_sfgtu) },
3667 { OR1K32BF_INSN_L_SFGTUI, SEM_FN_NAME (or1k32bf,l_sfgtui) },
3668 { OR1K32BF_INSN_L_SFGES, SEM_FN_NAME (or1k32bf,l_sfges) },
3669 { OR1K32BF_INSN_L_SFGESI, SEM_FN_NAME (or1k32bf,l_sfgesi) },
3670 { OR1K32BF_INSN_L_SFGEU, SEM_FN_NAME (or1k32bf,l_sfgeu) },
3671 { OR1K32BF_INSN_L_SFGEUI, SEM_FN_NAME (or1k32bf,l_sfgeui) },
3672 { OR1K32BF_INSN_L_SFLTS, SEM_FN_NAME (or1k32bf,l_sflts) },
3673 { OR1K32BF_INSN_L_SFLTSI, SEM_FN_NAME (or1k32bf,l_sfltsi) },
3674 { OR1K32BF_INSN_L_SFLTU, SEM_FN_NAME (or1k32bf,l_sfltu) },
3675 { OR1K32BF_INSN_L_SFLTUI, SEM_FN_NAME (or1k32bf,l_sfltui) },
3676 { OR1K32BF_INSN_L_SFLES, SEM_FN_NAME (or1k32bf,l_sfles) },
3677 { OR1K32BF_INSN_L_SFLESI, SEM_FN_NAME (or1k32bf,l_sflesi) },
3678 { OR1K32BF_INSN_L_SFLEU, SEM_FN_NAME (or1k32bf,l_sfleu) },
3679 { OR1K32BF_INSN_L_SFLEUI, SEM_FN_NAME (or1k32bf,l_sfleui) },
3680 { OR1K32BF_INSN_L_SFEQ, SEM_FN_NAME (or1k32bf,l_sfeq) },
3681 { OR1K32BF_INSN_L_SFEQI, SEM_FN_NAME (or1k32bf,l_sfeqi) },
3682 { OR1K32BF_INSN_L_SFNE, SEM_FN_NAME (or1k32bf,l_sfne) },
3683 { OR1K32BF_INSN_L_SFNEI, SEM_FN_NAME (or1k32bf,l_sfnei) },
3684 { OR1K32BF_INSN_L_MAC, SEM_FN_NAME (or1k32bf,l_mac) },
3685 { OR1K32BF_INSN_L_MACI, SEM_FN_NAME (or1k32bf,l_maci) },
3686 { OR1K32BF_INSN_L_MACU, SEM_FN_NAME (or1k32bf,l_macu) },
3687 { OR1K32BF_INSN_L_MSB, SEM_FN_NAME (or1k32bf,l_msb) },
3688 { OR1K32BF_INSN_L_MSBU, SEM_FN_NAME (or1k32bf,l_msbu) },
3689 { OR1K32BF_INSN_L_CUST1, SEM_FN_NAME (or1k32bf,l_cust1) },
3690 { OR1K32BF_INSN_L_CUST2, SEM_FN_NAME (or1k32bf,l_cust2) },
3691 { OR1K32BF_INSN_L_CUST3, SEM_FN_NAME (or1k32bf,l_cust3) },
3692 { OR1K32BF_INSN_L_CUST4, SEM_FN_NAME (or1k32bf,l_cust4) },
3693 { OR1K32BF_INSN_L_CUST5, SEM_FN_NAME (or1k32bf,l_cust5) },
3694 { OR1K32BF_INSN_L_CUST6, SEM_FN_NAME (or1k32bf,l_cust6) },
3695 { OR1K32BF_INSN_L_CUST7, SEM_FN_NAME (or1k32bf,l_cust7) },
3696 { OR1K32BF_INSN_L_CUST8, SEM_FN_NAME (or1k32bf,l_cust8) },
3697 { OR1K32BF_INSN_LF_ADD_S, SEM_FN_NAME (or1k32bf,lf_add_s) },
3698 { OR1K32BF_INSN_LF_ADD_D32, SEM_FN_NAME (or1k32bf,lf_add_d32) },
3699 { OR1K32BF_INSN_LF_SUB_S, SEM_FN_NAME (or1k32bf,lf_sub_s) },
3700 { OR1K32BF_INSN_LF_SUB_D32, SEM_FN_NAME (or1k32bf,lf_sub_d32) },
3701 { OR1K32BF_INSN_LF_MUL_S, SEM_FN_NAME (or1k32bf,lf_mul_s) },
3702 { OR1K32BF_INSN_LF_MUL_D32, SEM_FN_NAME (or1k32bf,lf_mul_d32) },
3703 { OR1K32BF_INSN_LF_DIV_S, SEM_FN_NAME (or1k32bf,lf_div_s) },
3704 { OR1K32BF_INSN_LF_DIV_D32, SEM_FN_NAME (or1k32bf,lf_div_d32) },
3705 { OR1K32BF_INSN_LF_REM_S, SEM_FN_NAME (or1k32bf,lf_rem_s) },
3706 { OR1K32BF_INSN_LF_REM_D32, SEM_FN_NAME (or1k32bf,lf_rem_d32) },
3707 { OR1K32BF_INSN_LF_ITOF_S, SEM_FN_NAME (or1k32bf,lf_itof_s) },
3708 { OR1K32BF_INSN_LF_ITOF_D32, SEM_FN_NAME (or1k32bf,lf_itof_d32) },
3709 { OR1K32BF_INSN_LF_FTOI_S, SEM_FN_NAME (or1k32bf,lf_ftoi_s) },
3710 { OR1K32BF_INSN_LF_FTOI_D32, SEM_FN_NAME (or1k32bf,lf_ftoi_d32) },
3711 { OR1K32BF_INSN_LF_SFEQ_S, SEM_FN_NAME (or1k32bf,lf_sfeq_s) },
3712 { OR1K32BF_INSN_LF_SFEQ_D32, SEM_FN_NAME (or1k32bf,lf_sfeq_d32) },
3713 { OR1K32BF_INSN_LF_SFNE_S, SEM_FN_NAME (or1k32bf,lf_sfne_s) },
3714 { OR1K32BF_INSN_LF_SFNE_D32, SEM_FN_NAME (or1k32bf,lf_sfne_d32) },
3715 { OR1K32BF_INSN_LF_SFGE_S, SEM_FN_NAME (or1k32bf,lf_sfge_s) },
3716 { OR1K32BF_INSN_LF_SFGE_D32, SEM_FN_NAME (or1k32bf,lf_sfge_d32) },
3717 { OR1K32BF_INSN_LF_SFGT_S, SEM_FN_NAME (or1k32bf,lf_sfgt_s) },
3718 { OR1K32BF_INSN_LF_SFGT_D32, SEM_FN_NAME (or1k32bf,lf_sfgt_d32) },
3719 { OR1K32BF_INSN_LF_SFLT_S, SEM_FN_NAME (or1k32bf,lf_sflt_s) },
3720 { OR1K32BF_INSN_LF_SFLT_D32, SEM_FN_NAME (or1k32bf,lf_sflt_d32) },
3721 { OR1K32BF_INSN_LF_SFLE_S, SEM_FN_NAME (or1k32bf,lf_sfle_s) },
3722 { OR1K32BF_INSN_LF_SFLE_D32, SEM_FN_NAME (or1k32bf,lf_sfle_d32) },
3723 { OR1K32BF_INSN_LF_SFUEQ_S, SEM_FN_NAME (or1k32bf,lf_sfueq_s) },
3724 { OR1K32BF_INSN_LF_SFUEQ_D32, SEM_FN_NAME (or1k32bf,lf_sfueq_d32) },
3725 { OR1K32BF_INSN_LF_SFUNE_S, SEM_FN_NAME (or1k32bf,lf_sfune_s) },
3726 { OR1K32BF_INSN_LF_SFUNE_D32, SEM_FN_NAME (or1k32bf,lf_sfune_d32) },
3727 { OR1K32BF_INSN_LF_SFUGT_S, SEM_FN_NAME (or1k32bf,lf_sfugt_s) },
3728 { OR1K32BF_INSN_LF_SFUGT_D32, SEM_FN_NAME (or1k32bf,lf_sfugt_d32) },
3729 { OR1K32BF_INSN_LF_SFUGE_S, SEM_FN_NAME (or1k32bf,lf_sfuge_s) },
3730 { OR1K32BF_INSN_LF_SFUGE_D32, SEM_FN_NAME (or1k32bf,lf_sfuge_d32) },
3731 { OR1K32BF_INSN_LF_SFULT_S, SEM_FN_NAME (or1k32bf,lf_sfult_s) },
3732 { OR1K32BF_INSN_LF_SFULT_D32, SEM_FN_NAME (or1k32bf,lf_sfult_d32) },
3733 { OR1K32BF_INSN_LF_SFULE_S, SEM_FN_NAME (or1k32bf,lf_sfule_s) },
3734 { OR1K32BF_INSN_LF_SFULE_D32, SEM_FN_NAME (or1k32bf,lf_sfule_d32) },
3735 { OR1K32BF_INSN_LF_SFUN_S, SEM_FN_NAME (or1k32bf,lf_sfun_s) },
3736 { OR1K32BF_INSN_LF_SFUN_D32, SEM_FN_NAME (or1k32bf,lf_sfun_d32) },
3737 { OR1K32BF_INSN_LF_MADD_S, SEM_FN_NAME (or1k32bf,lf_madd_s) },
3738 { OR1K32BF_INSN_LF_MADD_D32, SEM_FN_NAME (or1k32bf,lf_madd_d32) },
3739 { OR1K32BF_INSN_LF_CUST1_S, SEM_FN_NAME (or1k32bf,lf_cust1_s) },
3740 { OR1K32BF_INSN_LF_CUST1_D32, SEM_FN_NAME (or1k32bf,lf_cust1_d32) },
3741 { 0, 0 }
3744 /* Add the semantic fns to IDESC_TABLE. */
3746 void
3747 SEM_FN_NAME (or1k32bf,init_idesc_table) (SIM_CPU *current_cpu)
3749 IDESC *idesc_table = CPU_IDESC (current_cpu);
3750 const struct sem_fn_desc *sf;
3751 int mach_num = MACH_NUM (CPU_MACH (current_cpu));
3753 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
3755 const CGEN_INSN *insn = idesc_table[sf->index].idata;
3756 int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
3757 || CGEN_INSN_MACH_HAS_P (insn, mach_num));
3758 #if FAST_P
3759 if (valid_p)
3760 idesc_table[sf->index].sem_fast = sf->fn;
3761 else
3762 idesc_table[sf->index].sem_fast = SEM_FN_NAME (or1k32bf,x_invalid);
3763 #else
3764 if (valid_p)
3765 idesc_table[sf->index].sem_full = sf->fn;
3766 else
3767 idesc_table[sf->index].sem_full = SEM_FN_NAME (or1k32bf,x_invalid);
3768 #endif