Revision 6191b059 target-i386/translate.c
b/target-i386/translate.c | ||
---|---|---|
498 | 498 |
#endif |
499 | 499 |
}; |
500 | 500 |
|
501 |
static GenOpFunc *gen_op_bsx_T0_cc[3][2] = { |
|
502 |
[0] = { |
|
503 |
gen_op_bsfw_T0_cc, |
|
504 |
gen_op_bsrw_T0_cc, |
|
505 |
}, |
|
506 |
[1] = { |
|
507 |
gen_op_bsfl_T0_cc, |
|
508 |
gen_op_bsrl_T0_cc, |
|
509 |
}, |
|
510 |
#ifdef TARGET_X86_64 |
|
511 |
[2] = { |
|
512 |
gen_op_bsfq_T0_cc, |
|
513 |
gen_op_bsrq_T0_cc, |
|
514 |
}, |
|
515 |
#endif |
|
516 |
}; |
|
517 |
|
|
518 | 501 |
static inline void gen_op_lds_T0_A0(int idx) |
519 | 502 |
{ |
520 | 503 |
int mem_index = (idx >> 2) - 1; |
... | ... | |
5837 | 5820 |
break; |
5838 | 5821 |
case 0x1bc: /* bsf */ |
5839 | 5822 |
case 0x1bd: /* bsr */ |
5840 |
ot = dflag + OT_WORD; |
|
5841 |
modrm = ldub_code(s->pc++); |
|
5842 |
reg = ((modrm >> 3) & 7) | rex_r; |
|
5843 |
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); |
|
5844 |
/* NOTE: in order to handle the 0 case, we must load the |
|
5845 |
result. It could be optimized with a generated jump */ |
|
5846 |
gen_op_mov_TN_reg(ot, 1, reg); |
|
5847 |
gen_op_bsx_T0_cc[ot - OT_WORD][b & 1](); |
|
5848 |
gen_op_mov_reg_T1(ot, reg); |
|
5849 |
s->cc_op = CC_OP_LOGICB + ot; |
|
5823 |
{ |
|
5824 |
int label1; |
|
5825 |
ot = dflag + OT_WORD; |
|
5826 |
modrm = ldub_code(s->pc++); |
|
5827 |
reg = ((modrm >> 3) & 7) | rex_r; |
|
5828 |
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); |
|
5829 |
gen_extu(ot, cpu_T[0]); |
|
5830 |
label1 = gen_new_label(); |
|
5831 |
tcg_gen_movi_tl(cpu_cc_dst, 0); |
|
5832 |
tcg_gen_brcond_tl(TCG_COND_EQ, cpu_T[0], tcg_const_tl(0), label1); |
|
5833 |
if (b & 1) { |
|
5834 |
tcg_gen_helper_1_1(helper_bsr, cpu_T[0], cpu_T[0]); |
|
5835 |
} else { |
|
5836 |
tcg_gen_helper_1_1(helper_bsf, cpu_T[0], cpu_T[0]); |
|
5837 |
} |
|
5838 |
gen_op_mov_reg_T0(ot, reg); |
|
5839 |
tcg_gen_movi_tl(cpu_cc_dst, 1); |
|
5840 |
gen_set_label(label1); |
|
5841 |
tcg_gen_discard_tl(cpu_cc_src); |
|
5842 |
s->cc_op = CC_OP_LOGICB + ot; |
|
5843 |
} |
|
5850 | 5844 |
break; |
5851 | 5845 |
/************************/ |
5852 | 5846 |
/* bcd */ |
Also available in: Unified diff