@samitouri / QOSamiQemu / commits / 23ece2805f

target/arm: Set correct fp flags for FLOGB when FPCR.AH = 1

Our implementation of the FLOGB insn does the operations entirely in the helper function, without needing to use fpu functions. This means it needs to handle all the fp status flags itself. We aren't setting float_flag_input_denormal_used when we use (i.e. do not flush to zero) an input denormal, which means that FPCR.IDC isn't set when it should be for FPCR.AH=1. We missed this when we added float_flag_input_denormal_used and made the fpu/ code set it. Add the missing float_raise(). Cc: qemu-stable@nongnu.org Fixes: d38a57a3f ("target/arm: Enable FEAT_AFP for '-cpu max'") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260521122913.1565011-4-peter.maydell@linaro.org

Peter Maydell committed May 21, 2026 at 13:29 UTC 23ece2805f9a3f90f317aac1b49ee45783b57636
1 file changed +3
target/arm/tcg/sve_helper.c
+3
@@ -5036,6 +5036,7 @@ static int16_t do_float16_logb_as_int(float16 a, float_status *s)
5036 if (frac != 0) {
5037 if (!get_flush_inputs_to_zero(s)) {
5038 /* denormal: bias - fractional_zeros */
5039 + float_raise(float_flag_input_denormal_used, s);
5040 return -15 - clz32(frac);
5041 }
5042 /* flush to zero */
@@ -5064,6 +5065,7 @@ static int32_t do_float32_logb_as_int(float32 a, float_status *s)
5065 if (frac != 0) {
5066 if (!get_flush_inputs_to_zero(s)) {
5067 /* denormal: bias - fractional_zeros */
5068 + float_raise(float_flag_input_denormal_used, s);
5069 return -127 - clz32(frac);
5070 }
5071 /* flush to zero */
@@ -5092,6 +5094,7 @@ static int64_t do_float64_logb_as_int(float64 a, float_status *s)
5094 if (frac != 0) {
5095 if (!get_flush_inputs_to_zero(s)) {
5096 /* denormal: bias - fractional_zeros */
5097 + float_raise(float_flag_input_denormal_used, s);
5098 return -1023 - clz64(frac);
5099 }
5100 /* flush to zero */