[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 22/70] target/i386: Simplify POPF
From: |
Richard Henderson |
Subject: |
[PATCH 22/70] target/i386: Simplify POPF |
Date: |
Sun, 26 Feb 2023 19:41:45 -1000 |
Compute the eflags write mask separately, leaving one call
to the helper. Use tcg_constant_i32.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/i386/tcg/translate.c | 55 ++++++++-----------------------------
1 file changed, 11 insertions(+), 44 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 692f0c63a8..5d1fcc4b15 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -5226,52 +5226,19 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
case 0x9d: /* popf */
gen_svm_check_intercept(s, SVM_EXIT_POPF);
if (check_vm86_iopl(s)) {
- ot = gen_pop_T0(s);
+ int mask = TF_MASK | AC_MASK | ID_MASK | NT_MASK;
+
if (CPL(s) == 0) {
- if (dflag != MO_16) {
- gen_helper_write_eflags(cpu_env, s->T0,
- tcg_const_i32((TF_MASK | AC_MASK |
- ID_MASK | NT_MASK |
- IF_MASK |
- IOPL_MASK)));
- } else {
- gen_helper_write_eflags(cpu_env, s->T0,
- tcg_const_i32((TF_MASK | AC_MASK |
- ID_MASK | NT_MASK |
- IF_MASK | IOPL_MASK)
- & 0xffff));
- }
- } else {
- if (CPL(s) <= IOPL(s)) {
- if (dflag != MO_16) {
- gen_helper_write_eflags(cpu_env, s->T0,
- tcg_const_i32((TF_MASK |
- AC_MASK |
- ID_MASK |
- NT_MASK |
- IF_MASK)));
- } else {
- gen_helper_write_eflags(cpu_env, s->T0,
- tcg_const_i32((TF_MASK |
- AC_MASK |
- ID_MASK |
- NT_MASK |
- IF_MASK)
- & 0xffff));
- }
- } else {
- if (dflag != MO_16) {
- gen_helper_write_eflags(cpu_env, s->T0,
- tcg_const_i32((TF_MASK | AC_MASK |
- ID_MASK | NT_MASK)));
- } else {
- gen_helper_write_eflags(cpu_env, s->T0,
- tcg_const_i32((TF_MASK | AC_MASK |
- ID_MASK | NT_MASK)
- & 0xffff));
- }
- }
+ mask |= IF_MASK | IOPL_MASK;
+ } else if (CPL(s) <= IOPL(s)) {
+ mask |= IF_MASK;
}
+ if (dflag == MO_16) {
+ mask &= 0xffff;
+ }
+
+ ot = gen_pop_T0(s);
+ gen_helper_write_eflags(cpu_env, s->T0, tcg_constant_i32(mask));
gen_pop_update(s, ot);
set_cc_op(s, CC_OP_EFLAGS);
/* abort translation because TF/AC flag may change */
--
2.34.1
- [PATCH 13/70] target/avr: Avoid use of tcg_const_i32 throughout, (continued)
- [PATCH 13/70] target/avr: Avoid use of tcg_const_i32 throughout, Richard Henderson, 2023/02/27
- [PATCH 14/70] target/cris: Avoid use of tcg_const_i32 throughout, Richard Henderson, 2023/02/27
- [PATCH 15/70] target/hexagon: Use tcg_constant_* for gen_constant_from_imm, Richard Henderson, 2023/02/27
- [PATCH 16/70] target/hexagon/idef-parser: Use gen_tmp for LPCFG, Richard Henderson, 2023/02/27
- [PATCH 17/70] target/hexagon/idef-parser: Use gen_tmp for gen_pred_assign, Richard Henderson, 2023/02/27
- [PATCH 19/70] target/hexagon/idef-parser: Use gen_constant for gen_extend_tcg_width_op, Richard Henderson, 2023/02/27
- [PATCH 18/70] target/hexagon/idef-parser: Use gen_tmp for gen_rvalue_pred, Richard Henderson, 2023/02/27
- [PATCH 20/70] target/hppa: Avoid tcg_const_i64 in trans_fid_f, Richard Henderson, 2023/02/27
- [PATCH 21/70] target/hppa: Avoid use of tcg_const_i32 throughout, Richard Henderson, 2023/02/27
- [PATCH 24/70] target/m68k: Reject immediate as destination in gen_ea_mode, Richard Henderson, 2023/02/27
- [PATCH 22/70] target/i386: Simplify POPF,
Richard Henderson <=
- [PATCH 26/70] target/m68k: Avoid tcg_const_i32 when modified, Richard Henderson, 2023/02/27
- [PATCH 23/70] target/i386: Avoid use of tcg_const_* throughout, Richard Henderson, 2023/02/27
- [PATCH 25/70] target/m68k: Use tcg_constant_i32 in gen_ea_mode, Richard Henderson, 2023/02/27
- [PATCH 27/70] target/m68k: Avoid tcg_const_i32 in bfop_reg, Richard Henderson, 2023/02/27
- [PATCH 28/70] target/m68k: Avoid tcg_const_* throughout, Richard Henderson, 2023/02/27
- [PATCH 30/70] target/mips: Split out gen_lxl, Richard Henderson, 2023/02/27
- [PATCH 29/70] target/microblaze: Avoid tcg_const_* throughout, Richard Henderson, 2023/02/27
- [PATCH 31/70] target/mips: Split out gen_lxr, Richard Henderson, 2023/02/27