target/i386: Trivial code motion and code style fix

A new pair of braces has to be added to declare variables in the case block.
The code style is also fixed according to the transalte.c itself during the
code motion.

Signed-off-by: Ziqiao Kong <ziqiaokong@gmail.com>
Message-Id: <20210530150112.74411-1-ziqiaokong@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Ziqiao Kong 2021-05-30 23:01:12 +08:00 committed by Richard Henderson
parent 080ac33542
commit 505910a6e2

View File

@ -5919,6 +5919,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
/************************/
/* floats */
case 0xd8 ... 0xdf:
{
if (s->flags & (HF_EM_MASK | HF_TS_MASK)) {
/* if CR0.EM or CR0.TS are set, generate an FPU exception */
/* XXX: what to do if illegal op ? */
@ -5932,7 +5933,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
if (mod != 3) {
/* memory op */
gen_lea_modrm(env, s, modrm);
switch(op) {
switch (op) {
case 0x00 ... 0x07: /* fxxxs */
case 0x10 ... 0x17: /* fixxxl */
case 0x20 ... 0x27: /* fxxxl */
@ -5941,7 +5942,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
int op1;
op1 = op & 7;
switch(op >> 4) {
switch (op >> 4) {
case 0:
tcg_gen_qemu_ld_i32(s->tmp2_i32, s->A0,
s->mem_index, MO_LEUL);
@ -5978,9 +5979,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
case 0x18 ... 0x1b: /* fildl, fisttpl, fistl, fistpl */
case 0x28 ... 0x2b: /* fldl, fisttpll, fstl, fstpl */
case 0x38 ... 0x3b: /* filds, fisttps, fists, fistps */
switch(op & 7) {
switch (op & 7) {
case 0:
switch(op >> 4) {
switch (op >> 4) {
case 0:
tcg_gen_qemu_ld_i32(s->tmp2_i32, s->A0,
s->mem_index, MO_LEUL);
@ -6006,7 +6007,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
break;
case 1:
/* XXX: the corresponding CPUID bit must be tested ! */
switch(op >> 4) {
switch (op >> 4) {
case 1:
gen_helper_fisttl_ST0(s->tmp2_i32, cpu_env);
tcg_gen_qemu_st_i32(s->tmp2_i32, s->A0,
@ -6027,7 +6028,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fpop(cpu_env);
break;
default:
switch(op >> 4) {
switch (op >> 4) {
case 0:
gen_helper_fsts_ST0(s->tmp2_i32, cpu_env);
tcg_gen_qemu_st_i32(s->tmp2_i32, s->A0,
@ -6050,13 +6051,15 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
s->mem_index, MO_LEUW);
break;
}
if ((op & 7) == 3)
if ((op & 7) == 3) {
gen_helper_fpop(cpu_env);
}
break;
}
break;
case 0x0c: /* fldenv mem */
gen_helper_fldenv(cpu_env, s->A0, tcg_const_i32(dflag - 1));
gen_helper_fldenv(cpu_env, s->A0,
tcg_const_i32(dflag - 1));
break;
case 0x0d: /* fldcw mem */
tcg_gen_qemu_ld_i32(s->tmp2_i32, s->A0,
@ -6064,7 +6067,8 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fldcw(cpu_env, s->tmp2_i32);
break;
case 0x0e: /* fnstenv mem */
gen_helper_fstenv(cpu_env, s->A0, tcg_const_i32(dflag - 1));
gen_helper_fstenv(cpu_env, s->A0,
tcg_const_i32(dflag - 1));
break;
case 0x0f: /* fnstcw mem */
gen_helper_fnstcw(s->tmp2_i32, cpu_env);
@ -6079,10 +6083,12 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fpop(cpu_env);
break;
case 0x2c: /* frstor mem */
gen_helper_frstor(cpu_env, s->A0, tcg_const_i32(dflag - 1));
gen_helper_frstor(cpu_env, s->A0,
tcg_const_i32(dflag - 1));
break;
case 0x2e: /* fnsave mem */
gen_helper_fsave(cpu_env, s->A0, tcg_const_i32(dflag - 1));
gen_helper_fsave(cpu_env, s->A0,
tcg_const_i32(dflag - 1));
break;
case 0x2f: /* fnstsw mem */
gen_helper_fnstsw(s->tmp2_i32, cpu_env);
@ -6097,12 +6103,14 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fpop(cpu_env);
break;
case 0x3d: /* fildll */
tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0, s->mem_index, MO_LEQ);
tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0,
s->mem_index, MO_LEQ);
gen_helper_fildll_ST0(cpu_env, s->tmp1_i64);
break;
case 0x3f: /* fistpll */
gen_helper_fistll_ST0(s->tmp1_i64, cpu_env);
tcg_gen_qemu_st_i64(s->tmp1_i64, s->A0, s->mem_index, MO_LEQ);
tcg_gen_qemu_st_i64(s->tmp1_i64, s->A0,
s->mem_index, MO_LEQ);
gen_helper_fpop(cpu_env);
break;
default:
@ -6112,7 +6120,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
/* register float ops */
opreg = rm;
switch(op) {
switch (op) {
case 0x08: /* fld sti */
gen_helper_fpush(cpu_env);
gen_helper_fmov_ST0_STN(cpu_env,
@ -6124,7 +6132,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fxchg_ST0_STN(cpu_env, tcg_const_i32(opreg));
break;
case 0x0a: /* grp d9/2 */
switch(rm) {
switch (rm) {
case 0: /* fnop */
/* check exceptions (FreeBSD FPU probe) */
gen_helper_fwait(cpu_env);
@ -6134,7 +6142,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
}
break;
case 0x0c: /* grp d9/4 */
switch(rm) {
switch (rm) {
case 0: /* fchs */
gen_helper_fchs_ST0(cpu_env);
break;
@ -6154,7 +6162,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
break;
case 0x0d: /* grp d9/5 */
{
switch(rm) {
switch (rm) {
case 0:
gen_helper_fpush(cpu_env);
gen_helper_fld1_ST0(cpu_env);
@ -6189,7 +6197,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
}
break;
case 0x0e: /* grp d9/6 */
switch(rm) {
switch (rm) {
case 0: /* f2xm1 */
gen_helper_f2xm1(cpu_env);
break;
@ -6218,7 +6226,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
}
break;
case 0x0f: /* grp d9/7 */
switch(rm) {
switch (rm) {
case 0: /* fprem */
gen_helper_fprem(cpu_env);
break;
@ -6255,10 +6263,12 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
op1 = op & 7;
if (op >= 0x20) {
gen_helper_fp_arith_STN_ST0(op1, opreg);
if (op >= 0x30)
if (op >= 0x30) {
gen_helper_fpop(cpu_env);
}
} else {
gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg));
gen_helper_fmov_FT0_STN(cpu_env,
tcg_const_i32(opreg));
gen_helper_fp_arith_ST0_FT0(op1);
}
}
@ -6276,7 +6286,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fpop(cpu_env);
break;
case 0x15: /* da/5 */
switch(rm) {
switch (rm) {
case 1: /* fucompp */
gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(1));
gen_helper_fucom_ST0_FT0(cpu_env);
@ -6288,7 +6298,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
}
break;
case 0x1c:
switch(rm) {
switch (rm) {
case 0: /* feni (287 only, just do nop here) */
break;
case 1: /* fdisi (287 only, just do nop here) */
@ -6346,7 +6356,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fpop(cpu_env);
break;
case 0x33: /* de/3 */
switch(rm) {
switch (rm) {
case 1: /* fcompp */
gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(1));
gen_helper_fcom_ST0_FT0(cpu_env);
@ -6362,7 +6372,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
gen_helper_fpop(cpu_env);
break;
case 0x3c: /* df/4 */
switch(rm) {
switch (rm) {
case 0:
gen_helper_fnstsw(s->tmp2_i32, cpu_env);
tcg_gen_extu_i32_tl(s->T0, s->tmp2_i32);
@ -6418,6 +6428,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
goto unknown_op;
}
}
}
break;
/************************/
/* string ops */