On 5/21/26 08:12, Peter Maydell wrote:
/*
  * Fully initialize an fp_status to the usual Arm
  * behaviours. If you want the AH=1 choices you can
  * call arm_set_ah_fp_behaviours() afterwards.
  */
arm_init_fp_status(float_status *s);

and have the implementation be
    *s = (float_status){};
    arm_set_default_fp_behaviours(s);
    set_float_e4m3_nan_is_snan(true, s);
    /* We want 0 for all other settings */

?

Then reset can do
     for (int i = 0; i < FPST_COUNT; i++) {
         arm_init_fp_status(&env->vfp.fp_status[i]);
     }
     set_flush_to_zero(1, &env->vfp.fp_status[FPST_STD]);
     set_flush_inputs_to_zero(1, &env->vfp.fp_status[FPST_STD]);
     set_default_nan_mode(1, &env->vfp.fp_status[FPST_STD]);
     set_default_nan_mode(1, &env->vfp.fp_status[FPST_STD_F16]);
     set_default_nan_mode(1, &env->vfp.fp_status[FPST_ZA]);
     set_default_nan_mode(1, &env->vfp.fp_status[FPST_ZA_F16]);
     arm_set_ah_fp_behaviours(&env->vfp.fp_status[FPST_AH]);
     set_flush_to_zero(1, &env->vfp.fp_status[FPST_AH]);
     set_flush_inputs_to_zero(1, &env->vfp.fp_status[FPST_AH]);
     arm_set_ah_fp_behaviours(&env->vfp.fp_status[FPST_AH_F16]);

I've created arm_init_fp_status, local to cpu.c, and which incorporates this mess too. I think it's a bit clearer to read.

Setting the e4m3 knob happens in arm_init_fp_status in a separate patch.

and the code we want to add for fp8 can init its local
fp_status by calling arm_init_fp_status.

I wonder about that.  I'm happy to keep copying so far...


r~

Reply via email to