op.c 29.5 KB
Newer Older
B
bellard 已提交
1
/*
2
 *  PowerPC emulation micro-operations for qemu.
3
 *
4
 *  Copyright (c) 2003-2007 Jocelyn Mayer
B
bellard 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

21 22
//#define DEBUG_OP

B
bellard 已提交
23 24
#include "config.h"
#include "exec.h"
25
#include "host-utils.h"
26
#include "helper_regs.h"
27
#include "op_helper.h"
B
bellard 已提交
28

29
/* Generate exceptions */
30
void OPPROTO op_raise_exception_err (void)
31
{
32
    do_raise_exception_err(PARAM1, PARAM2);
33 34
}

35
void OPPROTO op_debug (void)
36 37 38 39
{
    do_raise_exception(EXCP_DEBUG);
}

40 41
#if !defined(CONFIG_USER_ONLY)
/* Segment registers load and store */
42
void OPPROTO op_load_sr (void)
43
{
44
    T0 = env->sr[T1];
45 46 47
    RETURN();
}

48
void OPPROTO op_store_sr (void)
49 50 51 52 53
{
    do_store_sr(env, T1, T0);
    RETURN();
}

54 55 56 57 58 59 60 61 62 63 64 65 66 67
#if defined(TARGET_PPC64)
void OPPROTO op_load_slb (void)
{
    T0 = ppc_load_slb(env, T1);
    RETURN();
}

void OPPROTO op_store_slb (void)
{
    ppc_store_slb(env, T1, T0);
    RETURN();
}
#endif /* defined(TARGET_PPC64) */

68
void OPPROTO op_load_sdr1 (void)
69
{
70
    T0 = env->sdr1;
71 72 73
    RETURN();
}

74
void OPPROTO op_store_sdr1 (void)
75 76
{
    do_store_sdr1(env, T0);
B
bellard 已提交
77 78 79
    RETURN();
}

80 81 82 83 84 85 86 87 88 89 90 91 92 93
#if defined (TARGET_PPC64)
void OPPROTO op_load_asr (void)
{
    T0 = env->asr;
    RETURN();
}

void OPPROTO op_store_asr (void)
{
    ppc_store_asr(env, T0);
    RETURN();
}
#endif

A
aurel32 已提交
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
void OPPROTO op_load_msr (void)
{
    T0 = env->msr;
    RETURN();
}

void OPPROTO op_store_msr (void)
{
    do_store_msr();
    RETURN();
}

#if defined (TARGET_PPC64)
void OPPROTO op_store_msr_32 (void)
{
    T0 = (env->msr & ~0xFFFFFFFFULL) | (T0 & 0xFFFFFFFF);
    do_store_msr();
    RETURN();
}
#endif

115
void OPPROTO op_update_riee (void)
116
{
117 118 119 120 121 122
    /* We don't call do_store_msr here as we won't trigger
     * any special case nor change hflags
     */
    T0 &= (1 << MSR_RI) | (1 << MSR_EE);
    env->msr &= ~(1 << MSR_RI) | (1 << MSR_EE);
    env->msr |= T0;
123 124 125
    RETURN();
}
#endif
126 127

/* SPR */
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
void OPPROTO op_load_spr (void)
{
    T0 = env->spr[PARAM1];
    RETURN();
}

void OPPROTO op_store_spr (void)
{
    env->spr[PARAM1] = T0;
    RETURN();
}

void OPPROTO op_load_dump_spr (void)
{
    T0 = ppc_load_dump_spr(PARAM1);
    RETURN();
}

void OPPROTO op_store_dump_spr (void)
147
{
148
    ppc_store_dump_spr(PARAM1, T0);
149 150 151
    RETURN();
}

152
void OPPROTO op_mask_spr (void)
153
{
154
    env->spr[PARAM1] &= ~T0;
B
bellard 已提交
155 156 157
    RETURN();
}

158
void OPPROTO op_load_tbl (void)
159
{
160
    T0 = cpu_ppc_load_tbl(env);
161 162 163
    RETURN();
}

164
void OPPROTO op_load_tbu (void)
165
{
166
    T0 = cpu_ppc_load_tbu(env);
167 168 169
    RETURN();
}

170 171 172 173 174 175 176 177 178 179 180 181
void OPPROTO op_load_atbl (void)
{
    T0 = cpu_ppc_load_atbl(env);
    RETURN();
}

void OPPROTO op_load_atbu (void)
{
    T0 = cpu_ppc_load_atbu(env);
    RETURN();
}

182
#if !defined(CONFIG_USER_ONLY)
183
void OPPROTO op_store_tbl (void)
184
{
185
    cpu_ppc_store_tbl(env, T0);
B
bellard 已提交
186 187 188
    RETURN();
}

189
void OPPROTO op_store_tbu (void)
190
{
191
    cpu_ppc_store_tbu(env, T0);
192 193 194
    RETURN();
}

195 196 197 198 199 200 201 202 203 204 205 206
void OPPROTO op_store_atbl (void)
{
    cpu_ppc_store_atbl(env, T0);
    RETURN();
}

void OPPROTO op_store_atbu (void)
{
    cpu_ppc_store_atbu(env, T0);
    RETURN();
}

207
void OPPROTO op_load_decr (void)
208
{
209
    T0 = cpu_ppc_load_decr(env);
210 211
    RETURN();
}
212

213
void OPPROTO op_store_decr (void)
214
{
215
    cpu_ppc_store_decr(env, T0);
216 217 218
    RETURN();
}

219
void OPPROTO op_load_ibat (void)
220
{
221
    T0 = env->IBAT[PARAM1][PARAM2];
222
    RETURN();
223 224
}

225
void OPPROTO op_store_ibatu (void)
226
{
227 228 229 230
    do_store_ibatu(env, PARAM1, T0);
    RETURN();
}

231
void OPPROTO op_store_ibatl (void)
232 233 234 235 236 237 238
{
#if 1
    env->IBAT[1][PARAM1] = T0;
#else
    do_store_ibatl(env, PARAM1, T0);
#endif
    RETURN();
239 240
}

241
void OPPROTO op_load_dbat (void)
242
{
243
    T0 = env->DBAT[PARAM1][PARAM2];
244
    RETURN();
245 246
}

247
void OPPROTO op_store_dbatu (void)
248 249 250 251 252
{
    do_store_dbatu(env, PARAM1, T0);
    RETURN();
}

253
void OPPROTO op_store_dbatl (void)
254
{
255 256 257 258 259 260
#if 1
    env->DBAT[1][PARAM1] = T0;
#else
    do_store_dbatl(env, PARAM1, T0);
#endif
    RETURN();
261
}
262
#endif /* !defined(CONFIG_USER_ONLY) */
263

B
bellard 已提交
264
/* FPSCR */
265 266
#ifdef CONFIG_SOFTFLOAT
void OPPROTO op_reset_fpstatus (void)
B
bellard 已提交
267
{
268
    env->fp_status.float_exception_flags = 0;
B
bellard 已提交
269 270
    RETURN();
}
271
#endif
B
bellard 已提交
272

273
void OPPROTO op_compute_fprf (void)
B
bellard 已提交
274
{
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
    do_compute_fprf(PARAM1);
    RETURN();
}

#ifdef CONFIG_SOFTFLOAT
void OPPROTO op_float_check_status (void)
{
    do_float_check_status();
    RETURN();
}
#else
void OPPROTO op_float_check_status (void)
{
    if (env->exception_index == POWERPC_EXCP_PROGRAM &&
        (env->error_code & POWERPC_EXCP_FP)) {
        /* Differred floating-point exception after target FPR update */
        if (msr_fe0 != 0 || msr_fe1 != 0)
            do_raise_exception_err(env->exception_index, env->error_code);
    }
B
bellard 已提交
294 295
    RETURN();
}
296 297 298 299 300 301 302
#endif

void OPPROTO op_load_fpscr_FT0 (void)
{
    /* The 32 MSB of the target fpr are undefined.
     * They'll be zero...
     */
A
aurel32 已提交
303 304 305 306
    CPU_DoubleU u;

    u.l.upper = 0;
    u.l.lower = env->fpscr;
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
    FT0 = u.d;
    RETURN();
}

void OPPROTO op_fpscr_resetbit (void)
{
    env->fpscr &= PARAM1;
    RETURN();
}

void OPPROTO op_fpscr_setbit (void)
{
    do_fpscr_setbit(PARAM1);
    RETURN();
}

void OPPROTO op_store_fpscr (void)
{
    do_store_fpscr(PARAM1);
B
bellard 已提交
326 327 328
    RETURN();
}

B
bellard 已提交
329 330
/***                           Integer arithmetic                          ***/
/* add */
331
void OPPROTO op_check_addo (void)
B
bellard 已提交
332
{
A
aurel32 已提交
333
    int ov = (((uint32_t)T2 ^ (uint32_t)T1 ^ UINT32_MAX) &
334
              ((uint32_t)T2 ^ (uint32_t)T0)) >> 31;
A
aurel32 已提交
335 336 337 338 339
    if (ov) {
        env->xer |= (1 << XER_OV) | (1 << XER_SO);
    } else {
        env->xer &= ~(1 << XER_OV);
    }
J
j_mayer 已提交
340
    RETURN();
B
bellard 已提交
341 342
}

343 344
#if defined(TARGET_PPC64)
void OPPROTO op_check_addo_64 (void)
B
bellard 已提交
345
{
A
aurel32 已提交
346
    int ov = (((uint64_t)T2 ^ (uint64_t)T1 ^ UINT64_MAX) &
347
              ((uint64_t)T2 ^ (uint64_t)T0)) >> 63;
A
aurel32 已提交
348 349 350 351 352
    if (ov) {
        env->xer |= (1 << XER_OV) | (1 << XER_SO);
    } else {
        env->xer &= ~(1 << XER_OV);
    }
J
j_mayer 已提交
353
    RETURN();
354 355 356
}
#endif

B
bellard 已提交
357
/***                             Integer shift                             ***/
358 359
void OPPROTO op_srli_T1 (void)
{
360
    T1 = (uint32_t)T1 >> PARAM1;
361 362 363
    RETURN();
}

B
bellard 已提交
364
/***                       Floating-Point arithmetic                       ***/
365
/* fadd - fadd. */
366
void OPPROTO op_fadd (void)
B
bellard 已提交
367
{
368
#if USE_PRECISE_EMULATION
369 370
    do_fadd();
#else
371
    FT0 = float64_add(FT0, FT1, &env->fp_status);
372
#endif
B
bellard 已提交
373 374 375
    RETURN();
}

376
/* fsub - fsub. */
377
void OPPROTO op_fsub (void)
B
bellard 已提交
378
{
379
#if USE_PRECISE_EMULATION
380 381
    do_fsub();
#else
382
    FT0 = float64_sub(FT0, FT1, &env->fp_status);
383
#endif
B
bellard 已提交
384 385 386
    RETURN();
}

387
/* fmul - fmul. */
388
void OPPROTO op_fmul (void)
B
bellard 已提交
389
{
390
#if USE_PRECISE_EMULATION
391 392
    do_fmul();
#else
393
    FT0 = float64_mul(FT0, FT1, &env->fp_status);
394
#endif
B
bellard 已提交
395 396 397
    RETURN();
}

398
/* fdiv - fdiv. */
399
void OPPROTO op_fdiv (void)
B
bellard 已提交
400
{
401
#if USE_PRECISE_EMULATION
402 403
    do_fdiv();
#else
404
    FT0 = float64_div(FT0, FT1, &env->fp_status);
405
#endif
B
bellard 已提交
406 407
    RETURN();
}
408

409
/* fsqrt - fsqrt. */
410
void OPPROTO op_fsqrt (void)
411
{
412 413
    do_fsqrt();
    RETURN();
414 415
}

416 417 418 419 420 421 422
/* fre - fre. */
void OPPROTO op_fre (void)
{
    do_fre();
    RETURN();
}

423
/* fres - fres. */
424
void OPPROTO op_fres (void)
425
{
426 427
    do_fres();
    RETURN();
428 429
}

430
/* frsqrte  - frsqrte. */
431
void OPPROTO op_frsqrte (void)
432
{
433
    do_frsqrte();
434
    RETURN();
435 436
}

437
/* fsel - fsel. */
438
void OPPROTO op_fsel (void)
439
{
440 441
    do_fsel();
    RETURN();
442 443
}

444 445
/***                     Floating-Point multiply-and-add                   ***/
/* fmadd - fmadd. */
446
void OPPROTO op_fmadd (void)
447
{
448
#if USE_PRECISE_EMULATION
J
j_mayer 已提交
449 450
    do_fmadd();
#else
451 452
    FT0 = float64_mul(FT0, FT1, &env->fp_status);
    FT0 = float64_add(FT0, FT2, &env->fp_status);
J
j_mayer 已提交
453
#endif
454
    RETURN();
455 456
}

457
/* fmsub - fmsub. */
458
void OPPROTO op_fmsub (void)
459
{
460
#if USE_PRECISE_EMULATION
J
j_mayer 已提交
461 462
    do_fmsub();
#else
463 464
    FT0 = float64_mul(FT0, FT1, &env->fp_status);
    FT0 = float64_sub(FT0, FT2, &env->fp_status);
J
j_mayer 已提交
465
#endif
466
    RETURN();
467 468
}

469
/* fnmadd - fnmadd. - fnmadds - fnmadds. */
470
void OPPROTO op_fnmadd (void)
471
{
B
bellard 已提交
472
    do_fnmadd();
473
    RETURN();
474 475
}

476
/* fnmsub - fnmsub. */
477
void OPPROTO op_fnmsub (void)
478
{
B
bellard 已提交
479
    do_fnmsub();
480
    RETURN();
481 482
}

483 484
/***                     Floating-Point round & convert                    ***/
/* frsp - frsp. */
485
void OPPROTO op_frsp (void)
486
{
487
#if USE_PRECISE_EMULATION
488 489
    do_frsp();
#else
490
    FT0 = float64_to_float32(FT0, &env->fp_status);
491
#endif
492
    RETURN();
493 494
}

495
/* fctiw - fctiw. */
496
void OPPROTO op_fctiw (void)
497
{
498 499
    do_fctiw();
    RETURN();
500 501
}

502
/* fctiwz - fctiwz. */
503
void OPPROTO op_fctiwz (void)
504
{
505 506
    do_fctiwz();
    RETURN();
507 508
}

J
j_mayer 已提交
509 510
#if defined(TARGET_PPC64)
/* fcfid - fcfid. */
511
void OPPROTO op_fcfid (void)
J
j_mayer 已提交
512 513 514 515 516 517
{
    do_fcfid();
    RETURN();
}

/* fctid - fctid. */
518
void OPPROTO op_fctid (void)
J
j_mayer 已提交
519 520 521 522 523 524
{
    do_fctid();
    RETURN();
}

/* fctidz - fctidz. */
525
void OPPROTO op_fctidz (void)
J
j_mayer 已提交
526 527 528 529 530 531
{
    do_fctidz();
    RETURN();
}
#endif

532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
void OPPROTO op_frin (void)
{
    do_frin();
    RETURN();
}

void OPPROTO op_friz (void)
{
    do_friz();
    RETURN();
}

void OPPROTO op_frip (void)
{
    do_frip();
    RETURN();
}

void OPPROTO op_frim (void)
{
    do_frim();
    RETURN();
}

556 557
/***                         Floating-point move                           ***/
/* fabs */
558
void OPPROTO op_fabs (void)
B
bellard 已提交
559
{
560
    FT0 = float64_abs(FT0);
B
bellard 已提交
561 562 563
    RETURN();
}

564
/* fnabs */
565
void OPPROTO op_fnabs (void)
B
bellard 已提交
566
{
567 568
    FT0 = float64_abs(FT0);
    FT0 = float64_chs(FT0);
B
bellard 已提交
569 570 571
    RETURN();
}

572
/* fneg */
573
void OPPROTO op_fneg (void)
B
bellard 已提交
574
{
575
    FT0 = float64_chs(FT0);
B
bellard 已提交
576 577 578
    RETURN();
}

579 580
/* Load and store */
#define MEMSUFFIX _raw
581
#include "op_helper.h"
582
#include "op_mem.h"
583
#if !defined(CONFIG_USER_ONLY)
584
#define MEMSUFFIX _user
585
#include "op_helper.h"
586 587
#include "op_mem.h"
#define MEMSUFFIX _kernel
588
#include "op_helper.h"
589
#include "op_mem.h"
590 591 592 593
#define MEMSUFFIX _hypv
#include "op_helper.h"
#include "op_mem.h"
#endif
594

B
bellard 已提交
595
/* Special op to check and maybe clear reservation */
596
void OPPROTO op_check_reservation (void)
B
bellard 已提交
597
{
598
    if ((uint32_t)env->reserve == (uint32_t)(T0 & ~0x00000003))
599
        env->reserve = (target_ulong)-1ULL;
B
bellard 已提交
600 601 602
    RETURN();
}

603 604 605 606
#if defined(TARGET_PPC64)
void OPPROTO op_check_reservation_64 (void)
{
    if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003))
607
        env->reserve = (target_ulong)-1ULL;
608 609 610 611
    RETURN();
}
#endif

612 613 614 615 616 617
void OPPROTO op_wait (void)
{
    env->halted = 1;
    RETURN();
}

618
/* Return from interrupt */
619 620
#if !defined(CONFIG_USER_ONLY)
void OPPROTO op_rfi (void)
621
{
622
    do_rfi();
B
bellard 已提交
623 624
    RETURN();
}
625 626

#if defined(TARGET_PPC64)
J
j_mayer 已提交
627 628 629 630 631
void OPPROTO op_rfid (void)
{
    do_rfid();
    RETURN();
}
632 633 634 635 636 637 638

void OPPROTO op_hrfid (void)
{
    do_hrfid();
    RETURN();
}
#endif
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653

/* Exception vectors */
void OPPROTO op_store_excp_prefix (void)
{
    T0 &= env->ivpr_mask;
    env->excp_prefix = T0;
    RETURN();
}

void OPPROTO op_store_excp_vector (void)
{
    T0 &= env->ivor_mask;
    env->excp_vectors[PARAM1] = T0;
    RETURN();
}
654
#endif
B
bellard 已提交
655

656
/* Trap word */
657
void OPPROTO op_tw (void)
B
bellard 已提交
658
{
659
    do_tw(PARAM1);
B
bellard 已提交
660 661 662
    RETURN();
}

663 664 665 666 667 668 669 670
#if defined(TARGET_PPC64)
void OPPROTO op_td (void)
{
    do_td(PARAM1);
    RETURN();
}
#endif

671
#if !defined(CONFIG_USER_ONLY)
672
/* tlbia */
673
void OPPROTO op_tlbia (void)
B
bellard 已提交
674
{
675
    ppc_tlb_invalidate_all(env);
676 677 678 679
    RETURN();
}

/* tlbie */
680
void OPPROTO op_tlbie (void)
681
{
682
    ppc_tlb_invalidate_one(env, (uint32_t)T0);
B
bellard 已提交
683
    RETURN();
684
}
685 686 687 688

#if defined(TARGET_PPC64)
void OPPROTO op_tlbie_64 (void)
{
689
    ppc_tlb_invalidate_one(env, T0);
690 691 692 693 694 695 696
    RETURN();
}
#endif

#if defined(TARGET_PPC64)
void OPPROTO op_slbia (void)
{
697
    ppc_slb_invalidate_all(env);
698 699 700 701 702
    RETURN();
}

void OPPROTO op_slbie (void)
{
703 704 705 706 707 708 709
    ppc_slb_invalidate_one(env, (uint32_t)T0);
    RETURN();
}

void OPPROTO op_slbie_64 (void)
{
    ppc_slb_invalidate_one(env, T0);
710 711 712
    RETURN();
}
#endif
713
#endif
714

715
#if !defined(CONFIG_USER_ONLY)
716
/* PowerPC 602/603/755 software TLB load instructions */
717 718 719 720 721 722 723 724 725 726 727
void OPPROTO op_6xx_tlbld (void)
{
    do_load_6xx_tlb(0);
    RETURN();
}

void OPPROTO op_6xx_tlbli (void)
{
    do_load_6xx_tlb(1);
    RETURN();
}
728 729 730 731 732 733 734 735 736 737 738 739 740

/* PowerPC 74xx software TLB load instructions */
void OPPROTO op_74xx_tlbld (void)
{
    do_load_74xx_tlb(0);
    RETURN();
}

void OPPROTO op_74xx_tlbli (void)
{
    do_load_74xx_tlb(1);
    RETURN();
}
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768
#endif

/* 601 specific */
void OPPROTO op_load_601_rtcl (void)
{
    T0 = cpu_ppc601_load_rtcl(env);
    RETURN();
}

void OPPROTO op_load_601_rtcu (void)
{
    T0 = cpu_ppc601_load_rtcu(env);
    RETURN();
}

#if !defined(CONFIG_USER_ONLY)
void OPPROTO op_store_601_rtcl (void)
{
    cpu_ppc601_store_rtcl(env, T0);
    RETURN();
}

void OPPROTO op_store_601_rtcu (void)
{
    cpu_ppc601_store_rtcu(env, T0);
    RETURN();
}

769 770 771 772 773 774
void OPPROTO op_store_hid0_601 (void)
{
    do_store_hid0_601();
    RETURN();
}

775 776 777 778 779 780 781 782
void OPPROTO op_load_601_bat (void)
{
    T0 = env->IBAT[PARAM1][PARAM2];
    RETURN();
}

void OPPROTO op_store_601_batl (void)
{
783
    do_store_ibatl_601(env, PARAM1, T0);
784 785 786 787 788
    RETURN();
}

void OPPROTO op_store_601_batu (void)
{
789
    do_store_ibatu_601(env, PARAM1, T0);
790 791 792 793 794 795 796 797
    RETURN();
}
#endif /* !defined(CONFIG_USER_ONLY) */

/* PowerPC 601 specific instructions (POWER bridge) */
/* XXX: those micro-ops need tests ! */
void OPPROTO op_POWER_abs (void)
{
J
j_mayer 已提交
798
    if ((int32_t)T0 == INT32_MIN)
799
        T0 = INT32_MAX;
J
j_mayer 已提交
800
    else if ((int32_t)T0 < 0)
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842
        T0 = -T0;
    RETURN();
}

void OPPROTO op_POWER_abso (void)
{
    do_POWER_abso();
    RETURN();
}

void OPPROTO op_POWER_clcs (void)
{
    do_POWER_clcs();
    RETURN();
}

void OPPROTO op_POWER_div (void)
{
    do_POWER_div();
    RETURN();
}

void OPPROTO op_POWER_divo (void)
{
    do_POWER_divo();
    RETURN();
}

void OPPROTO op_POWER_divs (void)
{
    do_POWER_divs();
    RETURN();
}

void OPPROTO op_POWER_divso (void)
{
    do_POWER_divso();
    RETURN();
}

void OPPROTO op_POWER_doz (void)
{
843
    if ((int32_t)T1 > (int32_t)T0)
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901
        T0 = T1 - T0;
    else
        T0 = 0;
    RETURN();
}

void OPPROTO op_POWER_dozo (void)
{
    do_POWER_dozo();
    RETURN();
}

void OPPROTO op_load_xer_cmp (void)
{
    T2 = xer_cmp;
    RETURN();
}

void OPPROTO op_POWER_maskg (void)
{
    do_POWER_maskg();
    RETURN();
}

void OPPROTO op_POWER_maskir (void)
{
    T0 = (T0 & ~T2) | (T1 & T2);
    RETURN();
}

void OPPROTO op_POWER_mul (void)
{
    uint64_t tmp;

    tmp = (uint64_t)T0 * (uint64_t)T1;
    env->spr[SPR_MQ] = tmp >> 32;
    T0 = tmp;
    RETURN();
}

void OPPROTO op_POWER_mulo (void)
{
    do_POWER_mulo();
    RETURN();
}

void OPPROTO op_POWER_nabs (void)
{
    if (T0 > 0)
        T0 = -T0;
    RETURN();
}

void OPPROTO op_POWER_nabso (void)
{
    /* nabs never overflows */
    if (T0 > 0)
        T0 = -T0;
A
aurel32 已提交
902
    env->xer &= ~(1 << XER_OV);
903 904 905 906 907 908 909
    RETURN();
}

/* XXX: factorise POWER rotates... */
void OPPROTO op_POWER_rlmi (void)
{
    T0 = rotl32(T0, T2) & PARAM1;
910
    T0 |= T1 & (uint32_t)PARAM2;
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942
    RETURN();
}

void OPPROTO op_POWER_rrib (void)
{
    T2 &= 0x1FUL;
    T0 = rotl32(T0 & INT32_MIN, T2);
    T0 |= T1 & ~rotl32(INT32_MIN, T2);
    RETURN();
}

void OPPROTO op_POWER_sle (void)
{
    T1 &= 0x1FUL;
    env->spr[SPR_MQ] = rotl32(T0, T1);
    T0 = T0 << T1;
    RETURN();
}

void OPPROTO op_POWER_sleq (void)
{
    uint32_t tmp = env->spr[SPR_MQ];

    T1 &= 0x1FUL;
    env->spr[SPR_MQ] = rotl32(T0, T1);
    T0 = T0 << T1;
    T0 |= tmp >> (32 - T1);
    RETURN();
}

void OPPROTO op_POWER_sllq (void)
{
943
    uint32_t msk = UINT32_MAX;
944 945 946 947 948 949 950 951 952 953 954 955

    msk = msk << (T1 & 0x1FUL);
    if (T1 & 0x20UL)
        msk = ~msk;
    T1 &= 0x1FUL;
    T0 = (T0 << T1) & msk;
    T0 |= env->spr[SPR_MQ] & ~msk;
    RETURN();
}

void OPPROTO op_POWER_slq (void)
{
956
    uint32_t msk = UINT32_MAX, tmp;
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971

    msk = msk << (T1 & 0x1FUL);
    if (T1 & 0x20UL)
        msk = ~msk;
    T1 &= 0x1FUL;
    tmp = rotl32(T0, T1);
    T0 = tmp & msk;
    env->spr[SPR_MQ] = tmp;
    RETURN();
}

void OPPROTO op_POWER_sraq (void)
{
    env->spr[SPR_MQ] = rotl32(T0, 32 - (T1 & 0x1FUL));
    if (T1 & 0x20UL)
972
        T0 = UINT32_MAX;
973
    else
974
        T0 = (int32_t)T0 >> T1;
975 976 977 978 979 980 981
    RETURN();
}

void OPPROTO op_POWER_sre (void)
{
    T1 &= 0x1FUL;
    env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
982
    T0 = (int32_t)T0 >> T1;
983 984 985 986 987 988 989
    RETURN();
}

void OPPROTO op_POWER_srea (void)
{
    T1 &= 0x1FUL;
    env->spr[SPR_MQ] = T0 >> T1;
990
    T0 = (int32_t)T0 >> T1;
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115
    RETURN();
}

void OPPROTO op_POWER_sreq (void)
{
    uint32_t tmp;
    int32_t msk;

    T1 &= 0x1FUL;
    msk = INT32_MIN >> T1;
    tmp = env->spr[SPR_MQ];
    env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
    T0 = T0 >> T1;
    T0 |= tmp & msk;
    RETURN();
}

void OPPROTO op_POWER_srlq (void)
{
    uint32_t tmp;
    int32_t msk;

    msk = INT32_MIN >> (T1 & 0x1FUL);
    if (T1 & 0x20UL)
        msk = ~msk;
    T1 &= 0x1FUL;
    tmp = env->spr[SPR_MQ];
    env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
    T0 = T0 >> T1;
    T0 &= msk;
    T0 |= tmp & ~msk;
    RETURN();
}

void OPPROTO op_POWER_srq (void)
{
    T1 &= 0x1FUL;
    env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
    T0 = T0 >> T1;
    RETURN();
}

/* POWER instructions not implemented in PowerPC 601 */
#if !defined(CONFIG_USER_ONLY)
void OPPROTO op_POWER_mfsri (void)
{
    T1 = T0 >> 28;
    T0 = env->sr[T1];
    RETURN();
}

void OPPROTO op_POWER_rac (void)
{
    do_POWER_rac();
    RETURN();
}

void OPPROTO op_POWER_rfsvc (void)
{
    do_POWER_rfsvc();
    RETURN();
}
#endif

/* PowerPC 602 specific instruction */
#if !defined(CONFIG_USER_ONLY)
void OPPROTO op_602_mfrom (void)
{
    do_op_602_mfrom();
    RETURN();
}
#endif

/* PowerPC 4xx specific micro-ops */
void OPPROTO op_405_add_T0_T2 (void)
{
    T0 = (int32_t)T0 + (int32_t)T2;
    RETURN();
}

void OPPROTO op_405_mulchw (void)
{
    T0 = ((int16_t)T0) * ((int16_t)(T1 >> 16));
    RETURN();
}

void OPPROTO op_405_mulchwu (void)
{
    T0 = ((uint16_t)T0) * ((uint16_t)(T1 >> 16));
    RETURN();
}

void OPPROTO op_405_mulhhw (void)
{
    T0 = ((int16_t)(T0 >> 16)) * ((int16_t)(T1 >> 16));
    RETURN();
}

void OPPROTO op_405_mulhhwu (void)
{
    T0 = ((uint16_t)(T0 >> 16)) * ((uint16_t)(T1 >> 16));
    RETURN();
}

void OPPROTO op_405_mullhw (void)
{
    T0 = ((int16_t)T0) * ((int16_t)T1);
    RETURN();
}

void OPPROTO op_405_mullhwu (void)
{
    T0 = ((uint16_t)T0) * ((uint16_t)T1);
    RETURN();
}

void OPPROTO op_405_check_sat (void)
{
    do_405_check_sat();
    RETURN();
}

void OPPROTO op_405_check_ovu (void)
{
    if (likely(T0 >= T2)) {
A
aurel32 已提交
1116
        env->xer &= ~(1 << XER_OV);
1117
    } else {
A
aurel32 已提交
1118
        env->xer |= (1 << XER_OV) | (1 << XER_SO);
1119 1120 1121 1122 1123 1124 1125 1126
    }
    RETURN();
}

void OPPROTO op_405_check_satu (void)
{
    if (unlikely(T0 < T2)) {
        /* Saturate result */
1127
        T0 = UINT32_MAX;
1128 1129 1130 1131
    }
    RETURN();
}

1132
void OPPROTO op_load_dcr (void)
1133
{
1134
    do_load_dcr();
1135 1136 1137
    RETURN();
}

1138
void OPPROTO op_store_dcr (void)
1139
{
1140
    do_store_dcr();
1141 1142 1143
    RETURN();
}

1144
#if !defined(CONFIG_USER_ONLY)
1145 1146 1147
/* Return from critical interrupt :
 * same as rfi, except nip & MSR are loaded from SRR2/3 instead of SRR0/1
 */
1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166
void OPPROTO op_40x_rfci (void)
{
    do_40x_rfci();
    RETURN();
}

void OPPROTO op_rfci (void)
{
    do_rfci();
    RETURN();
}

void OPPROTO op_rfdi (void)
{
    do_rfdi();
    RETURN();
}

void OPPROTO op_rfmci (void)
1167
{
1168
    do_rfmci();
1169 1170 1171
    RETURN();
}

1172
void OPPROTO op_wrte (void)
1173
{
1174 1175 1176 1177 1178 1179
    /* We don't call do_store_msr here as we won't trigger
     * any special case nor change hflags
     */
    T0 &= 1 << MSR_EE;
    env->msr &= ~(1 << MSR_EE);
    env->msr |= T0;
1180 1181 1182
    RETURN();
}

1183
void OPPROTO op_440_tlbre (void)
1184
{
1185
    do_440_tlbre(PARAM1);
1186 1187 1188
    RETURN();
}

1189
void OPPROTO op_440_tlbsx (void)
1190
{
1191
    T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_440_MMUCR] & 0xFF);
1192 1193 1194
    RETURN();
}

1195
void OPPROTO op_4xx_tlbsx_check (void)
1196
{
1197 1198 1199
    int tmp;

    tmp = xer_so;
1200
    if ((int)T0 != -1)
1201 1202
        tmp |= 0x02;
    env->crf[0] = tmp;
1203 1204 1205
    RETURN();
}

1206
void OPPROTO op_440_tlbwe (void)
1207
{
1208
    do_440_tlbwe(PARAM1);
1209 1210 1211
    RETURN();
}

1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
void OPPROTO op_4xx_tlbre_lo (void)
{
    do_4xx_tlbre_lo();
    RETURN();
}

void OPPROTO op_4xx_tlbre_hi (void)
{
    do_4xx_tlbre_hi();
    RETURN();
}

void OPPROTO op_4xx_tlbsx (void)
{
1226
    T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_40x_PID]);
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263
    RETURN();
}

void OPPROTO op_4xx_tlbwe_lo (void)
{
    do_4xx_tlbwe_lo();
    RETURN();
}

void OPPROTO op_4xx_tlbwe_hi (void)
{
    do_4xx_tlbwe_hi();
    RETURN();
}
#endif

/* SPR micro-ops */
/* 440 specific */
void OPPROTO op_440_dlmzb (void)
{
    do_440_dlmzb();
    RETURN();
}

void OPPROTO op_440_dlmzb_update_Rc (void)
{
    if (T0 == 8)
        T0 = 0x2;
    else if (T0 < 4)
        T0 = 0x4;
    else
        T0 = 0x8;
    RETURN();
}

#if !defined(CONFIG_USER_ONLY)
void OPPROTO op_store_pir (void)
1264 1265 1266 1267
{
    env->spr[SPR_PIR] = T0 & 0x0000000FUL;
    RETURN();
}
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292

void OPPROTO op_load_403_pb (void)
{
    do_load_403_pb(PARAM1);
    RETURN();
}

void OPPROTO op_store_403_pb (void)
{
    do_store_403_pb(PARAM1);
    RETURN();
}

void OPPROTO op_load_40x_pit (void)
{
    T0 = load_40x_pit(env);
    RETURN();
}

void OPPROTO op_store_40x_pit (void)
{
    store_40x_pit(env, T0);
    RETURN();
}

1293 1294 1295
void OPPROTO op_store_40x_dbcr0 (void)
{
    store_40x_dbcr0(env, T0);
1296
    RETURN();
1297 1298
}

1299 1300 1301 1302 1303 1304
void OPPROTO op_store_40x_sler (void)
{
    store_40x_sler(env, T0);
    RETURN();
}

1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316
void OPPROTO op_store_booke_tcr (void)
{
    store_booke_tcr(env, T0);
    RETURN();
}

void OPPROTO op_store_booke_tsr (void)
{
    store_booke_tsr(env, T0);
    RETURN();
}
#endif /* !defined(CONFIG_USER_ONLY) */
1317 1318 1319 1320 1321

/* SPE extension */
void OPPROTO op_splatw_T1_64 (void)
{
    T1_64 = (T1_64 << 32) | (T1_64 & 0x00000000FFFFFFFFULL);
J
j_mayer 已提交
1322
    RETURN();
1323 1324 1325 1326 1327 1328 1329
}

void OPPROTO op_splatwi_T0_64 (void)
{
    uint64_t tmp = PARAM1;

    T0_64 = (tmp << 32) | tmp;
J
j_mayer 已提交
1330
    RETURN();
1331 1332 1333 1334 1335 1336 1337
}

void OPPROTO op_splatwi_T1_64 (void)
{
    uint64_t tmp = PARAM1;

    T1_64 = (tmp << 32) | tmp;
J
j_mayer 已提交
1338
    RETURN();
1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794
}

void OPPROTO op_extsh_T1_64 (void)
{
    T1_64 = (int32_t)((int16_t)T1_64);
    RETURN();
}

void OPPROTO op_sli16_T1_64 (void)
{
    T1_64 = T1_64 << 16;
    RETURN();
}

void OPPROTO op_sli32_T1_64 (void)
{
    T1_64 = T1_64 << 32;
    RETURN();
}

void OPPROTO op_srli32_T1_64 (void)
{
    T1_64 = T1_64 >> 32;
    RETURN();
}

void OPPROTO op_evsel (void)
{
    do_evsel();
    RETURN();
}

void OPPROTO op_evaddw (void)
{
    do_evaddw();
    RETURN();
}

void OPPROTO op_evsubfw (void)
{
    do_evsubfw();
    RETURN();
}

void OPPROTO op_evneg (void)
{
    do_evneg();
    RETURN();
}

void OPPROTO op_evabs (void)
{
    do_evabs();
    RETURN();
}

void OPPROTO op_evextsh (void)
{
    T0_64 = ((uint64_t)((int32_t)(int16_t)(T0_64 >> 32)) << 32) |
        (uint64_t)((int32_t)(int16_t)T0_64);
    RETURN();
}

void OPPROTO op_evextsb (void)
{
    T0_64 = ((uint64_t)((int32_t)(int8_t)(T0_64 >> 32)) << 32) |
        (uint64_t)((int32_t)(int8_t)T0_64);
    RETURN();
}

void OPPROTO op_evcntlzw (void)
{
    do_evcntlzw();
    RETURN();
}

void OPPROTO op_evrndw (void)
{
    do_evrndw();
    RETURN();
}

void OPPROTO op_brinc (void)
{
    do_brinc();
    RETURN();
}

void OPPROTO op_evcntlsw (void)
{
    do_evcntlsw();
    RETURN();
}

void OPPROTO op_evsrws (void)
{
    do_evsrws();
    RETURN();
}

void OPPROTO op_evsrwu (void)
{
    do_evsrwu();
    RETURN();
}

void OPPROTO op_evslw (void)
{
    do_evslw();
    RETURN();
}

void OPPROTO op_evrlw (void)
{
    do_evrlw();
    RETURN();
}

void OPPROTO op_evmergelo (void)
{
    T0_64 = (T0_64 << 32) | (T1_64 & 0x00000000FFFFFFFFULL);
    RETURN();
}

void OPPROTO op_evmergehi (void)
{
    T0_64 = (T0_64 & 0xFFFFFFFF00000000ULL) | (T1_64 >> 32);
    RETURN();
}

void OPPROTO op_evmergelohi (void)
{
    T0_64 = (T0_64 << 32) | (T1_64 >> 32);
    RETURN();
}

void OPPROTO op_evmergehilo (void)
{
    T0_64 = (T0_64 & 0xFFFFFFFF00000000ULL) | (T1_64 & 0x00000000FFFFFFFFULL);
    RETURN();
}

void OPPROTO op_evcmpgts (void)
{
    do_evcmpgts();
    RETURN();
}

void OPPROTO op_evcmpgtu (void)
{
    do_evcmpgtu();
    RETURN();
}

void OPPROTO op_evcmplts (void)
{
    do_evcmplts();
    RETURN();
}

void OPPROTO op_evcmpltu (void)
{
    do_evcmpltu();
    RETURN();
}

void OPPROTO op_evcmpeq (void)
{
    do_evcmpeq();
    RETURN();
}

void OPPROTO op_evfssub (void)
{
    do_evfssub();
    RETURN();
}

void OPPROTO op_evfsadd (void)
{
    do_evfsadd();
    RETURN();
}

void OPPROTO op_evfsnabs (void)
{
    do_evfsnabs();
    RETURN();
}

void OPPROTO op_evfsabs (void)
{
    do_evfsabs();
    RETURN();
}

void OPPROTO op_evfsneg (void)
{
    do_evfsneg();
    RETURN();
}

void OPPROTO op_evfsdiv (void)
{
    do_evfsdiv();
    RETURN();
}

void OPPROTO op_evfsmul (void)
{
    do_evfsmul();
    RETURN();
}

void OPPROTO op_evfscmplt (void)
{
    do_evfscmplt();
    RETURN();
}

void OPPROTO op_evfscmpgt (void)
{
    do_evfscmpgt();
    RETURN();
}

void OPPROTO op_evfscmpeq (void)
{
    do_evfscmpeq();
    RETURN();
}

void OPPROTO op_evfscfsi (void)
{
    do_evfscfsi();
    RETURN();
}

void OPPROTO op_evfscfui (void)
{
    do_evfscfui();
    RETURN();
}

void OPPROTO op_evfscfsf (void)
{
    do_evfscfsf();
    RETURN();
}

void OPPROTO op_evfscfuf (void)
{
    do_evfscfuf();
    RETURN();
}

void OPPROTO op_evfsctsi (void)
{
    do_evfsctsi();
    RETURN();
}

void OPPROTO op_evfsctui (void)
{
    do_evfsctui();
    RETURN();
}

void OPPROTO op_evfsctsf (void)
{
    do_evfsctsf();
    RETURN();
}

void OPPROTO op_evfsctuf (void)
{
    do_evfsctuf();
    RETURN();
}

void OPPROTO op_evfsctuiz (void)
{
    do_evfsctuiz();
    RETURN();
}

void OPPROTO op_evfsctsiz (void)
{
    do_evfsctsiz();
    RETURN();
}

void OPPROTO op_evfststlt (void)
{
    do_evfststlt();
    RETURN();
}

void OPPROTO op_evfststgt (void)
{
    do_evfststgt();
    RETURN();
}

void OPPROTO op_evfststeq (void)
{
    do_evfststeq();
    RETURN();
}

void OPPROTO op_efssub (void)
{
    T0_64 = _do_efssub(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efsadd (void)
{
    T0_64 = _do_efsadd(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efsnabs (void)
{
    T0_64 = _do_efsnabs(T0_64);
    RETURN();
}

void OPPROTO op_efsabs (void)
{
    T0_64 = _do_efsabs(T0_64);
    RETURN();
}

void OPPROTO op_efsneg (void)
{
    T0_64 = _do_efsneg(T0_64);
    RETURN();
}

void OPPROTO op_efsdiv (void)
{
    T0_64 = _do_efsdiv(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efsmul (void)
{
    T0_64 = _do_efsmul(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efscmplt (void)
{
    do_efscmplt();
    RETURN();
}

void OPPROTO op_efscmpgt (void)
{
    do_efscmpgt();
    RETURN();
}

void OPPROTO op_efscfd (void)
{
    do_efscfd();
    RETURN();
}

void OPPROTO op_efscmpeq (void)
{
    do_efscmpeq();
    RETURN();
}

void OPPROTO op_efscfsi (void)
{
    do_efscfsi();
    RETURN();
}

void OPPROTO op_efscfui (void)
{
    do_efscfui();
    RETURN();
}

void OPPROTO op_efscfsf (void)
{
    do_efscfsf();
    RETURN();
}

void OPPROTO op_efscfuf (void)
{
    do_efscfuf();
    RETURN();
}

void OPPROTO op_efsctsi (void)
{
    do_efsctsi();
    RETURN();
}

void OPPROTO op_efsctui (void)
{
    do_efsctui();
    RETURN();
}

void OPPROTO op_efsctsf (void)
{
    do_efsctsf();
    RETURN();
}

void OPPROTO op_efsctuf (void)
{
    do_efsctuf();
    RETURN();
}

void OPPROTO op_efsctsiz (void)
{
    do_efsctsiz();
    RETURN();
}

void OPPROTO op_efsctuiz (void)
{
    do_efsctuiz();
    RETURN();
}

void OPPROTO op_efststlt (void)
{
    T0 = _do_efststlt(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efststgt (void)
{
    T0 = _do_efststgt(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efststeq (void)
{
    T0 = _do_efststeq(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efdsub (void)
{
A
aurel32 已提交
1795 1796 1797 1798 1799
    CPU_DoubleU u1, u2;
    u1.ll = T0_64;
    u2.ll = T1_64;
    u1.d = float64_sub(u1.d, u2.d, &env->spe_status);
    T0_64 = u1.ll;
1800 1801 1802 1803 1804
    RETURN();
}

void OPPROTO op_efdadd (void)
{
A
aurel32 已提交
1805 1806 1807 1808 1809
    CPU_DoubleU u1, u2;
    u1.ll = T0_64;
    u2.ll = T1_64;
    u1.d = float64_add(u1.d, u2.d, &env->spe_status);
    T0_64 = u1.ll;
1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844
    RETURN();
}

void OPPROTO op_efdcfsid (void)
{
    do_efdcfsi();
    RETURN();
}

void OPPROTO op_efdcfuid (void)
{
    do_efdcfui();
    RETURN();
}

void OPPROTO op_efdnabs (void)
{
    T0_64 |= 0x8000000000000000ULL;
    RETURN();
}

void OPPROTO op_efdabs (void)
{
    T0_64 &= ~0x8000000000000000ULL;
    RETURN();
}

void OPPROTO op_efdneg (void)
{
    T0_64 ^= 0x8000000000000000ULL;
    RETURN();
}

void OPPROTO op_efddiv (void)
{
A
aurel32 已提交
1845 1846 1847 1848 1849
    CPU_DoubleU u1, u2;
    u1.ll = T0_64;
    u2.ll = T1_64;
    u1.d = float64_div(u1.d, u2.d, &env->spe_status);
    T0_64 = u1.ll;
1850 1851 1852 1853 1854
    RETURN();
}

void OPPROTO op_efdmul (void)
{
A
aurel32 已提交
1855 1856 1857 1858 1859
    CPU_DoubleU u1, u2;
    u1.ll = T0_64;
    u2.ll = T1_64;
    u1.d = float64_mul(u1.d, u2.d, &env->spe_status);
    T0_64 = u1.ll;
1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975
    RETURN();
}

void OPPROTO op_efdctsidz (void)
{
    do_efdctsiz();
    RETURN();
}

void OPPROTO op_efdctuidz (void)
{
    do_efdctuiz();
    RETURN();
}

void OPPROTO op_efdcmplt (void)
{
    do_efdcmplt();
    RETURN();
}

void OPPROTO op_efdcmpgt (void)
{
    do_efdcmpgt();
    RETURN();
}

void OPPROTO op_efdcfs (void)
{
    do_efdcfs();
    RETURN();
}

void OPPROTO op_efdcmpeq (void)
{
    do_efdcmpeq();
    RETURN();
}

void OPPROTO op_efdcfsi (void)
{
    do_efdcfsi();
    RETURN();
}

void OPPROTO op_efdcfui (void)
{
    do_efdcfui();
    RETURN();
}

void OPPROTO op_efdcfsf (void)
{
    do_efdcfsf();
    RETURN();
}

void OPPROTO op_efdcfuf (void)
{
    do_efdcfuf();
    RETURN();
}

void OPPROTO op_efdctsi (void)
{
    do_efdctsi();
    RETURN();
}

void OPPROTO op_efdctui (void)
{
    do_efdctui();
    RETURN();
}

void OPPROTO op_efdctsf (void)
{
    do_efdctsf();
    RETURN();
}

void OPPROTO op_efdctuf (void)
{
    do_efdctuf();
    RETURN();
}

void OPPROTO op_efdctuiz (void)
{
    do_efdctuiz();
    RETURN();
}

void OPPROTO op_efdctsiz (void)
{
    do_efdctsiz();
    RETURN();
}

void OPPROTO op_efdtstlt (void)
{
    T0 = _do_efdtstlt(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efdtstgt (void)
{
    T0 = _do_efdtstgt(T0_64, T1_64);
    RETURN();
}

void OPPROTO op_efdtsteq (void)
{
    T0 = _do_efdtsteq(T0_64, T1_64);
    RETURN();
}