Revision 6d8ff4d8

b/tcg/mips/tcg-target.c
342 342
}
343 343

  
344 344
/*
345
 * Type branch
346
 */
347
static inline void tcg_out_opc_br(TCGContext *s, int opc, int rt, int rs)
348
{
349
    /* We need to keep the offset unchanged for retranslation */
350
    uint16_t offset = (uint16_t)(*(uint32_t *) &s->code_ptr);
351

  
352
    tcg_out_opc_imm(s, opc, rt, rs, offset);
353
}
354

  
355
/*
345 356
 * Type sa
346 357
 */
347 358
static inline void tcg_out_opc_sa(TCGContext *s, int opc, int rd, int rt, int sa)
......
471 482

  
472 483
    switch (cond) {
473 484
    case TCG_COND_EQ:
474
        tcg_out_opc_imm(s, OPC_BEQ, arg1, arg2, 0);
485
        tcg_out_opc_br(s, OPC_BEQ, arg1, arg2);
475 486
        break;
476 487
    case TCG_COND_NE:
477
        tcg_out_opc_imm(s, OPC_BNE, arg1, arg2, 0);
488
        tcg_out_opc_br(s, OPC_BNE, arg1, arg2);
478 489
        break;
479 490
    case TCG_COND_LT:
480 491
        tcg_out_opc_reg(s, OPC_SLT, TCG_REG_AT, arg1, arg2);
481
        tcg_out_opc_imm(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO, 0);
492
        tcg_out_opc_br(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO);
482 493
        break;
483 494
    case TCG_COND_LTU:
484 495
        tcg_out_opc_reg(s, OPC_SLTU, TCG_REG_AT, arg1, arg2);
485
        tcg_out_opc_imm(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO, 0);
496
        tcg_out_opc_br(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO);
486 497
        break;
487 498
    case TCG_COND_GE:
488 499
        tcg_out_opc_reg(s, OPC_SLT, TCG_REG_AT, arg1, arg2);
489
        tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO, 0);
500
        tcg_out_opc_br(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO);
490 501
        break;
491 502
    case TCG_COND_GEU:
492 503
        tcg_out_opc_reg(s, OPC_SLTU, TCG_REG_AT, arg1, arg2);
493
        tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO, 0);
504
        tcg_out_opc_br(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO);
494 505
        break;
495 506
    case TCG_COND_LE:
496 507
        tcg_out_opc_reg(s, OPC_SLT, TCG_REG_AT, arg2, arg1);
497
        tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO, 0);
508
        tcg_out_opc_br(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO);
498 509
        break;
499 510
    case TCG_COND_LEU:
500 511
        tcg_out_opc_reg(s, OPC_SLTU, TCG_REG_AT, arg2, arg1);
501
        tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO, 0);
512
        tcg_out_opc_br(s, OPC_BEQ, TCG_REG_AT, TCG_REG_ZERO);
502 513
        break;
503 514
    case TCG_COND_GT:
504 515
        tcg_out_opc_reg(s, OPC_SLT, TCG_REG_AT, arg2, arg1);
505
        tcg_out_opc_imm(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO, 0);
516
        tcg_out_opc_br(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO);
506 517
        break;
507 518
    case TCG_COND_GTU:
508 519
        tcg_out_opc_reg(s, OPC_SLTU, TCG_REG_AT, arg2, arg1);
509
        tcg_out_opc_imm(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO, 0);
520
        tcg_out_opc_br(s, OPC_BNE, TCG_REG_AT, TCG_REG_ZERO);
510 521
        break;
511 522
    default:
512 523
        tcg_abort();
......
555 566
    }
556 567

  
557 568
    label_ptr = s->code_ptr;
558
    tcg_out_opc_imm(s, OPC_BNE, arg2, arg4, 0);
569
    tcg_out_opc_br(s, OPC_BNE, arg2, arg4);
559 570
    tcg_out_nop(s);
560 571

  
561 572
    switch(cond) {
......
794 805

  
795 806
# if TARGET_LONG_BITS == 64
796 807
    label3_ptr = s->code_ptr;
797
    tcg_out_opc_imm(s, OPC_BNE, TCG_REG_T0, TCG_REG_AT, 0);
808
    tcg_out_opc_br(s, OPC_BNE, TCG_REG_T0, TCG_REG_AT);
798 809
    tcg_out_nop(s);
799 810

  
800 811
    tcg_out_opc_imm(s, OPC_LW, TCG_REG_AT, TCG_REG_A0,
801 812
                    offsetof(CPUState, tlb_table[mem_index][0].addr_read) + addr_memh);
802 813

  
803 814
    label1_ptr = s->code_ptr;
804
    tcg_out_opc_imm(s, OPC_BEQ, addr_regh, TCG_REG_AT, 0);
815
    tcg_out_opc_br(s, OPC_BEQ, addr_regh, TCG_REG_AT);
805 816
    tcg_out_nop(s);
806 817

  
807 818
    reloc_pc16(label3_ptr, (tcg_target_long) s->code_ptr);
808 819
# else
809 820
    label1_ptr = s->code_ptr;
810
    tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_T0, TCG_REG_AT, 0);
821
    tcg_out_opc_br(s, OPC_BEQ, TCG_REG_T0, TCG_REG_AT);
811 822
    tcg_out_nop(s);
812 823
# endif
813 824

  
......
849 860
    }
850 861

  
851 862
    label2_ptr = s->code_ptr;
852
    tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_ZERO, TCG_REG_ZERO, 0);
863
    tcg_out_opc_br(s, OPC_BEQ, TCG_REG_ZERO, TCG_REG_ZERO);
853 864
    tcg_out_nop(s);
854 865

  
855 866
    /* label1: fast path */
......
982 993

  
983 994
# if TARGET_LONG_BITS == 64
984 995
    label3_ptr = s->code_ptr;
985
    tcg_out_opc_imm(s, OPC_BNE, TCG_REG_T0, TCG_REG_AT, 0);
996
    tcg_out_opc_br(s, OPC_BNE, TCG_REG_T0, TCG_REG_AT);
986 997
    tcg_out_nop(s);
987 998

  
988 999
    tcg_out_opc_imm(s, OPC_LW, TCG_REG_AT, TCG_REG_A0,
989 1000
                    offsetof(CPUState, tlb_table[mem_index][0].addr_write) + addr_memh);
990 1001

  
991 1002
    label1_ptr = s->code_ptr;
992
    tcg_out_opc_imm(s, OPC_BEQ, addr_regh, TCG_REG_AT, 0);
1003
    tcg_out_opc_br(s, OPC_BEQ, addr_regh, TCG_REG_AT);
993 1004
    tcg_out_nop(s);
994 1005

  
995 1006
    reloc_pc16(label3_ptr, (tcg_target_long) s->code_ptr);
996 1007
# else
997 1008
    label1_ptr = s->code_ptr;
998
    tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_T0, TCG_REG_AT, 0);
1009
    tcg_out_opc_br(s, OPC_BEQ, TCG_REG_T0, TCG_REG_AT);
999 1010
    tcg_out_nop(s);
1000 1011
# endif
1001 1012

  
......
1036 1047
    tcg_out_nop(s);
1037 1048

  
1038 1049
    label2_ptr = s->code_ptr;
1039
    tcg_out_opc_imm(s, OPC_BEQ, TCG_REG_ZERO, TCG_REG_ZERO, 0);
1050
    tcg_out_opc_br(s, OPC_BEQ, TCG_REG_ZERO, TCG_REG_ZERO);
1040 1051
    tcg_out_nop(s);
1041 1052

  
1042 1053
    /* label1: fast path */

Also available in: Unified diff