target/mips: Extract msa_translate_init() from mips_tcg_init()
The msa_wr_d[] registers are only initialized/used by MSA. They are declared static. We want to move them to the new 'msa_translate.c' unit in few commits, without having to declare them global (with extern). Extract first the logic initialization of the MSA registers from the generic initialization. We will later move this function along with the MSA registers to the new C unit. Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Message-Id: <20201208003702.4088927-8-f4bug@amsat.org>
This commit is contained in:
parent
e2665f314d
commit
959c5da28e
@ -31552,6 +31552,24 @@ void mips_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void msa_translate_init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++) {
|
||||||
|
int off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[0]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The MSA vector registers are mapped on the
|
||||||
|
* scalar floating-point unit (FPU) registers.
|
||||||
|
*/
|
||||||
|
msa_wr_d[i * 2] = fpu_f64[i];
|
||||||
|
off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[1]);
|
||||||
|
msa_wr_d[i * 2 + 1] =
|
||||||
|
tcg_global_mem_new_i64(cpu_env, off, msaregnames[i * 2 + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void mips_tcg_init(void)
|
void mips_tcg_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -31567,20 +31585,7 @@ void mips_tcg_init(void)
|
|||||||
|
|
||||||
fpu_f64[i] = tcg_global_mem_new_i64(cpu_env, off, fregnames[i]);
|
fpu_f64[i] = tcg_global_mem_new_i64(cpu_env, off, fregnames[i]);
|
||||||
}
|
}
|
||||||
/* MSA */
|
msa_translate_init();
|
||||||
for (i = 0; i < 32; i++) {
|
|
||||||
int off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[0]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The MSA vector registers are mapped on the
|
|
||||||
* scalar floating-point unit (FPU) registers.
|
|
||||||
*/
|
|
||||||
msa_wr_d[i * 2] = fpu_f64[i];
|
|
||||||
off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[1]);
|
|
||||||
msa_wr_d[i * 2 + 1] =
|
|
||||||
tcg_global_mem_new_i64(cpu_env, off, msaregnames[i * 2 + 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
cpu_PC = tcg_global_mem_new(cpu_env,
|
cpu_PC = tcg_global_mem_new(cpu_env,
|
||||||
offsetof(CPUMIPSState, active_tc.PC), "PC");
|
offsetof(CPUMIPSState, active_tc.PC), "PC");
|
||||||
for (i = 0; i < MIPS_DSP_ACC; i++) {
|
for (i = 0; i < MIPS_DSP_ACC; i++) {
|
||||||
|
@ -172,4 +172,7 @@ extern TCGv bcond;
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/* MSA */
|
||||||
|
void msa_translate_init(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user