return s390_exc;
}
+static int s390_get_bfp_rounding_mode(CPUS390XState *env, int m3)
+{
+ switch (m3) {
+ case 0:
+ /* current mode */
+ return env->fpu_status.float_rounding_mode;
+ case 1:
+ /* round to nearest with ties away from 0 */
+ return float_round_ties_away;
+ case 3:
+ /* round to prepare for shorter precision */
+ return float_round_to_odd;
+ case 4:
+ /* round to nearest with ties to even */
+ return float_round_nearest_even;
+ case 5:
+ /* round to zero */
+ return float_round_to_zero;
+ case 6:
+ /* round to +inf */
+ return float_round_up;
+ case 7:
+ /* round to -inf */
+ return float_round_down;
+ default:
+ g_assert_not_reached();
+ }
+}
+
/* Should be called after any operation that may raise IEEE exceptions. */
static void handle_exceptions(CPUS390XState *env, bool XxC, uintptr_t retaddr)
{
{
int ret = env->fpu_status.float_rounding_mode;
- switch (m3) {
- case 0:
- /* current mode */
- break;
- case 1:
- /* round to nearest with ties away from 0 */
- set_float_rounding_mode(float_round_ties_away, &env->fpu_status);
- break;
- case 3:
- /* round to prepare for shorter precision */
- set_float_rounding_mode(float_round_to_odd, &env->fpu_status);
- break;
- case 4:
- /* round to nearest with ties to even */
- set_float_rounding_mode(float_round_nearest_even, &env->fpu_status);
- break;
- case 5:
- /* round to zero */
- set_float_rounding_mode(float_round_to_zero, &env->fpu_status);
- break;
- case 6:
- /* round to +inf */
- set_float_rounding_mode(float_round_up, &env->fpu_status);
- break;
- case 7:
- /* round to -inf */
- set_float_rounding_mode(float_round_down, &env->fpu_status);
- break;
- default:
- g_assert_not_reached();
- }
+ set_float_rounding_mode(s390_get_bfp_rounding_mode(env, m3),
+ &env->fpu_status);
return ret;
}