Revision 91493631

b/tcg/hppa/tcg-target.c
210 210
    case 'J':
211 211
        ct->ct |= TCG_CT_CONST_S5;
212 212
	break;
213
    case 'K':
214
        ct->ct |= TCG_CT_CONST_MS11;
215
        break;
213 216
    default:
214 217
        return -1;
215 218
    }
......
231 234
        return check_fit_tl(val, 5);
232 235
    } else if (ct & TCG_CT_CONST_S11) {
233 236
        return check_fit_tl(val, 11);
237
    } else if (ct & TCG_CT_CONST_MS11) {
238
        return check_fit_tl(-val, 11);
234 239
    }
235 240
    return 0;
236 241
}
......
675 680
    }
676 681
}
677 682

  
683
static void tcg_out_add2(TCGContext *s, int destl, int desth,
684
                         int al, int ah, int bl, int bh, int blconst)
685
{
686
    int tmp = (destl == ah || destl == bh ? TCG_REG_R20 : destl);
687

  
688
    if (blconst) {
689
        tcg_out_arithi(s, tmp, al, bl, INSN_ADDI);
690
    } else {
691
        tcg_out_arith(s, tmp, al, bl, INSN_ADD);
692
    }
693
    tcg_out_arith(s, desth, ah, bh, INSN_ADDC);
694

  
695
    tcg_out_mov(s, destl, tmp);
696
}
697

  
698
static void tcg_out_sub2(TCGContext *s, int destl, int desth, int al, int ah,
699
                         int bl, int bh, int alconst, int blconst)
700
{
701
    int tmp = (destl == ah || destl == bh ? TCG_REG_R20 : destl);
702

  
703
    if (alconst) {
704
        if (blconst) {
705
            tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_R20, bl);
706
            bl = TCG_REG_R20;
707
        }
708
        tcg_out_arithi(s, tmp, bl, al, INSN_SUBI);
709
    } else if (blconst) {
710
        tcg_out_arithi(s, tmp, al, -bl, INSN_ADDI);
711
    } else {
712
        tcg_out_arith(s, tmp, al, bl, INSN_SUB);
713
    }
714
    tcg_out_arith(s, desth, ah, bh, INSN_SUBB);
715

  
716
    tcg_out_mov(s, destl, tmp);
717
}
718

  
678 719
static void tcg_out_branch(TCGContext *s, int label_index, int nul)
679 720
{
680 721
    TCGLabel *l = &s->labels[label_index];
......
1427 1468
        break;
1428 1469

  
1429 1470
    case INDEX_op_add2_i32:
1430
        if (const_args[4]) {
1431
            tcg_out_arithi(s, args[0], args[2], args[4], INSN_ADDI);
1432
        } else {
1433
            tcg_out_arith(s, args[0], args[2], args[4], INSN_ADD);
1434
        }
1435
        tcg_out_arith(s, args[1], args[3], args[5], INSN_ADDC);
1471
        tcg_out_add2(s, args[0], args[1], args[2], args[3],
1472
                     args[4], args[5], const_args[4]);
1436 1473
        break;
1437 1474

  
1438 1475
    case INDEX_op_sub2_i32:
1439
        if (const_args[2]) {
1440
            /* Recall that SUBI is a reversed subtract.  */
1441
            tcg_out_arithi(s, args[0], args[4], args[2], INSN_SUBI);
1442
        } else {
1443
            tcg_out_arith(s, args[0], args[2], args[4], INSN_SUB);
1444
        }
1445
        tcg_out_arith(s, args[1], args[3], args[5], INSN_SUBB);
1476
        tcg_out_sub2(s, args[0], args[1], args[2], args[3],
1477
                     args[4], args[5], const_args[2], const_args[4]);
1446 1478
        break;
1447 1479

  
1448 1480
    case INDEX_op_qemu_ld8u:
......
1536 1568
    { INDEX_op_setcond2_i32, { "r", "rZ", "rZ", "rI", "rI" } },
1537 1569

  
1538 1570
    { INDEX_op_add2_i32, { "r", "r", "rZ", "rZ", "rI", "rZ" } },
1539
    { INDEX_op_sub2_i32, { "r", "r", "rI", "rZ", "rZ", "rZ" } },
1571
    { INDEX_op_sub2_i32, { "r", "r", "rI", "rZ", "rK", "rZ" } },
1540 1572

  
1541 1573
#if TARGET_LONG_BITS == 32
1542 1574
    { INDEX_op_qemu_ld8u, { "r", "L" } },
b/tcg/hppa/tcg-target.h
72 72
#define TCG_CT_CONST_0    0x0100
73 73
#define TCG_CT_CONST_S5   0x0200
74 74
#define TCG_CT_CONST_S11  0x0400
75
#define TCG_CT_CONST_MS11 0x0800
75 76

  
76 77
/* used for function call generation */
77 78
#define TCG_REG_CALL_STACK TCG_REG_SP

Also available in: Unified diff