Revision 8f9db67c

b/tcg/x86_64/tcg-target.c
499 499
    }
500 500
}
501 501

  
502
static void tcg_out_brcond(TCGContext *s, int cond, 
503
                           TCGArg arg1, TCGArg arg2, int const_arg2,
504
                           int label_index, int rexw)
502
static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2,
503
                        int const_arg2, int rexw)
505 504
{
506 505
    if (const_arg2) {
507 506
        if (arg2 == 0) {
508 507
            /* test r, r */
509 508
            tcg_out_modrm(s, 0x85 | rexw, arg1, arg1);
510 509
        } else {
511
            if (rexw)
510
            if (rexw) {
512 511
                tgen_arithi64(s, ARITH_CMP, arg1, arg2);
513
            else
512
            } else {
514 513
                tgen_arithi32(s, ARITH_CMP, arg1, arg2);
514
            }
515 515
        }
516 516
    } else {
517 517
        tcg_out_modrm(s, 0x01 | (ARITH_CMP << 3) | rexw, arg2, arg1);
518 518
    }
519
}
520

  
521
static void tcg_out_brcond(TCGContext *s, int cond,
522
                           TCGArg arg1, TCGArg arg2, int const_arg2,
523
                           int label_index, int rexw)
524
{
525
    tcg_out_cmp(s, arg1, arg2, const_arg2, rexw);
519 526
    tcg_out_jxx(s, tcg_cond_to_jcc[cond], label_index);
520 527
}
521 528

  
529
static void tcg_out_setcond(TCGContext *s, int cond, TCGArg dest,
530
                            TCGArg arg1, TCGArg arg2, int const_arg2, int rexw)
531
{
532
    tcg_out_cmp(s, arg1, arg2, const_arg2, rexw);
533
    /* setcc */
534
    tcg_out_modrm(s, 0x90 | tcg_cond_to_jcc[cond] | P_EXT | P_REXB_RM, 0, dest);
535
    tgen_arithi32(s, ARITH_AND, dest, 0xff);
536
}
537

  
522 538
#if defined(CONFIG_SOFTMMU)
523 539

  
524 540
#include "../../softmmu_defs.h"
......
1201 1217
        tcg_out_modrm(s, 0x8b, args[0], args[1]);
1202 1218
        break;
1203 1219

  
1220
    case INDEX_op_setcond_i32:
1221
        tcg_out_setcond(s, args[3], args[0], args[1], args[2],
1222
                        const_args[2], 0);
1223
        break;
1224
    case INDEX_op_setcond_i64:
1225
        tcg_out_setcond(s, args[3], args[0], args[1], args[2],
1226
                        const_args[2], P_REXW);
1227
        break;
1228

  
1204 1229
    case INDEX_op_qemu_ld8u:
1205 1230
        tcg_out_qemu_ld(s, args, 0);
1206 1231
        break;
......
1380 1405
    { INDEX_op_ext16u_i64, { "r", "r"} },
1381 1406
    { INDEX_op_ext32u_i64, { "r", "r"} },
1382 1407

  
1408
    { INDEX_op_setcond_i32, { "r", "r", "ri" } },
1409
    { INDEX_op_setcond_i64, { "r", "r", "re" } },
1410

  
1383 1411
    { INDEX_op_qemu_ld8u, { "r", "L" } },
1384 1412
    { INDEX_op_qemu_ld8s, { "r", "L" } },
1385 1413
    { INDEX_op_qemu_ld16u, { "r", "L" } },

Also available in: Unified diff