@samitouri / QOSamiQemu / commits / 1de033cf3e

target/arm: Implement FEAT_FAMINMAX for SME

Since there is no bfloat16 variant of FAMINMAX, check for missing function pointer in do_z2z_nn_fpst. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260522220306.235200-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Richard Henderson committed May 22, 2026 at 15:02 UTC 1de033cf3e0872ec2b9b6cdec1a33ad81b8bf4d6
3 files changed +31 -2
target/arm/cpu-features.h
+5
@@ -1593,6 +1593,11 @@ static inline bool isar_feature_aa64_sme2_f64f64(const ARMISARegisters *id)
1593 return isar_feature_aa64_sme2(id) && isar_feature_aa64_sme_f64f64(id);
1594 }
1595
1596 +static inline bool isar_feature_aa64_sme2_faminmax(const ARMISARegisters *id)
1597 +{
1598 + return isar_feature_aa64_sme2(id) && isar_feature_aa64_faminmax(id);
1599 +}
1600 +
1601 static inline bool isar_feature_aa64_sve_i8mm(const ARMISARegisters *id)
1602 {
1603 return isar_feature_aa64_sve(id) && isar_feature_aa64_sme_sve_i8mm(id);
target/arm/tcg/sme.decode
+5
@@ -286,6 +286,11 @@ URSHL_nn 1100000 1 .. 1 ..... 1011.0 10001 .... 1 @z2z_4x4
286 SQDMULH_nn 1100000 1 .. 1 ..... 1011.1 00000 .... 0 @z2z_2x2
287 SQDMULH_nn 1100000 1 .. 1 ..... 1011.1 00000 .... 0 @z2z_4x4
288
289 +FAMAX_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 0 @z2z_2x2
290 +FAMAX_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 0 @z2z_4x4
291 +FAMIN_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 1 @z2z_2x2
292 +FAMIN_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 1 @z2z_4x4
293 +
294 ### SME2 Multi-vector Multiple and Single Array Vectors
295
296 &azz_n n off rv zn zm
target/arm/tcg/translate-sme.c
+21 -2
@@ -19,6 +19,7 @@
19
20 #include "qemu/osdep.h"
21 #include "cpu.h"
22 +#include "helper-a64.h"
23 #include "helper-sme.h"
24 #include "helper-sve.h"
25 #include "translate.h"
@@ -742,9 +743,12 @@ static bool do_z2z_nn_fpst(DisasContext *s, arg_z2z_en *a,
743 gen_helper_gvec_3_ptr * const fns[4])
744 {
745 int esz = a->esz, n, dn, dm, vsz;
745 - gen_helper_gvec_3_ptr *fn;
746 + gen_helper_gvec_3_ptr *fn = fns[esz];
747 TCGv_ptr fpst;
748
749 + if (fn == NULL) {
750 + return false;
751 + }
752 if (esz == MO_8 && !dc_isar_feature(aa64_sme_b16b16, s)) {
753 return false;
754 }
@@ -753,7 +757,6 @@ static bool do_z2z_nn_fpst(DisasContext *s, arg_z2z_en *a,
757 }
758
759 fpst = fpstatus_ptr(esz == MO_16 ? FPST_A64_F16 : FPST_A64);
756 - fn = fns[esz];
760 n = a->n;
761 dn = a->zdn;
762 dm = a->zm;
@@ -812,6 +815,22 @@ static gen_helper_gvec_3_ptr * const f_vector_fminnm[4] = {
815 TRANS_FEAT(FMINNM_n1, aa64_sme2, do_z2z_n1_fpst, a, f_vector_fminnm)
816 TRANS_FEAT(FMINNM_nn, aa64_sme2, do_z2z_nn_fpst, a, f_vector_fminnm)
817
818 +static gen_helper_gvec_3_ptr * const f_vector_famax[4] = {
819 + NULL,
820 + gen_helper_gvec_famax_h,
821 + gen_helper_gvec_famax_s,
822 + gen_helper_gvec_famax_d,
823 +};
824 +TRANS_FEAT(FAMAX_nn, aa64_sme2_faminmax, do_z2z_nn_fpst, a, f_vector_famax)
825 +
826 +static gen_helper_gvec_3_ptr * const f_vector_famin[4] = {
827 + NULL,
828 + gen_helper_gvec_famin_h,
829 + gen_helper_gvec_famin_s,
830 + gen_helper_gvec_famin_d,
831 +};
832 +TRANS_FEAT(FAMIN_nn, aa64_sme2_faminmax, do_z2z_nn_fpst, a, f_vector_famin)
833 +
834 /* Add/Sub vector Z[m] to each Z[n*N] with result in ZA[d*N]. */
835 static bool do_azz_n1(DisasContext *s, arg_azz_n *a, int esz,
836 GVecGen3FnVar *fn)