Add a property to allow setting a flag in cpu env that will be used to control if hardfloat is used for floating point ops (i.e. speed is preferred over accuracy).
Signed-off-by: BALATON Zoltan <bala...@eik.bme.hu> --- target/ppc/cpu.h | 2 ++ target/ppc/translate_init.inc.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index b283042515..1b258a5db5 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1033,6 +1033,7 @@ struct CPUPPCState { float_status vec_status; float_status fp_status; /* Floating point execution context */ target_ulong fpscr; /* Floating point status and control register */ + bool hardfloat; /* use hardfloat (this breaks FPSCR[FI] bit) */ /* Internal devices resources */ ppc_tb_t *tb_env; /* Time base and decrementer */ @@ -1163,6 +1164,7 @@ struct PowerPCCPU { void *machine_data; int32_t node_id; /* NUMA node this CPU belongs to */ PPCHash64Options *hash64_opts; + bool hardfloat; /* pass on property to env */ /* Those resources are used only during code translation */ /* opcode handlers */ diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 53995f62ea..d6e1d66bc8 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -10736,6 +10736,7 @@ static void ppc_cpu_reset(CPUState *s) /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status); + env->hardfloat = cpu->hardfloat; for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) { ppc_spr_t *spr = &env->spr_cb[i]; @@ -10868,6 +10869,7 @@ static Property ppc_cpu_properties[] = { false), DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU, pre_3_0_migration, false), + DEFINE_PROP_BOOL("hardfloat", PowerPCCPU, hardfloat, false), DEFINE_PROP_END_OF_LIST(), }; -- 2.21.1