On 5/21/26 01:25, Peter Maydell wrote:
On Wed, 20 May 2026 at 19:22, Richard Henderson
<[email protected]> wrote:
Signed-off-by: Richard Henderson <[email protected]>
+/*
+ * Use float_minmax_ismag to get the absolute value min/max.
+ * Avoid float_minmax_is{num,number} so that we get normal NaN processing.
+ * If the result is not a nan, take the absolute value.
+ *
+ * Note this operation squashes FZ, FIZ, and AH to 0.
+ * Create a fresh status with default behaviour and propagate exceptions.
+ */
+#define DO_FAMINMAX(NAME, TYPE, MIN) \
+TYPE TYPE##_##NAME(TYPE a, TYPE b, float_status *s) \
+{ \
+ float_status local = {}; \
+ arm_set_default_fp_behaviours(&local); \
This misses that we need to keep the default_nan_mode setting
from 's', otherwise we stop honouring FPCR.DN. This will fix it:
--- a/target/arm/tcg/vec_helper64.c
+++ b/target/arm/tcg/vec_helper64.c
@@ -155,6 +155,7 @@ TYPE TYPE##_##NAME(TYPE a, TYPE b, float_status
*s) \
{ \
float_status local = {}; \
arm_set_default_fp_behaviours(&local); \
+ set_default_nan_mode(get_default_nan_mode(s), &local); \
TYPE r = TYPE##_minmax(a, b, &local, MIN | float_minmax_ismag); \
if (!TYPE##_is_any_nan(r)) { \
r = TYPE##_abs(r); \
(or we could go back to copying 's' into 'local').
I went back to copying s into local. I should have known a blank slate was too good to be
true. :-)
r~