[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 74/84] target/i386: Simplify POPF
From: |
Richard Henderson |
Subject: |
[PULL 74/84] target/i386: Simplify POPF |
Date: |
Sun, 5 Mar 2023 16:39:44 -0800 |
Compute the eflags write mask separately, leaving one call
to the helper. Use tcg_constant_i32.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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 2f3842663d..fa422ebd0b 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
- [PULL 69/84] target/hexagon: Use tcg_constant_* for gen_constant_from_imm, (continued)
- [PULL 69/84] target/hexagon: Use tcg_constant_* for gen_constant_from_imm, Richard Henderson, 2023/03/05
- [PULL 68/84] docs/devel/tcg-ops: Drop recommendation to free temps, Richard Henderson, 2023/03/05
- [PULL 72/84] target/hexagon/idef-parser: Use gen_tmp for gen_rvalue_pred, Richard Henderson, 2023/03/05
- [PULL 46/84] target/microblaze: Drop tcg_temp_free, Richard Henderson, 2023/03/05
- [PULL 64/84] target/mips: Fix trans_mult_acc return, Richard Henderson, 2023/03/05
- [PULL 67/84] tracing: remove transform.py, Richard Henderson, 2023/03/05
- [PULL 71/84] target/hexagon/idef-parser: Use gen_tmp for gen_pred_assign, Richard Henderson, 2023/03/05
- [PULL 76/84] target/riscv: Avoid tcg_const_*, Richard Henderson, 2023/03/05
- [PULL 73/84] target/hexagon/idef-parser: Use gen_constant for gen_extend_tcg_width_op, Richard Henderson, 2023/03/05
- [PULL 66/84] include/exec/gen-icount: Drop tcg_temp_free in gen_tb_start, Richard Henderson, 2023/03/05
- [PULL 74/84] target/i386: Simplify POPF,
Richard Henderson <=
- [PULL 78/84] target/sparc: Avoid tcg_const_{tl,i32}, Richard Henderson, 2023/03/05
- [PULL 77/84] target/s390x: Split out gen_ri2, Richard Henderson, 2023/03/05
- [PULL 75/84] target/microblaze: Avoid tcg_const_* throughout, Richard Henderson, 2023/03/05
- [PULL 53/84] target/rx: Drop tcg_temp_free, Richard Henderson, 2023/03/05
- [PULL 56/84] target/sparc: Drop get_temp_i32, Richard Henderson, 2023/03/05
- [PULL 70/84] target/hexagon/idef-parser: Use gen_tmp for LPCFG, Richard Henderson, 2023/03/05
- [PULL 79/84] target/xtensa: Tidy translate_bb, Richard Henderson, 2023/03/05
- [PULL 80/84] target/xtensa: Tidy translate_clamps, Richard Henderson, 2023/03/05
- [PULL 83/84] target/xtensa: Split constant in bit shift, Richard Henderson, 2023/03/05
- [PULL 82/84] target/xtensa: Use tcg_gen_subfi_i32 in translate_sll, Richard Henderson, 2023/03/05