1 /* Simulator instruction semantics for or1k32bf. 2 3 THIS FILE IS MACHINE GENERATED WITH CGEN. 4 5 Copyright (C) 1996-2024 Free Software Foundation, Inc. 6 7 This file is part of the GNU simulators. 8 9 This file is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 3, or (at your option) 12 any later version. 13 14 It is distributed in the hope that it will be useful, but WITHOUT 15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 17 License for more details. 18 19 You should have received a copy of the GNU General Public License along 20 with this program; if not, write to the Free Software Foundation, Inc., 21 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 22 23 */ 24 25 #define WANT_CPU or1k32bf 26 #define WANT_CPU_OR1K32BF 27 28 #include "sim-main.h" 29 #include "cgen-mem.h" 30 #include "cgen-ops.h" 31 32 #undef GET_ATTR 33 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr) 34 35 /* This is used so that we can compile two copies of the semantic code, 36 one with full feature support and one without that runs fast(er). 37 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */ 38 #if FAST_P 39 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn) 40 #undef 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 45 46 /* x-invalid: --invalid-- */ 47 48 static SEM_PC 49 SEM_FN_NAME (or1k32bf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 50 { 51 #define FLD(f) abuf->fields.sfmt_empty.f 52 ARGBUF *abuf = SEM_ARGBUF (sem_arg); 53 int UNUSED written = 0; 54 IADDR UNUSED pc = abuf->addr; 55 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 56 57 { 58 /* Update the recorded pc in the cpu state struct. 59 Only necessary for WITH_SCACHE case, but to avoid the 60 conditional compilation .... */ 61 SET_H_PC (pc); 62 /* Virtual insns have zero size. Overwrite vpc with address of next insn 63 using the default-insn-bitsize spec. When executing insns in parallel 64 we may want to queue the fault and continue execution. */ 65 vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 66 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc); 67 } 68 69 return vpc; 70 #undef FLD 71 } 72 73 /* x-after: --after-- */ 74 75 static SEM_PC 76 SEM_FN_NAME (or1k32bf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 77 { 78 #define FLD(f) abuf->fields.sfmt_empty.f 79 ARGBUF *abuf = SEM_ARGBUF (sem_arg); 80 int UNUSED written = 0; 81 IADDR UNUSED pc = abuf->addr; 82 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 83 84 { 85 #if WITH_SCACHE_PBB_OR1K32BF 86 or1k32bf_pbb_after (current_cpu, sem_arg); 87 #endif 88 } 89 90 return vpc; 91 #undef FLD 92 } 93 94 /* x-before: --before-- */ 95 96 static SEM_PC 97 SEM_FN_NAME (or1k32bf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 98 { 99 #define FLD(f) abuf->fields.sfmt_empty.f 100 ARGBUF *abuf = SEM_ARGBUF (sem_arg); 101 int UNUSED written = 0; 102 IADDR UNUSED pc = abuf->addr; 103 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 104 105 { 106 #if WITH_SCACHE_PBB_OR1K32BF 107 or1k32bf_pbb_before (current_cpu, sem_arg); 108 #endif 109 } 110 111 return vpc; 112 #undef FLD 113 } 114 115 /* x-cti-chain: --cti-chain-- */ 116 117 static SEM_PC 118 SEM_FN_NAME (or1k32bf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 119 { 120 #define FLD(f) abuf->fields.sfmt_empty.f 121 ARGBUF *abuf = SEM_ARGBUF (sem_arg); 122 int UNUSED written = 0; 123 IADDR UNUSED pc = abuf->addr; 124 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 125 126 { 127 #if WITH_SCACHE_PBB_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 139 } 140 141 return vpc; 142 #undef FLD 143 } 144 145 /* x-chain: --chain-- */ 146 147 static SEM_PC 148 SEM_FN_NAME (or1k32bf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 149 { 150 #define FLD(f) abuf->fields.sfmt_empty.f 151 ARGBUF *abuf = SEM_ARGBUF (sem_arg); 152 int UNUSED written = 0; 153 IADDR UNUSED pc = abuf->addr; 154 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 155 156 { 157 #if WITH_SCACHE_PBB_OR1K32BF 158 vpc = or1k32bf_pbb_chain (current_cpu, sem_arg); 159 #ifdef DEFINE_SWITCH 160 BREAK (sem); 161 #endif 162 #endif 163 } 164 165 return vpc; 166 #undef FLD 167 } 168 169 /* x-begin: --begin-- */ 170 171 static SEM_PC 172 SEM_FN_NAME (or1k32bf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 173 { 174 #define FLD(f) abuf->fields.sfmt_empty.f 175 ARGBUF *abuf = SEM_ARGBUF (sem_arg); 176 int UNUSED written = 0; 177 IADDR UNUSED pc = abuf->addr; 178 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 179 180 { 181 #if WITH_SCACHE_PBB_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 194 } 195 196 return vpc; 197 #undef FLD 198 } 199 200 /* l-j: l.j ${disp26} */ 201 202 static SEM_PC 203 SEM_FN_NAME (or1k32bf,l_j) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 204 { 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); 211 212 { 213 { 214 { 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); 218 } 219 } 220 if (GET_H_SYS_CPUCFGR_ND ()) { 221 if (1) 222 SEM_SKIP_INSN (current_cpu, sem_arg, vpc); 223 } 224 } 225 226 SEM_BRANCH_FINI (vpc); 227 return vpc; 228 #undef FLD 229 } 230 231 /* l-adrp: l.adrp $rD,${disp21} */ 232 233 static SEM_PC 234 SEM_FN_NAME (or1k32bf,l_adrp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 235 { 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); 241 242 { 243 USI opval = FLD (i_disp21); 244 SET_H_GPR (FLD (f_r1), opval); 245 CGEN_TRACE_RESULT (current_cpu, abuf, "gpr", 'x', opval); 246 } 247 248 return vpc; 249 #undef FLD 250 } 251 252 /* l-jal: l.jal ${disp26} */ 253 254 static SEM_PC 255 SEM_FN_NAME (or1k32bf,l_jal) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 256 { 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); 263 264 { 265 { 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); 269 } 270 { 271 { 272 { 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); 276 } 277 } 278 if (GET_H_SYS_CPUCFGR_ND ()) { 279 if (1) 280 SEM_SKIP_INSN (current_cpu, sem_arg, vpc); 281 } 282 } 283 } 284 285 SEM_BRANCH_FINI (vpc); 286 return vpc; 287 #undef FLD 288 } 289 290 /* l-jr: l.jr $rB */ 291 292 static SEM_PC 293 SEM_FN_NAME (or1k32bf,l_jr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 294 { 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); 301 302 { 303 { 304 { 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); 308 } 309 } 310 if (GET_H_SYS_CPUCFGR_ND ()) { 311 if (1) 312 SEM_SKIP_INSN (current_cpu, sem_arg, vpc); 313 } 314 } 315 316 SEM_BRANCH_FINI (vpc); 317 return vpc; 318 #undef FLD 319 } 320 321 /* l-jalr: l.jalr $rB */ 322 323 static SEM_PC 324 SEM_FN_NAME (or1k32bf,l_jalr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 325 { 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); 332 333 { 334 { 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); 338 } 339 { 340 { 341 { 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); 345 } 346 } 347 if (GET_H_SYS_CPUCFGR_ND ()) { 348 if (1) 349 SEM_SKIP_INSN (current_cpu, sem_arg, vpc); 350 } 351 } 352 } 353 354 SEM_BRANCH_FINI (vpc); 355 return vpc; 356 #undef FLD 357 } 358 359 /* l-bnf: l.bnf ${disp26} */ 360 361 static SEM_PC 362 SEM_FN_NAME (or1k32bf,l_bnf) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 363 { 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); 370 371 { 372 if (NOTSI (GET_H_SYS_SR_F ())) { 373 { 374 { 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); 379 } 380 } 381 } else { 382 if (GET_H_SYS_CPUCFGR_ND ()) { 383 { 384 { 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); 389 } 390 } 391 } 392 } 393 if (GET_H_SYS_CPUCFGR_ND ()) { 394 if (1) 395 SEM_SKIP_INSN (current_cpu, sem_arg, vpc); 396 } 397 } 398 399 abuf->written = written; 400 SEM_BRANCH_FINI (vpc); 401 return vpc; 402 #undef FLD 403 } 404 405 /* l-bf: l.bf ${disp26} */ 406 407 static SEM_PC 408 SEM_FN_NAME (or1k32bf,l_bf) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 409 { 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); 416 417 { 418 if (GET_H_SYS_SR_F ()) { 419 { 420 { 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); 425 } 426 } 427 } else { 428 if (GET_H_SYS_CPUCFGR_ND ()) { 429 { 430 { 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); 435 } 436 } 437 } 438 } 439 if (GET_H_SYS_CPUCFGR_ND ()) { 440 if (1) 441 SEM_SKIP_INSN (current_cpu, sem_arg, vpc); 442 } 443 } 444 445 abuf->written = written; 446 SEM_BRANCH_FINI (vpc); 447 return vpc; 448 #undef FLD 449 } 450 451 /* l-trap: l.trap ${uimm16} */ 452 453 static SEM_PC 454 SEM_FN_NAME (or1k32bf,l_trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 455 { 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); 461 462 or1k32bf_exception (current_cpu, pc, EXCEPT_TRAP); 463 464 return vpc; 465 #undef FLD 466 } 467 468 /* l-sys: l.sys ${uimm16} */ 469 470 static SEM_PC 471 SEM_FN_NAME (or1k32bf,l_sys) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 472 { 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); 478 479 or1k32bf_exception (current_cpu, pc, EXCEPT_SYSCALL); 480 481 return vpc; 482 #undef FLD 483 } 484 485 /* l-msync: l.msync */ 486 487 static SEM_PC 488 SEM_FN_NAME (or1k32bf,l_msync) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 489 { 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); 495 496 ((void) 0); /*nop*/ 497 498 return vpc; 499 #undef FLD 500 } 501 502 /* l-psync: l.psync */ 503 504 static SEM_PC 505 SEM_FN_NAME (or1k32bf,l_psync) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 506 { 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); 512 513 ((void) 0); /*nop*/ 514 515 return vpc; 516 #undef FLD 517 } 518 519 /* l-csync: l.csync */ 520 521 static SEM_PC 522 SEM_FN_NAME (or1k32bf,l_csync) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 523 { 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); 529 530 ((void) 0); /*nop*/ 531 532 return vpc; 533 #undef FLD 534 } 535 536 /* l-rfe: l.rfe */ 537 538 static SEM_PC 539 SEM_FN_NAME (or1k32bf,l_rfe) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 540 { 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); 546 547 or1k32bf_rfe (current_cpu); 548 549 return vpc; 550 #undef FLD 551 } 552 553 /* l-nop-imm: l.nop ${uimm16} */ 554 555 static SEM_PC 556 SEM_FN_NAME (or1k32bf,l_nop_imm) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 557 { 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); 563 564 or1k32bf_nop (current_cpu, ZEXTSISI (FLD (f_uimm16))); 565 566 return vpc; 567 #undef FLD 568 } 569 570 /* l-movhi: l.movhi $rD,$uimm16 */ 571 572 static SEM_PC 573 SEM_FN_NAME (or1k32bf,l_movhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 574 { 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); 580 581 { 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); 585 } 586 587 return vpc; 588 #undef FLD 589 } 590 591 /* l-macrc: l.macrc $rD */ 592 593 static SEM_PC 594 SEM_FN_NAME (or1k32bf,l_macrc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 595 { 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); 601 602 { 603 { 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); 607 } 608 { 609 USI opval = 0; 610 SET_H_MAC_MACLO (opval); 611 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 612 } 613 { 614 USI opval = 0; 615 SET_H_MAC_MACHI (opval); 616 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 617 } 618 } 619 620 return vpc; 621 #undef FLD 622 } 623 624 /* l-mfspr: l.mfspr $rD,$rA,${uimm16} */ 625 626 static SEM_PC 627 SEM_FN_NAME (or1k32bf,l_mfspr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 628 { 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); 634 635 { 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); 639 } 640 641 return vpc; 642 #undef FLD 643 } 644 645 /* l-mtspr: l.mtspr $rA,$rB,${uimm16-split} */ 646 647 static SEM_PC 648 SEM_FN_NAME (or1k32bf,l_mtspr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 649 { 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); 655 656 or1k32bf_mtspr (current_cpu, ORSI (GET_H_GPR (FLD (f_r2)), ZEXTSISI (FLD (f_uimm16_split))), GET_H_GPR (FLD (f_r3))); 657 658 return vpc; 659 #undef FLD 660 } 661 662 /* l-lwz: l.lwz $rD,${simm16}($rA) */ 663 664 static SEM_PC 665 SEM_FN_NAME (or1k32bf,l_lwz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 666 { 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); 672 673 { 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); 677 } 678 679 return vpc; 680 #undef FLD 681 } 682 683 /* l-lws: l.lws $rD,${simm16}($rA) */ 684 685 static SEM_PC 686 SEM_FN_NAME (or1k32bf,l_lws) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 687 { 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); 693 694 { 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); 698 } 699 700 return vpc; 701 #undef FLD 702 } 703 704 /* l-lwa: l.lwa $rD,${simm16}($rA) */ 705 706 static SEM_PC 707 SEM_FN_NAME (or1k32bf,l_lwa) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 708 { 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); 714 715 { 716 { 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); 720 } 721 { 722 BI opval = 1; 723 CPU (h_atomic_reserve) = opval; 724 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-reserve", 'x', opval); 725 } 726 { 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); 730 } 731 } 732 733 return vpc; 734 #undef FLD 735 } 736 737 /* l-lbz: l.lbz $rD,${simm16}($rA) */ 738 739 static SEM_PC 740 SEM_FN_NAME (or1k32bf,l_lbz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 741 { 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); 747 748 { 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); 752 } 753 754 return vpc; 755 #undef FLD 756 } 757 758 /* l-lbs: l.lbs $rD,${simm16}($rA) */ 759 760 static SEM_PC 761 SEM_FN_NAME (or1k32bf,l_lbs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 762 { 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); 768 769 { 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); 773 } 774 775 return vpc; 776 #undef FLD 777 } 778 779 /* l-lhz: l.lhz $rD,${simm16}($rA) */ 780 781 static SEM_PC 782 SEM_FN_NAME (or1k32bf,l_lhz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 783 { 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); 789 790 { 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); 794 } 795 796 return vpc; 797 #undef FLD 798 } 799 800 /* l-lhs: l.lhs $rD,${simm16}($rA) */ 801 802 static SEM_PC 803 SEM_FN_NAME (or1k32bf,l_lhs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 804 { 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); 810 811 { 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); 815 } 816 817 return vpc; 818 #undef FLD 819 } 820 821 /* l-sw: l.sw ${simm16-split}($rA),$rB */ 822 823 static SEM_PC 824 SEM_FN_NAME (or1k32bf,l_sw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 825 { 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); 831 832 { 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); 835 { 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); 839 } 840 if (EQSI (ANDSI (tmp_addr, 268435452), CPU (h_atomic_address))) { 841 { 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); 846 } 847 } 848 } 849 850 abuf->written = written; 851 return vpc; 852 #undef FLD 853 } 854 855 /* l-sb: l.sb ${simm16-split}($rA),$rB */ 856 857 static SEM_PC 858 SEM_FN_NAME (or1k32bf,l_sb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 859 { 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); 865 866 { 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); 869 { 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); 873 } 874 if (EQSI (ANDSI (tmp_addr, 268435452), CPU (h_atomic_address))) { 875 { 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); 880 } 881 } 882 } 883 884 abuf->written = written; 885 return vpc; 886 #undef FLD 887 } 888 889 /* l-sh: l.sh ${simm16-split}($rA),$rB */ 890 891 static SEM_PC 892 SEM_FN_NAME (or1k32bf,l_sh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 893 { 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); 899 900 { 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); 903 { 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); 907 } 908 if (EQSI (ANDSI (tmp_addr, 268435452), CPU (h_atomic_address))) { 909 { 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); 914 } 915 } 916 } 917 918 abuf->written = written; 919 return vpc; 920 #undef FLD 921 } 922 923 /* l-swa: l.swa ${simm16-split}($rA),$rB */ 924 925 static SEM_PC 926 SEM_FN_NAME (or1k32bf,l_swa) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 927 { 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); 933 934 { 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); 937 { 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); 941 } 942 if (GET_H_SYS_SR_F ()) { 943 { 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); 948 } 949 } 950 { 951 BI opval = 0; 952 CPU (h_atomic_reserve) = opval; 953 CGEN_TRACE_RESULT (current_cpu, abuf, "atomic-reserve", 'x', opval); 954 } 955 } 956 957 abuf->written = written; 958 return vpc; 959 #undef FLD 960 } 961 962 /* l-sll: l.sll $rD,$rA,$rB */ 963 964 static SEM_PC 965 SEM_FN_NAME (or1k32bf,l_sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 966 { 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); 972 973 { 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); 977 } 978 979 return vpc; 980 #undef FLD 981 } 982 983 /* l-slli: l.slli $rD,$rA,${uimm6} */ 984 985 static SEM_PC 986 SEM_FN_NAME (or1k32bf,l_slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 987 { 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); 993 994 { 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); 998 } 999 1000 return vpc; 1001 #undef FLD 1002 } 1003 1004 /* l-srl: l.srl $rD,$rA,$rB */ 1005 1006 static SEM_PC 1007 SEM_FN_NAME (or1k32bf,l_srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1008 { 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); 1014 1015 { 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); 1019 } 1020 1021 return vpc; 1022 #undef FLD 1023 } 1024 1025 /* l-srli: l.srli $rD,$rA,${uimm6} */ 1026 1027 static SEM_PC 1028 SEM_FN_NAME (or1k32bf,l_srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1029 { 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); 1035 1036 { 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); 1040 } 1041 1042 return vpc; 1043 #undef FLD 1044 } 1045 1046 /* l-sra: l.sra $rD,$rA,$rB */ 1047 1048 static SEM_PC 1049 SEM_FN_NAME (or1k32bf,l_sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1050 { 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); 1056 1057 { 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); 1061 } 1062 1063 return vpc; 1064 #undef FLD 1065 } 1066 1067 /* l-srai: l.srai $rD,$rA,${uimm6} */ 1068 1069 static SEM_PC 1070 SEM_FN_NAME (or1k32bf,l_srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1071 { 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); 1077 1078 { 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); 1082 } 1083 1084 return vpc; 1085 #undef FLD 1086 } 1087 1088 /* l-ror: l.ror $rD,$rA,$rB */ 1089 1090 static SEM_PC 1091 SEM_FN_NAME (or1k32bf,l_ror) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1092 { 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); 1098 1099 { 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); 1103 } 1104 1105 return vpc; 1106 #undef FLD 1107 } 1108 1109 /* l-rori: l.rori $rD,$rA,${uimm6} */ 1110 1111 static SEM_PC 1112 SEM_FN_NAME (or1k32bf,l_rori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1113 { 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); 1119 1120 { 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); 1124 } 1125 1126 return vpc; 1127 #undef FLD 1128 } 1129 1130 /* l-and: l.and $rD,$rA,$rB */ 1131 1132 static SEM_PC 1133 SEM_FN_NAME (or1k32bf,l_and) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1134 { 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); 1140 1141 { 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); 1145 } 1146 1147 return vpc; 1148 #undef FLD 1149 } 1150 1151 /* l-or: l.or $rD,$rA,$rB */ 1152 1153 static SEM_PC 1154 SEM_FN_NAME (or1k32bf,l_or) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1155 { 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); 1161 1162 { 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); 1166 } 1167 1168 return vpc; 1169 #undef FLD 1170 } 1171 1172 /* l-xor: l.xor $rD,$rA,$rB */ 1173 1174 static SEM_PC 1175 SEM_FN_NAME (or1k32bf,l_xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1176 { 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); 1182 1183 { 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); 1187 } 1188 1189 return vpc; 1190 #undef FLD 1191 } 1192 1193 /* l-add: l.add $rD,$rA,$rB */ 1194 1195 static SEM_PC 1196 SEM_FN_NAME (or1k32bf,l_add) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1197 { 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); 1203 1204 { 1205 { 1206 { 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); 1210 } 1211 { 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); 1215 } 1216 { 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); 1220 } 1221 } 1222 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 1223 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1224 } 1225 } 1226 1227 return vpc; 1228 #undef FLD 1229 } 1230 1231 /* l-sub: l.sub $rD,$rA,$rB */ 1232 1233 static SEM_PC 1234 SEM_FN_NAME (or1k32bf,l_sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1235 { 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); 1241 1242 { 1243 { 1244 { 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); 1248 } 1249 { 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); 1253 } 1254 { 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); 1258 } 1259 } 1260 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 1261 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1262 } 1263 } 1264 1265 return vpc; 1266 #undef FLD 1267 } 1268 1269 /* l-addc: l.addc $rD,$rA,$rB */ 1270 1271 static SEM_PC 1272 SEM_FN_NAME (or1k32bf,l_addc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1273 { 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); 1279 1280 { 1281 { 1282 BI tmp_tmp_sys_sr_cy; 1283 tmp_tmp_sys_sr_cy = GET_H_SYS_SR_CY (); 1284 { 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); 1288 } 1289 { 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); 1293 } 1294 { 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); 1298 } 1299 } 1300 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 1301 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1302 } 1303 } 1304 1305 return vpc; 1306 #undef FLD 1307 } 1308 1309 /* l-mul: l.mul $rD,$rA,$rB */ 1310 1311 static SEM_PC 1312 SEM_FN_NAME (or1k32bf,l_mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1313 { 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); 1319 1320 { 1321 { 1322 { 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); 1326 } 1327 { 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); 1331 } 1332 } 1333 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 1334 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1335 } 1336 } 1337 1338 return vpc; 1339 #undef FLD 1340 } 1341 1342 /* l-muld: l.muld $rA,$rB */ 1343 1344 static SEM_PC 1345 SEM_FN_NAME (or1k32bf,l_muld) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1346 { 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); 1352 1353 { 1354 DI tmp_result; 1355 tmp_result = MULDI (EXTSIDI (GET_H_GPR (FLD (f_r2))), EXTSIDI (GET_H_GPR (FLD (f_r3)))); 1356 { 1357 SI opval = SUBWORDDISI (tmp_result, 0); 1358 SET_H_MAC_MACHI (opval); 1359 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 1360 } 1361 { 1362 SI opval = SUBWORDDISI (tmp_result, 1); 1363 SET_H_MAC_MACLO (opval); 1364 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 1365 } 1366 } 1367 1368 return vpc; 1369 #undef FLD 1370 } 1371 1372 /* l-mulu: l.mulu $rD,$rA,$rB */ 1373 1374 static SEM_PC 1375 SEM_FN_NAME (or1k32bf,l_mulu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1376 { 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); 1382 1383 { 1384 { 1385 { 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); 1389 } 1390 { 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); 1394 } 1395 } 1396 if (ANDIF (GET_H_SYS_SR_CY (), GET_H_SYS_SR_OVE ())) { 1397 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1398 } 1399 } 1400 1401 return vpc; 1402 #undef FLD 1403 } 1404 1405 /* l-muldu: l.muldu $rA,$rB */ 1406 1407 static SEM_PC 1408 SEM_FN_NAME (or1k32bf,l_muldu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1409 { 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); 1415 1416 { 1417 DI tmp_result; 1418 tmp_result = MULDI (ZEXTSIDI (GET_H_GPR (FLD (f_r2))), ZEXTSIDI (GET_H_GPR (FLD (f_r3)))); 1419 { 1420 SI opval = SUBWORDDISI (tmp_result, 0); 1421 SET_H_MAC_MACHI (opval); 1422 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 1423 } 1424 { 1425 SI opval = SUBWORDDISI (tmp_result, 1); 1426 SET_H_MAC_MACLO (opval); 1427 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 1428 } 1429 } 1430 1431 return vpc; 1432 #undef FLD 1433 } 1434 1435 /* l-div: l.div $rD,$rA,$rB */ 1436 1437 static SEM_PC 1438 SEM_FN_NAME (or1k32bf,l_div) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1439 { 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); 1445 1446 if (NESI (GET_H_GPR (FLD (f_r3)), 0)) { 1447 { 1448 { 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); 1453 } 1454 { 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); 1459 } 1460 } 1461 } else { 1462 { 1463 { 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); 1468 } 1469 if (GET_H_SYS_SR_OVE ()) { 1470 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1471 } 1472 } 1473 } 1474 1475 abuf->written = written; 1476 return vpc; 1477 #undef FLD 1478 } 1479 1480 /* l-divu: l.divu $rD,$rA,$rB */ 1481 1482 static SEM_PC 1483 SEM_FN_NAME (or1k32bf,l_divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1484 { 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); 1490 1491 if (NESI (GET_H_GPR (FLD (f_r3)), 0)) { 1492 { 1493 { 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); 1498 } 1499 { 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); 1504 } 1505 } 1506 } else { 1507 { 1508 { 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); 1513 } 1514 if (GET_H_SYS_SR_OVE ()) { 1515 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1516 } 1517 } 1518 } 1519 1520 abuf->written = written; 1521 return vpc; 1522 #undef FLD 1523 } 1524 1525 /* l-ff1: l.ff1 $rD,$rA */ 1526 1527 static SEM_PC 1528 SEM_FN_NAME (or1k32bf,l_ff1) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1529 { 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); 1535 1536 { 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); 1540 } 1541 1542 return vpc; 1543 #undef FLD 1544 } 1545 1546 /* l-fl1: l.fl1 $rD,$rA */ 1547 1548 static SEM_PC 1549 SEM_FN_NAME (or1k32bf,l_fl1) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1550 { 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); 1556 1557 { 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); 1561 } 1562 1563 return vpc; 1564 #undef FLD 1565 } 1566 1567 /* l-andi: l.andi $rD,$rA,$uimm16 */ 1568 1569 static SEM_PC 1570 SEM_FN_NAME (or1k32bf,l_andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1571 { 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); 1577 1578 { 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); 1582 } 1583 1584 return vpc; 1585 #undef FLD 1586 } 1587 1588 /* l-ori: l.ori $rD,$rA,$uimm16 */ 1589 1590 static SEM_PC 1591 SEM_FN_NAME (or1k32bf,l_ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1592 { 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); 1598 1599 { 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); 1603 } 1604 1605 return vpc; 1606 #undef FLD 1607 } 1608 1609 /* l-xori: l.xori $rD,$rA,$simm16 */ 1610 1611 static SEM_PC 1612 SEM_FN_NAME (or1k32bf,l_xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1613 { 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); 1619 1620 { 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); 1624 } 1625 1626 return vpc; 1627 #undef FLD 1628 } 1629 1630 /* l-addi: l.addi $rD,$rA,$simm16 */ 1631 1632 static SEM_PC 1633 SEM_FN_NAME (or1k32bf,l_addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1634 { 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); 1640 1641 { 1642 { 1643 { 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); 1647 } 1648 { 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); 1652 } 1653 { 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); 1657 } 1658 } 1659 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 1660 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1661 } 1662 } 1663 1664 return vpc; 1665 #undef FLD 1666 } 1667 1668 /* l-addic: l.addic $rD,$rA,$simm16 */ 1669 1670 static SEM_PC 1671 SEM_FN_NAME (or1k32bf,l_addic) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1672 { 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); 1678 1679 { 1680 { 1681 BI tmp_tmp_sys_sr_cy; 1682 tmp_tmp_sys_sr_cy = GET_H_SYS_SR_CY (); 1683 { 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); 1687 } 1688 { 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); 1692 } 1693 { 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); 1697 } 1698 } 1699 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 1700 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1701 } 1702 } 1703 1704 return vpc; 1705 #undef FLD 1706 } 1707 1708 /* l-muli: l.muli $rD,$rA,$simm16 */ 1709 1710 static SEM_PC 1711 SEM_FN_NAME (or1k32bf,l_muli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1712 { 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); 1718 1719 { 1720 { 1721 { 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); 1725 } 1726 { 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); 1730 } 1731 } 1732 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 1733 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 1734 } 1735 } 1736 1737 return vpc; 1738 #undef FLD 1739 } 1740 1741 /* l-exths: l.exths $rD,$rA */ 1742 1743 static SEM_PC 1744 SEM_FN_NAME (or1k32bf,l_exths) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1745 { 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); 1751 1752 { 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); 1756 } 1757 1758 return vpc; 1759 #undef FLD 1760 } 1761 1762 /* l-extbs: l.extbs $rD,$rA */ 1763 1764 static SEM_PC 1765 SEM_FN_NAME (or1k32bf,l_extbs) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1766 { 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); 1772 1773 { 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); 1777 } 1778 1779 return vpc; 1780 #undef FLD 1781 } 1782 1783 /* l-exthz: l.exthz $rD,$rA */ 1784 1785 static SEM_PC 1786 SEM_FN_NAME (or1k32bf,l_exthz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1787 { 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); 1793 1794 { 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); 1798 } 1799 1800 return vpc; 1801 #undef FLD 1802 } 1803 1804 /* l-extbz: l.extbz $rD,$rA */ 1805 1806 static SEM_PC 1807 SEM_FN_NAME (or1k32bf,l_extbz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1808 { 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); 1814 1815 { 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); 1819 } 1820 1821 return vpc; 1822 #undef FLD 1823 } 1824 1825 /* l-extws: l.extws $rD,$rA */ 1826 1827 static SEM_PC 1828 SEM_FN_NAME (or1k32bf,l_extws) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1829 { 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); 1835 1836 { 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); 1840 } 1841 1842 return vpc; 1843 #undef FLD 1844 } 1845 1846 /* l-extwz: l.extwz $rD,$rA */ 1847 1848 static SEM_PC 1849 SEM_FN_NAME (or1k32bf,l_extwz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1850 { 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); 1856 1857 { 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); 1861 } 1862 1863 return vpc; 1864 #undef FLD 1865 } 1866 1867 /* l-cmov: l.cmov $rD,$rA,$rB */ 1868 1869 static SEM_PC 1870 SEM_FN_NAME (or1k32bf,l_cmov) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1871 { 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); 1877 1878 if (GET_H_SYS_SR_F ()) { 1879 { 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); 1884 } 1885 } else { 1886 { 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); 1891 } 1892 } 1893 1894 abuf->written = written; 1895 return vpc; 1896 #undef FLD 1897 } 1898 1899 /* l-sfgts: l.sfgts $rA,$rB */ 1900 1901 static SEM_PC 1902 SEM_FN_NAME (or1k32bf,l_sfgts) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1903 { 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); 1909 1910 { 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); 1914 } 1915 1916 return vpc; 1917 #undef FLD 1918 } 1919 1920 /* l-sfgtsi: l.sfgtsi $rA,$simm16 */ 1921 1922 static SEM_PC 1923 SEM_FN_NAME (or1k32bf,l_sfgtsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1924 { 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); 1930 1931 { 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); 1935 } 1936 1937 return vpc; 1938 #undef FLD 1939 } 1940 1941 /* l-sfgtu: l.sfgtu $rA,$rB */ 1942 1943 static SEM_PC 1944 SEM_FN_NAME (or1k32bf,l_sfgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1945 { 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); 1951 1952 { 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); 1956 } 1957 1958 return vpc; 1959 #undef FLD 1960 } 1961 1962 /* l-sfgtui: l.sfgtui $rA,$simm16 */ 1963 1964 static SEM_PC 1965 SEM_FN_NAME (or1k32bf,l_sfgtui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1966 { 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); 1972 1973 { 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); 1977 } 1978 1979 return vpc; 1980 #undef FLD 1981 } 1982 1983 /* l-sfges: l.sfges $rA,$rB */ 1984 1985 static SEM_PC 1986 SEM_FN_NAME (or1k32bf,l_sfges) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1987 { 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); 1993 1994 { 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); 1998 } 1999 2000 return vpc; 2001 #undef FLD 2002 } 2003 2004 /* l-sfgesi: l.sfgesi $rA,$simm16 */ 2005 2006 static SEM_PC 2007 SEM_FN_NAME (or1k32bf,l_sfgesi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2008 { 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); 2014 2015 { 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); 2019 } 2020 2021 return vpc; 2022 #undef FLD 2023 } 2024 2025 /* l-sfgeu: l.sfgeu $rA,$rB */ 2026 2027 static SEM_PC 2028 SEM_FN_NAME (or1k32bf,l_sfgeu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2029 { 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); 2035 2036 { 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); 2040 } 2041 2042 return vpc; 2043 #undef FLD 2044 } 2045 2046 /* l-sfgeui: l.sfgeui $rA,$simm16 */ 2047 2048 static SEM_PC 2049 SEM_FN_NAME (or1k32bf,l_sfgeui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2050 { 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); 2056 2057 { 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); 2061 } 2062 2063 return vpc; 2064 #undef FLD 2065 } 2066 2067 /* l-sflts: l.sflts $rA,$rB */ 2068 2069 static SEM_PC 2070 SEM_FN_NAME (or1k32bf,l_sflts) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2071 { 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); 2077 2078 { 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); 2082 } 2083 2084 return vpc; 2085 #undef FLD 2086 } 2087 2088 /* l-sfltsi: l.sfltsi $rA,$simm16 */ 2089 2090 static SEM_PC 2091 SEM_FN_NAME (or1k32bf,l_sfltsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2092 { 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); 2098 2099 { 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); 2103 } 2104 2105 return vpc; 2106 #undef FLD 2107 } 2108 2109 /* l-sfltu: l.sfltu $rA,$rB */ 2110 2111 static SEM_PC 2112 SEM_FN_NAME (or1k32bf,l_sfltu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2113 { 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); 2119 2120 { 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); 2124 } 2125 2126 return vpc; 2127 #undef FLD 2128 } 2129 2130 /* l-sfltui: l.sfltui $rA,$simm16 */ 2131 2132 static SEM_PC 2133 SEM_FN_NAME (or1k32bf,l_sfltui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2134 { 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); 2140 2141 { 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); 2145 } 2146 2147 return vpc; 2148 #undef FLD 2149 } 2150 2151 /* l-sfles: l.sfles $rA,$rB */ 2152 2153 static SEM_PC 2154 SEM_FN_NAME (or1k32bf,l_sfles) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2155 { 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); 2161 2162 { 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); 2166 } 2167 2168 return vpc; 2169 #undef FLD 2170 } 2171 2172 /* l-sflesi: l.sflesi $rA,$simm16 */ 2173 2174 static SEM_PC 2175 SEM_FN_NAME (or1k32bf,l_sflesi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2176 { 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); 2182 2183 { 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); 2187 } 2188 2189 return vpc; 2190 #undef FLD 2191 } 2192 2193 /* l-sfleu: l.sfleu $rA,$rB */ 2194 2195 static SEM_PC 2196 SEM_FN_NAME (or1k32bf,l_sfleu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2197 { 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); 2203 2204 { 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); 2208 } 2209 2210 return vpc; 2211 #undef FLD 2212 } 2213 2214 /* l-sfleui: l.sfleui $rA,$simm16 */ 2215 2216 static SEM_PC 2217 SEM_FN_NAME (or1k32bf,l_sfleui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2218 { 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); 2224 2225 { 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); 2229 } 2230 2231 return vpc; 2232 #undef FLD 2233 } 2234 2235 /* l-sfeq: l.sfeq $rA,$rB */ 2236 2237 static SEM_PC 2238 SEM_FN_NAME (or1k32bf,l_sfeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2239 { 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); 2245 2246 { 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); 2250 } 2251 2252 return vpc; 2253 #undef FLD 2254 } 2255 2256 /* l-sfeqi: l.sfeqi $rA,$simm16 */ 2257 2258 static SEM_PC 2259 SEM_FN_NAME (or1k32bf,l_sfeqi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2260 { 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); 2266 2267 { 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); 2271 } 2272 2273 return vpc; 2274 #undef FLD 2275 } 2276 2277 /* l-sfne: l.sfne $rA,$rB */ 2278 2279 static SEM_PC 2280 SEM_FN_NAME (or1k32bf,l_sfne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2281 { 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); 2287 2288 { 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); 2292 } 2293 2294 return vpc; 2295 #undef FLD 2296 } 2297 2298 /* l-sfnei: l.sfnei $rA,$simm16 */ 2299 2300 static SEM_PC 2301 SEM_FN_NAME (or1k32bf,l_sfnei) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2302 { 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); 2308 2309 { 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); 2313 } 2314 2315 return vpc; 2316 #undef FLD 2317 } 2318 2319 /* l-mac: l.mac $rA,$rB */ 2320 2321 static SEM_PC 2322 SEM_FN_NAME (or1k32bf,l_mac) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2323 { 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); 2329 2330 { 2331 { 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); 2338 { 2339 SI opval = SUBWORDDISI (tmp_result, 0); 2340 SET_H_MAC_MACHI (opval); 2341 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 2342 } 2343 { 2344 SI opval = SUBWORDDISI (tmp_result, 1); 2345 SET_H_MAC_MACLO (opval); 2346 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 2347 } 2348 { 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); 2352 } 2353 } 2354 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 2355 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 2356 } 2357 } 2358 2359 return vpc; 2360 #undef FLD 2361 } 2362 2363 /* l-maci: l.maci $rA,${simm16} */ 2364 2365 static SEM_PC 2366 SEM_FN_NAME (or1k32bf,l_maci) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2367 { 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); 2373 2374 { 2375 { 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); 2382 { 2383 SI opval = SUBWORDDISI (tmp_result, 0); 2384 SET_H_MAC_MACHI (opval); 2385 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 2386 } 2387 { 2388 SI opval = SUBWORDDISI (tmp_result, 1); 2389 SET_H_MAC_MACLO (opval); 2390 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 2391 } 2392 { 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); 2396 } 2397 } 2398 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 2399 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 2400 } 2401 } 2402 2403 return vpc; 2404 #undef FLD 2405 } 2406 2407 /* l-macu: l.macu $rA,$rB */ 2408 2409 static SEM_PC 2410 SEM_FN_NAME (or1k32bf,l_macu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2411 { 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); 2417 2418 { 2419 { 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); 2426 { 2427 SI opval = SUBWORDDISI (tmp_result, 0); 2428 SET_H_MAC_MACHI (opval); 2429 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 2430 } 2431 { 2432 SI opval = SUBWORDDISI (tmp_result, 1); 2433 SET_H_MAC_MACLO (opval); 2434 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 2435 } 2436 { 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); 2440 } 2441 } 2442 if (ANDIF (GET_H_SYS_SR_CY (), GET_H_SYS_SR_OVE ())) { 2443 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 2444 } 2445 } 2446 2447 return vpc; 2448 #undef FLD 2449 } 2450 2451 /* l-msb: l.msb $rA,$rB */ 2452 2453 static SEM_PC 2454 SEM_FN_NAME (or1k32bf,l_msb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2455 { 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); 2461 2462 { 2463 { 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); 2470 { 2471 SI opval = SUBWORDDISI (tmp_result, 0); 2472 SET_H_MAC_MACHI (opval); 2473 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 2474 } 2475 { 2476 SI opval = SUBWORDDISI (tmp_result, 1); 2477 SET_H_MAC_MACLO (opval); 2478 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 2479 } 2480 { 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); 2484 } 2485 } 2486 if (ANDIF (GET_H_SYS_SR_OV (), GET_H_SYS_SR_OVE ())) { 2487 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 2488 } 2489 } 2490 2491 return vpc; 2492 #undef FLD 2493 } 2494 2495 /* l-msbu: l.msbu $rA,$rB */ 2496 2497 static SEM_PC 2498 SEM_FN_NAME (or1k32bf,l_msbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2499 { 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); 2505 2506 { 2507 { 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); 2514 { 2515 SI opval = SUBWORDDISI (tmp_result, 0); 2516 SET_H_MAC_MACHI (opval); 2517 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-machi", 'x', opval); 2518 } 2519 { 2520 SI opval = SUBWORDDISI (tmp_result, 1); 2521 SET_H_MAC_MACLO (opval); 2522 CGEN_TRACE_RESULT (current_cpu, abuf, "mac-maclo", 'x', opval); 2523 } 2524 { 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); 2528 } 2529 } 2530 if (ANDIF (GET_H_SYS_SR_CY (), GET_H_SYS_SR_OVE ())) { 2531 or1k32bf_exception (current_cpu, pc, EXCEPT_RANGE); 2532 } 2533 } 2534 2535 return vpc; 2536 #undef FLD 2537 } 2538 2539 /* l-cust1: l.cust1 */ 2540 2541 static SEM_PC 2542 SEM_FN_NAME (or1k32bf,l_cust1) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2543 { 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); 2549 2550 ((void) 0); /*nop*/ 2551 2552 return vpc; 2553 #undef FLD 2554 } 2555 2556 /* l-cust2: l.cust2 */ 2557 2558 static SEM_PC 2559 SEM_FN_NAME (or1k32bf,l_cust2) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2560 { 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); 2566 2567 ((void) 0); /*nop*/ 2568 2569 return vpc; 2570 #undef FLD 2571 } 2572 2573 /* l-cust3: l.cust3 */ 2574 2575 static SEM_PC 2576 SEM_FN_NAME (or1k32bf,l_cust3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2577 { 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); 2583 2584 ((void) 0); /*nop*/ 2585 2586 return vpc; 2587 #undef FLD 2588 } 2589 2590 /* l-cust4: l.cust4 */ 2591 2592 static SEM_PC 2593 SEM_FN_NAME (or1k32bf,l_cust4) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2594 { 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); 2600 2601 ((void) 0); /*nop*/ 2602 2603 return vpc; 2604 #undef FLD 2605 } 2606 2607 /* l-cust5: l.cust5 */ 2608 2609 static SEM_PC 2610 SEM_FN_NAME (or1k32bf,l_cust5) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2611 { 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); 2617 2618 ((void) 0); /*nop*/ 2619 2620 return vpc; 2621 #undef FLD 2622 } 2623 2624 /* l-cust6: l.cust6 */ 2625 2626 static SEM_PC 2627 SEM_FN_NAME (or1k32bf,l_cust6) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2628 { 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); 2634 2635 ((void) 0); /*nop*/ 2636 2637 return vpc; 2638 #undef FLD 2639 } 2640 2641 /* l-cust7: l.cust7 */ 2642 2643 static SEM_PC 2644 SEM_FN_NAME (or1k32bf,l_cust7) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2645 { 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); 2651 2652 ((void) 0); /*nop*/ 2653 2654 return vpc; 2655 #undef FLD 2656 } 2657 2658 /* l-cust8: l.cust8 */ 2659 2660 static SEM_PC 2661 SEM_FN_NAME (or1k32bf,l_cust8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2662 { 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); 2668 2669 ((void) 0); /*nop*/ 2670 2671 return vpc; 2672 #undef FLD 2673 } 2674 2675 /* lf-add-s: lf.add.s $rDSF,$rASF,$rBSF */ 2676 2677 static SEM_PC 2678 SEM_FN_NAME (or1k32bf,lf_add_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2679 { 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); 2685 2686 { 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); 2690 } 2691 2692 return vpc; 2693 #undef FLD 2694 } 2695 2696 /* lf-add-d32: lf.add.d $rDD32F,$rAD32F,$rBD32F */ 2697 2698 static SEM_PC 2699 SEM_FN_NAME (or1k32bf,lf_add_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2700 { 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); 2706 2707 { 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); 2711 } 2712 2713 return vpc; 2714 #undef FLD 2715 } 2716 2717 /* lf-sub-s: lf.sub.s $rDSF,$rASF,$rBSF */ 2718 2719 static SEM_PC 2720 SEM_FN_NAME (or1k32bf,lf_sub_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2721 { 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); 2727 2728 { 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); 2732 } 2733 2734 return vpc; 2735 #undef FLD 2736 } 2737 2738 /* lf-sub-d32: lf.sub.d $rDD32F,$rAD32F,$rBD32F */ 2739 2740 static SEM_PC 2741 SEM_FN_NAME (or1k32bf,lf_sub_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2742 { 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); 2748 2749 { 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); 2753 } 2754 2755 return vpc; 2756 #undef FLD 2757 } 2758 2759 /* lf-mul-s: lf.mul.s $rDSF,$rASF,$rBSF */ 2760 2761 static SEM_PC 2762 SEM_FN_NAME (or1k32bf,lf_mul_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2763 { 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); 2769 2770 { 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); 2774 } 2775 2776 return vpc; 2777 #undef FLD 2778 } 2779 2780 /* lf-mul-d32: lf.mul.d $rDD32F,$rAD32F,$rBD32F */ 2781 2782 static SEM_PC 2783 SEM_FN_NAME (or1k32bf,lf_mul_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2784 { 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); 2790 2791 { 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); 2795 } 2796 2797 return vpc; 2798 #undef FLD 2799 } 2800 2801 /* lf-div-s: lf.div.s $rDSF,$rASF,$rBSF */ 2802 2803 static SEM_PC 2804 SEM_FN_NAME (or1k32bf,lf_div_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2805 { 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); 2811 2812 { 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); 2816 } 2817 2818 return vpc; 2819 #undef FLD 2820 } 2821 2822 /* lf-div-d32: lf.div.d $rDD32F,$rAD32F,$rBD32F */ 2823 2824 static SEM_PC 2825 SEM_FN_NAME (or1k32bf,lf_div_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2826 { 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); 2832 2833 { 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); 2837 } 2838 2839 return vpc; 2840 #undef FLD 2841 } 2842 2843 /* lf-rem-s: lf.rem.s $rDSF,$rASF,$rBSF */ 2844 2845 static SEM_PC 2846 SEM_FN_NAME (or1k32bf,lf_rem_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2847 { 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); 2853 2854 { 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); 2858 } 2859 2860 return vpc; 2861 #undef FLD 2862 } 2863 2864 /* lf-rem-d32: lf.rem.d $rDD32F,$rAD32F,$rBD32F */ 2865 2866 static SEM_PC 2867 SEM_FN_NAME (or1k32bf,lf_rem_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2868 { 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); 2874 2875 { 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); 2879 } 2880 2881 return vpc; 2882 #undef FLD 2883 } 2884 2885 /* lf-itof-s: lf.itof.s $rDSF,$rA */ 2886 2887 static SEM_PC 2888 SEM_FN_NAME (or1k32bf,lf_itof_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2889 { 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); 2895 2896 { 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); 2900 } 2901 2902 return vpc; 2903 #undef FLD 2904 } 2905 2906 /* lf-itof-d32: lf.itof.d $rDD32F,$rADI */ 2907 2908 static SEM_PC 2909 SEM_FN_NAME (or1k32bf,lf_itof_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2910 { 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); 2916 2917 { 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); 2921 } 2922 2923 return vpc; 2924 #undef FLD 2925 } 2926 2927 /* lf-ftoi-s: lf.ftoi.s $rD,$rASF */ 2928 2929 static SEM_PC 2930 SEM_FN_NAME (or1k32bf,lf_ftoi_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2931 { 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); 2937 2938 { 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); 2942 } 2943 2944 return vpc; 2945 #undef FLD 2946 } 2947 2948 /* lf-ftoi-d32: lf.ftoi.d $rDDI,$rAD32F */ 2949 2950 static SEM_PC 2951 SEM_FN_NAME (or1k32bf,lf_ftoi_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2952 { 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); 2958 2959 { 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); 2963 } 2964 2965 return vpc; 2966 #undef FLD 2967 } 2968 2969 /* lf-sfeq-s: lf.sfeq.s $rASF,$rBSF */ 2970 2971 static SEM_PC 2972 SEM_FN_NAME (or1k32bf,lf_sfeq_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2973 { 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); 2979 2980 { 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); 2984 } 2985 2986 return vpc; 2987 #undef FLD 2988 } 2989 2990 /* lf-sfeq-d32: lf.sfeq.d $rAD32F,$rBD32F */ 2991 2992 static SEM_PC 2993 SEM_FN_NAME (or1k32bf,lf_sfeq_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 2994 { 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); 3000 3001 { 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); 3005 } 3006 3007 return vpc; 3008 #undef FLD 3009 } 3010 3011 /* lf-sfne-s: lf.sfne.s $rASF,$rBSF */ 3012 3013 static SEM_PC 3014 SEM_FN_NAME (or1k32bf,lf_sfne_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3015 { 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); 3021 3022 { 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); 3026 } 3027 3028 return vpc; 3029 #undef FLD 3030 } 3031 3032 /* lf-sfne-d32: lf.sfne.d $rAD32F,$rBD32F */ 3033 3034 static SEM_PC 3035 SEM_FN_NAME (or1k32bf,lf_sfne_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3036 { 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); 3042 3043 { 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); 3047 } 3048 3049 return vpc; 3050 #undef FLD 3051 } 3052 3053 /* lf-sfge-s: lf.sfge.s $rASF,$rBSF */ 3054 3055 static SEM_PC 3056 SEM_FN_NAME (or1k32bf,lf_sfge_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3057 { 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); 3063 3064 { 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); 3068 } 3069 3070 return vpc; 3071 #undef FLD 3072 } 3073 3074 /* lf-sfge-d32: lf.sfge.d $rAD32F,$rBD32F */ 3075 3076 static SEM_PC 3077 SEM_FN_NAME (or1k32bf,lf_sfge_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3078 { 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); 3084 3085 { 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); 3089 } 3090 3091 return vpc; 3092 #undef FLD 3093 } 3094 3095 /* lf-sfgt-s: lf.sfgt.s $rASF,$rBSF */ 3096 3097 static SEM_PC 3098 SEM_FN_NAME (or1k32bf,lf_sfgt_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3099 { 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); 3105 3106 { 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); 3110 } 3111 3112 return vpc; 3113 #undef FLD 3114 } 3115 3116 /* lf-sfgt-d32: lf.sfgt.d $rAD32F,$rBD32F */ 3117 3118 static SEM_PC 3119 SEM_FN_NAME (or1k32bf,lf_sfgt_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3120 { 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); 3126 3127 { 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); 3131 } 3132 3133 return vpc; 3134 #undef FLD 3135 } 3136 3137 /* lf-sflt-s: lf.sflt.s $rASF,$rBSF */ 3138 3139 static SEM_PC 3140 SEM_FN_NAME (or1k32bf,lf_sflt_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3141 { 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); 3147 3148 { 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); 3152 } 3153 3154 return vpc; 3155 #undef FLD 3156 } 3157 3158 /* lf-sflt-d32: lf.sflt.d $rAD32F,$rBD32F */ 3159 3160 static SEM_PC 3161 SEM_FN_NAME (or1k32bf,lf_sflt_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3162 { 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); 3168 3169 { 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); 3173 } 3174 3175 return vpc; 3176 #undef FLD 3177 } 3178 3179 /* lf-sfle-s: lf.sfle.s $rASF,$rBSF */ 3180 3181 static SEM_PC 3182 SEM_FN_NAME (or1k32bf,lf_sfle_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3183 { 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); 3189 3190 { 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); 3194 } 3195 3196 return vpc; 3197 #undef FLD 3198 } 3199 3200 /* lf-sfle-d32: lf.sfle.d $rAD32F,$rBD32F */ 3201 3202 static SEM_PC 3203 SEM_FN_NAME (or1k32bf,lf_sfle_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3204 { 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); 3210 3211 { 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); 3215 } 3216 3217 return vpc; 3218 #undef FLD 3219 } 3220 3221 /* lf-sfueq-s: lf.sfueq.s $rASF,$rBSF */ 3222 3223 static SEM_PC 3224 SEM_FN_NAME (or1k32bf,lf_sfueq_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3225 { 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); 3231 3232 { 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); 3236 } 3237 3238 return vpc; 3239 #undef FLD 3240 } 3241 3242 /* lf-sfueq-d32: lf.sfueq.d $rAD32F,$rBD32F */ 3243 3244 static SEM_PC 3245 SEM_FN_NAME (or1k32bf,lf_sfueq_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3246 { 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); 3252 3253 { 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); 3257 } 3258 3259 return vpc; 3260 #undef FLD 3261 } 3262 3263 /* lf-sfune-s: lf.sfune.s $rASF,$rBSF */ 3264 3265 static SEM_PC 3266 SEM_FN_NAME (or1k32bf,lf_sfune_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3267 { 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); 3273 3274 { 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); 3278 } 3279 3280 return vpc; 3281 #undef FLD 3282 } 3283 3284 /* lf-sfune-d32: lf.sfune.d $rAD32F,$rBD32F */ 3285 3286 static SEM_PC 3287 SEM_FN_NAME (or1k32bf,lf_sfune_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3288 { 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); 3294 3295 { 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); 3299 } 3300 3301 return vpc; 3302 #undef FLD 3303 } 3304 3305 /* lf-sfugt-s: lf.sfugt.s $rASF,$rBSF */ 3306 3307 static SEM_PC 3308 SEM_FN_NAME (or1k32bf,lf_sfugt_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3309 { 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); 3315 3316 { 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); 3320 } 3321 3322 return vpc; 3323 #undef FLD 3324 } 3325 3326 /* lf-sfugt-d32: lf.sfugt.d $rAD32F,$rBD32F */ 3327 3328 static SEM_PC 3329 SEM_FN_NAME (or1k32bf,lf_sfugt_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3330 { 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); 3336 3337 { 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); 3341 } 3342 3343 return vpc; 3344 #undef FLD 3345 } 3346 3347 /* lf-sfuge-s: lf.sfuge.s $rASF,$rBSF */ 3348 3349 static SEM_PC 3350 SEM_FN_NAME (or1k32bf,lf_sfuge_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3351 { 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); 3357 3358 { 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); 3362 } 3363 3364 return vpc; 3365 #undef FLD 3366 } 3367 3368 /* lf-sfuge-d32: lf.sfuge.d $rAD32F,$rBD32F */ 3369 3370 static SEM_PC 3371 SEM_FN_NAME (or1k32bf,lf_sfuge_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3372 { 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); 3378 3379 { 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); 3383 } 3384 3385 return vpc; 3386 #undef FLD 3387 } 3388 3389 /* lf-sfult-s: lf.sfult.s $rASF,$rBSF */ 3390 3391 static SEM_PC 3392 SEM_FN_NAME (or1k32bf,lf_sfult_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3393 { 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); 3399 3400 { 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); 3404 } 3405 3406 return vpc; 3407 #undef FLD 3408 } 3409 3410 /* lf-sfult-d32: lf.sfult.d $rAD32F,$rBD32F */ 3411 3412 static SEM_PC 3413 SEM_FN_NAME (or1k32bf,lf_sfult_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3414 { 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); 3420 3421 { 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); 3425 } 3426 3427 return vpc; 3428 #undef FLD 3429 } 3430 3431 /* lf-sfule-s: lf.sfule.s $rASF,$rBSF */ 3432 3433 static SEM_PC 3434 SEM_FN_NAME (or1k32bf,lf_sfule_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3435 { 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); 3441 3442 { 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); 3446 } 3447 3448 return vpc; 3449 #undef FLD 3450 } 3451 3452 /* lf-sfule-d32: lf.sfule.d $rAD32F,$rBD32F */ 3453 3454 static SEM_PC 3455 SEM_FN_NAME (or1k32bf,lf_sfule_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3456 { 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); 3462 3463 { 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); 3467 } 3468 3469 return vpc; 3470 #undef FLD 3471 } 3472 3473 /* lf-sfun-s: lf.sfun.s $rASF,$rBSF */ 3474 3475 static SEM_PC 3476 SEM_FN_NAME (or1k32bf,lf_sfun_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3477 { 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); 3483 3484 { 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); 3488 } 3489 3490 return vpc; 3491 #undef FLD 3492 } 3493 3494 /* lf-sfun-d32: lf.sfun.d $rAD32F,$rBD32F */ 3495 3496 static SEM_PC 3497 SEM_FN_NAME (or1k32bf,lf_sfun_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3498 { 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); 3504 3505 { 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); 3509 } 3510 3511 return vpc; 3512 #undef FLD 3513 } 3514 3515 /* lf-madd-s: lf.madd.s $rDSF,$rASF,$rBSF */ 3516 3517 static SEM_PC 3518 SEM_FN_NAME (or1k32bf,lf_madd_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3519 { 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); 3525 3526 { 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); 3530 } 3531 3532 return vpc; 3533 #undef FLD 3534 } 3535 3536 /* lf-madd-d32: lf.madd.d $rDD32F,$rAD32F,$rBD32F */ 3537 3538 static SEM_PC 3539 SEM_FN_NAME (or1k32bf,lf_madd_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3540 { 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); 3546 3547 { 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); 3551 } 3552 3553 return vpc; 3554 #undef FLD 3555 } 3556 3557 /* lf-cust1-s: lf.cust1.s $rASF,$rBSF */ 3558 3559 static SEM_PC 3560 SEM_FN_NAME (or1k32bf,lf_cust1_s) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3561 { 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); 3567 3568 ((void) 0); /*nop*/ 3569 3570 return vpc; 3571 #undef FLD 3572 } 3573 3574 /* lf-cust1-d32: lf.cust1.d */ 3575 3576 static SEM_PC 3577 SEM_FN_NAME (or1k32bf,lf_cust1_d32) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 3578 { 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); 3584 3585 ((void) 0); /*nop*/ 3586 3587 return vpc; 3588 #undef FLD 3589 } 3590 3591 /* Table of all semantic fns. */ 3592 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 } 3742 }; 3743 3744 /* Add the semantic fns to IDESC_TABLE. */ 3745 3746 void 3747 SEM_FN_NAME (or1k32bf,init_idesc_table) (SIM_CPU *current_cpu) 3748 { 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)); 3752 3753 for (sf = &sem_fns[0]; sf->fn != 0; ++sf) 3754 { 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 3769 } 3770 } 3771 3772