[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 15/60] target-i386: Tidy mov[sz][bw]
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 15/60] target-i386: Tidy mov[sz][bw] |
Date: |
Fri, 29 Nov 2013 16:00:02 +1300 |
We can use the MO_SIGN bit to tidy the reg-reg switch statement
as well as pass it on to gen_op_ld_v, eliminating one call.
Signed-off-by: Richard Henderson <address@hidden>
---
target-i386/translate.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/target-i386/translate.c b/target-i386/translate.c
index c1591d9..47ed0b4 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -5617,11 +5617,16 @@ static target_ulong disas_insn(CPUX86State *env,
DisasContext *s,
case 0x1be: /* movsbS Gv, Eb */
case 0x1bf: /* movswS Gv, Eb */
{
- int d_ot;
+ TCGMemOp d_ot;
+ TCGMemOp s_ot;
+
/* d_ot is the size of destination */
d_ot = dflag + MO_16;
/* ot is the size of source */
ot = (b & 1) + MO_8;
+ /* s_ot is the sign+size of source */
+ s_ot = b & 8 ? MO_SIGN | ot : ot;
+
modrm = cpu_ldub_code(env, s->pc++);
reg = ((modrm >> 3) & 7) | rex_r;
mod = (modrm >> 6) & 3;
@@ -5629,29 +5634,25 @@ static target_ulong disas_insn(CPUX86State *env,
DisasContext *s,
if (mod == 3) {
gen_op_mov_TN_reg(ot, 0, rm);
- switch(ot | (b & 8)) {
- case MO_8:
+ switch (s_ot) {
+ case MO_UB:
tcg_gen_ext8u_tl(cpu_T[0], cpu_T[0]);
break;
- case MO_8 | 8:
+ case MO_SB:
tcg_gen_ext8s_tl(cpu_T[0], cpu_T[0]);
break;
- case MO_16:
+ case MO_UW:
tcg_gen_ext16u_tl(cpu_T[0], cpu_T[0]);
break;
default:
- case MO_16 | 8:
+ case MO_SW:
tcg_gen_ext16s_tl(cpu_T[0], cpu_T[0]);
break;
}
gen_op_mov_reg_T0(d_ot, reg);
} else {
gen_lea_modrm(env, s, modrm, ®_addr, &offset_addr);
- if (b & 8) {
- gen_op_ld_v(s, ot | MO_SIGN, cpu_T[0], cpu_A0);
- } else {
- gen_op_ld_v(s, ot, cpu_T[0], cpu_A0);
- }
+ gen_op_ld_v(s, s_ot, cpu_T[0], cpu_A0);
gen_op_mov_reg_T0(d_ot, reg);
}
}
--
1.8.3.1
- [Qemu-devel] [PATCH v2 05/60] target-i386: Use new tcg_gen_qemu_st_* helpers, (continued)
- [Qemu-devel] [PATCH v2 05/60] target-i386: Use new tcg_gen_qemu_st_* helpers, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 06/60] target-i386: Replace OT_* constants with MO_* constants, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 07/60] target-i386: Remove gen_op_ld_T0_A0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 08/60] target-i386: Remove gen_op_ldu_T0_A0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 09/60] target-i386: Remove gen_op_ld_T1_A0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 10/60] target-i386: Remove gen_op_lds_T0_A0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 11/60] target-i386: Introduce gen_op_st_rm_T0_A0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 12/60] target-i386: Remove gen_op_st_T0_A0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 13/60] target-i386: Remove gen_op_st_T1_A0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 14/60] target-i386: Fix typo in gen_push_T1, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 15/60] target-i386: Tidy mov[sz][bw],
Richard Henderson <=
- [Qemu-devel] [PATCH v2 16/60] target-i386: Tidy movsl, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 17/60] target-i386: Remove unused arguments to gen_lea_modrm, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 18/60] target-i386: Use MO_BE for movbe, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 19/60] target-i386: Tidy gen_op_mov_TN_reg+tcg_gen_trunc_tl_i32, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 20/60] target-i386: Tidy load + truncate, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 21/60] target-i386: Tidy extend + store, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 22/60] target-i386: Tidy extend + move, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 23/60] target-i386: Remove gen_op_movl_T0_0, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 24/60] target-i386: Remove gen_op_movl_T0_im*, Richard Henderson, 2013/11/28
- [Qemu-devel] [PATCH v2 25/60] target-i386: Remove gen_op_movl_T0_im*, Richard Henderson, 2013/11/28