diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2019-08-26 15:10:10 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2019-09-04 12:58:55 -0700 |
commit | a465772eea8fef59bef9a9fe424b1af4866991f5 (patch) | |
tree | 67872aa23218d239cfbd37c28b538d3ae063ea1f /target/openrisc/fpu_helper.c | |
parent | 2b13b4b93dc924a139d7a9350cd13c2c9479d03b (diff) |
target/openrisc: Implement move to/from FPCSR
Reviewed-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/openrisc/fpu_helper.c')
-rw-r--r-- | target/openrisc/fpu_helper.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/target/openrisc/fpu_helper.c b/target/openrisc/fpu_helper.c index 7bcef9dc53..59e1413279 100644 --- a/target/openrisc/fpu_helper.c +++ b/target/openrisc/fpu_helper.c @@ -61,6 +61,19 @@ void HELPER(update_fpcsr)(CPUOpenRISCState *env) } } +void cpu_set_fpcsr(CPUOpenRISCState *env, uint32_t val) +{ + static const int rm_to_sf[] = { + float_round_nearest_even, + float_round_to_zero, + float_round_up, + float_round_down + }; + + env->fpcsr = val & 0x7ff; + set_float_rounding_mode(rm_to_sf[extract32(val, 1, 2)], &env->fp_status); +} + uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val) { return int64_to_float64(val, &env->fp_status); |