target/arm: Implement FEAT_FP8
v3 cover target/arm: Implement FEAT_FP8
Based-on: [email protected] ("[PATCH v2 00/40] fpu: Export some internals for targets")
v2: https://lore.kernel.org/qemu-devel/[email protected]/
Changes for v3:
- Rebase on softfloat-parts.h, which allows us to drop some local changes to fpu/.
- Enable ID_AA64FPFR0.F8{E5M2,E4M3}.
- Implement FEAT_SME_LUTv2.
- Implement FEAT_FP8FMA, FEAT_SSVE_FP8FMA.
I still haven't addressed the required firmware update for
tests/functional/aarch64/test_rme_virt.py
tests/functional/aarch64/test_rme_sbsaref.py
r~
Richard Henderson (47):
target/arm: Implement ID_AA64ISAR3
target/arm: Implement FEAT_FAMINMAX for AdvSIMD target/arm: Implement FEAT_FAMINMAX for SME
target/arm: Implement FEAT_FAMINMAX for SVE
target/arm: Enable FEAT_FAMINMAX for -cpu max
target/arm: Update SCR bits for Arm ARM M.a.a
target/arm: Update HCRX bits for Arm ARM M.a.a
target/arm: Introduce FPMR
target/arm: Update SCTLR bits for FEAT_FPMR
target/arm: Enable EnFPM bits for FEAT_FPMR
target/arm: Clear FPMR on ResetSVEState
target/arm: Add FPMR_EL to TBFLAGS
target/arm: Trap direct acceses to FPMR
target/arm: Enable FEAT_FPMR for -cpu max
target/arm: Implement ID_AA64FPFR0
target/arm: Add isar_feature_aa64_f8cvt
target/arm: Implement FSCALE for AdvSIMD
target/arm: Implement FSCALE for SME
target/arm: Split vector-type.h from cpu.h
target/arm: Move vectors_overlap to vec_internal.h target/arm: Implement BF1CVTL, BF1CVTL2, BF2CVTL, BF2CVTL2 for AdvSIMD target/arm: Implement BF1CVT, BF1CVTLT, BF2CVT, BF2CVTLT for SVE target/arm: Rename SME BFCVT patterns to BFCVT_hs target/arm: Implement BF1CVT, BF1CVTL, BF2CVT, BF2CVTL for SME target/arm: Implement F1CVTL, F1CVTL2, F2CVTL, F2CVTL2 for AdvSIMD target/arm: Implement F1CVT, F1CVTLT, F2CVT, F2CVTLT for SVE target/arm: Implement F1CVT, F1CVTL, F2CVT, F2CVTL for SME target/arm: Implement BFCVTN for SVE
target/arm: Implement FCVTN (16- to 8-bit fp) for AdvSIMD target/arm: Implement FCVTN, FCVTN2 (32- to 8-bit fp) for AdvSIMD target/arm: Implement FCVTN (16- to 8-bit fp) for SVE target/arm: Implement FCVTNB, FCVTNT for SVE
target/arm: Implement FCVT (FP16 to FP8) for SME target/arm: Implement FCVT, FCVTN (FP32 to FP8) for SME target/arm: Implement LUTI2, LUTI4 for AdvSIMD
target/arm: Implement LUTI2, LUTI4 for SVE
target/arm: Enable FEAT_LUT for -cpu max
target/arm: Enable FEAT_FP8 for -cpu max
target/arm: Update ID_AA64SMFR0_EL1 fields to ARM M.b target/arm: Implement MOVT (vector to table)
target/arm: Implement LUTI4 (four registers, 8-bit) target/arm: Enable FEAT_SME_LUTv2 for -cpu max
target/arm: Implement FMLALB, FMLALT for AdvSIMD target/arm: Implement FMLALB, FMLALT (FP8 to FP16) for SVE target/arm: Implement FMLALL{BB,BT,TB,TT} for AdvSIMD target/arm: Implement FMLALL{BB,BT,TB,TT} for SVE target/arm: Enable FEAT_FP8FMA, FEAT_SSVE_FP8FMA for -cpu max
target/arm/cpregs.h | 5 + target/arm/cpu-features.h | 97 +++ target/arm/cpu.h | 52 +- target/arm/helper-fp8.h | 14 + target/arm/internals.h | 13 +- target/arm/tcg/helper-a64-defs.h | 11 + target/arm/tcg/helper-defs.h | 6 + target/arm/tcg/helper-fp8-defs.h | 31 + target/arm/tcg/helper-sme-defs.h | 2 +- target/arm/tcg/helper-sve-defs.h | 14 + target/arm/tcg/translate-a64.h | 1 + target/arm/tcg/translate.h | 10 + target/arm/tcg/vec_internal.h | 19 + target/arm/vector-type.h | 44 ++ target/arm/helper.c | 43 +- target/arm/machine.c | 20 + target/arm/tcg/cpu64.c | 18 + target/arm/tcg/fp8_helper.c | 1036 ++++++++++++++++++++++++++++++ target/arm/tcg/hflags.c | 41 ++ target/arm/tcg/sme_helper.c | 8 +- target/arm/tcg/sve_helper.c | 8 + target/arm/tcg/translate-a64.c | 152 +++++ target/arm/tcg/translate-sme.c | 109 +++- target/arm/tcg/translate-sve.c | 147 +++++ target/arm/tcg/vec_helper.c | 66 ++ target/arm/tcg/vec_helper64.c | 51 ++ docs/system/arm/emulation.rst | 7 + target/arm/cpu-sysregs.h.inc | 2 + target/arm/tcg/a64.decode | 38 ++ target/arm/tcg/meson.build | 1 + target/arm/tcg/sme.decode | 36 +- target/arm/tcg/sve.decode | 41 +- 32 files changed, 2084 insertions(+), 59 deletions(-) create mode 100644 target/arm/helper-fp8.h create mode 100644 target/arm/tcg/helper-fp8-defs.h create mode 100644 target/arm/vector-type.h create mode 100644 target/arm/tcg/fp8_helper.c
Signature · 1 line
2.43.0
PATCH v3 1/47 target/arm: Implement ID_AA64ISAR3
--- target/arm/cpu-features.h | 9 +++++++++ target/arm/helper.c | 8 ++++++-- target/arm/cpu-sysregs.h.inc | 1 + 3 files changed, 16 insertions(+), 2 deletions(-)
target/arm/cpu-features.h +9 -0
@@ -244,6 +244,15 @@ FIELD(ID_AA64ISAR2, CSSC, 52, 4) FIELD(ID_AA64ISAR2, LUT, 56, 4) FIELD(ID_AA64ISAR2, ATS1A, 60, 4) +FIELD(ID_AA64ISAR3, CPA, 0, 4) +FIELD(ID_AA64ISAR3, FAMINMAX, 4, 4) +FIELD(ID_AA64ISAR3, TLBIW, 8, 4) +FIELD(ID_AA64ISAR3, PACM, 12, 4) +FIELD(ID_AA64ISAR3, LSFE, 16, 4) +FIELD(ID_AA64ISAR3, OCCMO, 20, 4) +FIELD(ID_AA64ISAR3, LSUI, 24, 4) +FIELD(ID_AA64ISAR3, FPRCVT, 28, 4) + FIELD(ID_AA64PFR0, EL0, 0, 4) FIELD(ID_AA64PFR0, EL1, 4, 4)FIELD (ID_AA64PFR0 ,EL2 ,8 ,4 )
target/arm/helper.c +6 -2
@@ -6498,11 +6498,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid3, .resetvalue = GET_IDREG(isar, ID_AA64ISAR2)}, - { .name = "ID_AA64ISAR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, + { .name = "ID_AA64ISAR3_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid3, - .resetvalue = 0 }, + .resetvalue = GET_IDREG(isar, ID_AA64ISAR3) }, { .name = "ID_AA64ISAR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 4, .access = PL1_R, .type = ARM_CP_CONST,
@@ -6731,6 +6731,10 @@ void register_cp_regs_for_features(ARMCPU *cpu)R_ID_AA64ISAR2_BC_MASK |R_ID_AA64ISAR2_RPRFM_MASK | R_ID_AA64ISAR2_CSSC_MASK }, + { .name = "ID_AA64ISAR3_EL1", + .exported_bits =R_ID_AA64ISAR3_FAMINMAX_MASK | +R_ID_AA64ISAR3_LSFE_MASK | + R_ID_AA64ISAR3_FPRCVT_MASK }, { .name = "ID_AA64ISAR*_EL1_RESERVED", .is_glob = true }, };
target/arm/cpu-sysregs.h.inc +1 -0
@@ -10,6 +10,7 @@ DEF(ID_AA64AFR1_EL1, 3, 0, 0, 5, 5) DEF(ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) DEF(ID_AA64ISAR1_EL1, 3, 0, 0, 6, 1) DEF(ID_AA64ISAR2_EL1, 3, 0, 0, 6, 2) +DEF(ID_AA64ISAR3_EL1, 3, 0, 0, 6, 3) DEF(ID_AA64MMFR0_EL1, 3, 0, 0, 7, 0) DEF(ID_AA64MMFR1_EL1, 3, 0, 0, 7, 1) DEF(ID_AA64MMFR2_EL1, 3, 0, 0, 7, 2)
Signature · 1 line
2.43.0
PATCH v3 2/47 target/arm: Implement FEAT_FAMINMAX for AdvSIMD
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/helper-a64-defs.h | 7 +++++++ target/arm/tcg/vec_internal.h | 7 +++++++ target/arm/tcg/translate-a64.c | 14 +++++++++++++ target/arm/tcg/vec_helper64.c | 35 ++++++++++++++++++++++++++++++++ target/arm/tcg/a64.decode | 5 +++++ 6 files changed, 73 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1053,6 +1053,11 @@ static inline bool isar_feature_aa64_ats1a(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,ATS1A ); } +static inline bool isar_feature_aa64_faminmax (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64ISAR3 ,FAMINMAX ) !=0 ; +} +static inline bool isar_feature_aa64_fp_simd (const ARMISARegisters *id) {/* We always set the AdvSIMD and FP fields identically. */
target/arm/tcg/helper-a64-defs.h +7 -0
@@ -145,6 +145,13 @@ DEF_HELPER_FLAGS_5(gvec_fmulx_idx_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, DEF_HELPER_FLAGS_5(gvec_fmulx_idx_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_fmulx_idx_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_famax_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_famin_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_famax_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_famin_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_famax_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_famin_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +#ifndef CONFIG_USER_ONLY DEF_HELPER_2(exception_return, void, env, i64)#endif
target/arm/tcg/vec_internal.h +7 -0
@@ -338,6 +338,13 @@ bfloat16 helper_sme2_ah_fmin_b16(bfloat16 a, bfloat16 b, float_status *fpst);float32 sve_f16_to_f32 (float16 f,float_status *fpst);float16 sve_f32_to_f16 (float32 f,float_status *fpst); +float16 float16_famax (float16 ,float16 ,float_status *); +float16 float16_famin (float16 ,float16 ,float_status *); +float32 float32_famax (float32 ,float32 ,float_status *); +float32 float32_famin (float32 ,float32 ,float_status *); +float64 float64_famax (float64 ,float64 ,float_status *); +float64 float64_famin (float64 ,float64 ,float_status *); +/* * Decode helper functions for predicate as counter. */
target/arm/tcg/translate-a64.c +14 -0
@@ -6478,6 +6478,20 @@ static gen_helper_gvec_3_ptr * const f_vector_fminnmp[3] = { }; TRANS(FMINNMP_v, do_fp3_vector, a, 0, f_vector_fminnmp) +static gen_helper_gvec_3_ptr *const f_vector_famax[3 ] = { + gen_helper_gvec_famax_h, + gen_helper_gvec_famax_s, + gen_helper_gvec_famax_d, +}; +TRANS_FEAT(FAMAX, aa64_faminmax, do_fp3_vector, a, 0, f_vector_famax) + +static gen_helper_gvec_3_ptr *const f_vector_famin[3 ] = { + gen_helper_gvec_famin_h, + gen_helper_gvec_famin_s, + gen_helper_gvec_famin_d, +}; +TRANS_FEAT(FAMIN, aa64_faminmax, do_fp3_vector, a, 0, f_vector_famin) +static bool do_fmlal (DisasContext *s,arg_qrrr_e *a,bool is_s,bool is_2) {if (fp_access_check (s)) {
target/arm/tcg/vec_helper64.c +35 -0
@@ -140,3 +140,38 @@ void HELPER(simd_tblx)(void *vd, void *vm, CPUARMState *env, uint32_t desc)memcpy (vd, &result,16 );clear_tail (vd, oprsz,simd_maxsz (desc)); } + +#define DO_FAMINMAX (NAME ,TYPE ,FN ) \ +TYPE TYPE##_##NAME(TYPE a, TYPE b, float_status *s) \ +{ \ + bool save_fz = get_flush_to_zero(s); \ + bool save_fiz = get_flush_inputs_to_zero(s); \ + int new_flags, save_flags = get_float_exception_flags(s); \ + \ + set_flush_to_zero(0, s); \ + set_flush_inputs_to_zero(0, s); \ + TYPE r = TYPE##_##FN(TYPE##_abs(a), TYPE##_abs(b), s); \ + \ + set_flush_to_zero(save_fz, s); \ + set_flush_inputs_to_zero(save_fiz, s); \ + new_flags = get_float_exception_flags(s); \ + new_flags = (save_flags & float_flag_input_denormal_used) \ + | (new_flags & ~float_flag_input_denormal_used); \ + set_float_exception_flags(new_flags, s); \ + \ + return r; \ +} + +DO_FAMINMAX(famax, float16, max) +DO_FAMINMAX(famin, float16, min) +DO_FAMINMAX(famax, float32, max) +DO_FAMINMAX(famin, float32, min) +DO_FAMINMAX(famax, float64, max) +DO_FAMINMAX(famin, float64, min) + +DO_3OP(gvec_famax_h, float16_famax, float16) +DO_3OP(gvec_famin_h, float16_famin, float16) +DO_3OP(gvec_famax_s, float32_famax, float32) +DO_3OP(gvec_famin_s, float32_famin, float32) +DO_3OP(gvec_famax_d, float64_famax, float64) +DO_3OP (gvec_famin_d, float64_famin, float64)
target/arm/tcg/a64.decode +5 -0
@@ -1193,6 +1193,11 @@ RSUBHN 0.10 1110 ..1 ..... 01100 0 ..... ..... @qrrr_e PMULL_p8 0.00 1110 001 ..... 11100 0 ..... ..... @qrrr_b PMULL_p64 0.00 1110 111 ..... 11100 0 ..... ..... @qrrr_b +FAMAX 0.00 1110 110 ..... 00011 1 ..... ..... @qrrr_h +FAMAX 0.00 1110 1.1 ..... 11011 1 ..... ..... @qrrr_sd +FAMIN 0.10 1110 110 ..... 00011 1 ..... ..... @qrrr_h +FAMIN 0.10 1110 1.1 ..... 11011 1 ..... ..... @qrrr_sd + ### Advanced SIMD scalar x indexed element FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
Signature · 1 line
2.43.0
PATCH v3 3/47 target/arm: Implement FEAT_FAMINMAX for SME
In reply to Richard HendersonSince there is no bfloat16 variant of FAMINMAX, check for missing function pointer in do_z2z_nn_fpst.
--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sme.c | 23 +++++++++++++++++++++-- target/arm/tcg/sme.decode | 5 +++++ 3 files changed, 31 insertions(+), 2 deletions(-)
target/arm/cpu-features.h +5 -0
@@ -1579,6 +1579,11 @@ static inline bool isar_feature_aa64_sme2_f64f64(const ARMISARegisters *id)return isar_feature_aa64_sme2 (id) &&isar_feature_aa64_sme_f64f64 (id); } +static inline bool isar_feature_aa64_sme2_faminmax (const ARMISARegisters *id) +{ +return isar_feature_aa64_sme2 (id) &&isar_feature_aa64_faminmax (id); +} +static inline bool isar_feature_aa64_sve_i8mm (const ARMISARegisters *id) {return isar_feature_aa64_sve (id) &&isar_feature_aa64_sme_sve_i8mm (id);
target/arm/tcg/translate-sme.c +21 -2
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "cpu.h" +#include "helper-a64.h" #include "helper-sme.h" #include "helper-sve.h" #include "translate.h"
@@ -742,9 +743,12 @@ static bool do_z2z_nn_fpst(DisasContext *s, arg_z2z_en *a, gen_helper_gvec_3_ptr * const fns[4]) {int esz = a->esz, n, dn, dm, vsz; -gen_helper_gvec_3_ptr *fn; +gen_helper_gvec_3_ptr *fn = fns[esz];TCGv_ptr fpst; +if (fn ==NULL ) { +return false; + }if (esz ==MO_8 && !dc_isar_feature (aa64_sme_b16b16, s)) {return false; }
@@ -753,7 +757,6 @@ static bool do_z2z_nn_fpst(DisasContext *s, arg_z2z_en *a, } fpst =fpstatus_ptr (esz ==MO_16 ?FPST_A64_F16 :FPST_A64 ); - fn = fns[esz]; n = a->n; dn = a->zdn; dm = a->zm;
@@ -812,6 +815,22 @@ static gen_helper_gvec_3_ptr * const f_vector_fminnm[4] = { TRANS_FEAT(FMINNM_n1, aa64_sme2, do_z2z_n1_fpst, a, f_vector_fminnm) TRANS_FEAT(FMINNM_nn, aa64_sme2, do_z2z_nn_fpst, a, f_vector_fminnm) +static gen_helper_gvec_3_ptr *const f_vector_famax[4 ] = { +NULL , + gen_helper_gvec_famax_h, + gen_helper_gvec_famax_s, + gen_helper_gvec_famax_d, +}; +TRANS_FEAT(FAMAX_nn, aa64_sme2_faminmax, do_z2z_nn_fpst, a, f_vector_famax) + +static gen_helper_gvec_3_ptr *const f_vector_famin[4 ] = { +NULL , + gen_helper_gvec_famin_h, + gen_helper_gvec_famin_s, + gen_helper_gvec_famin_d, +}; +TRANS_FEAT (FAMIN_nn, aa64_sme2_faminmax, do_z2z_nn_fpst, a, f_vector_famin) + /* Add/Sub vector Z[m] to each Z[n*N] with result in ZA[d*N]. */static bool do_azz_n1 (DisasContext *s,arg_azz_n *a,int esz,GVecGen3FnVar *fn)
target/arm/tcg/sme.decode +5 -0
@@ -286,6 +286,11 @@ URSHL_nn 1100000 1 .. 1 ..... 1011.0 10001 .... 1 @z2z_4x4 SQDMULH_nn 1100000 1 .. 1 ..... 1011.1 00000 .... 0 @z2z_2x2 SQDMULH_nn 1100000 1 .. 1 ..... 1011.1 00000 .... 0 @z2z_4x4 +FAMAX_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 0 @z2z_2x2 +FAMAX_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 0 @z2z_4x4 +FAMIN_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 1 @z2z_2x2 +FAMIN_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 1 @z2z_4x4 + ### SME2 Multi-vector Multiple and Single Array Vectors &azz_n n off rv zn zm
Signature · 1 line
2.43.0
PATCH v3 4/47 target/arm: Implement FEAT_FAMINMAX for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 11 +++++++++++ target/arm/tcg/helper-sve-defs.h | 14 ++++++++++++++ target/arm/tcg/sve_helper.c | 8 ++++++++ target/arm/tcg/translate-sve.c | 2 ++ target/arm/tcg/sve.decode | 2 ++ 5 files changed, 37 insertions(+)
target/arm/cpu-features.h +11 -0
@@ -1554,6 +1554,11 @@ static inline bool isar_feature_aa64_sme_or_sve2(const ARMISARegisters *id)return isar_feature_aa64_sme (id) ||isar_feature_aa64_sve2 (id); } +static inline bool isar_feature_aa64_sme2_or_sve2 (const ARMISARegisters *id) +{ +return isar_feature_aa64_sme2 (id) ||isar_feature_aa64_sve2 (id); +} +static inline bool isar_feature_aa64_sme_or_sve2p1 (const ARMISARegisters *id) {return isar_feature_aa64_sme (id) ||isar_feature_aa64_sve2p1 (id);
@@ -1594,6 +1599,12 @@ static inline bool isar_feature_aa64_sve_bf16(const ARMISARegisters *id)return isar_feature_aa64_sve (id) &&isar_feature_aa64_sme_sve_bf16 (id); } +static inline bool +isar_feature_aa64_sme2_or_sve2_faminmax (const ARMISARegisters *id) +{ +return isar_feature_aa64_sme2_or_sve2 (id) &&isar_feature_aa64_faminmax (id); +} +/* * Feature tests for "does this exist in either 32-bit or 64-bit?" */
target/arm/tcg/helper-sve-defs.h +14 -0
@@ -3166,3 +3166,17 @@ DEF_HELPER_FLAGS_5(sve2p1_st1ss_le_c, TCG_CALL_NO_WG, void, env, ptr, tl, i32, i DEF_HELPER_FLAGS_5(sve2p1_st1ss_be_c, TCG_CALL_NO_WG, void, env, ptr, tl, i32, i64) DEF_HELPER_FLAGS_5(sve2p1_st1dd_le_c, TCG_CALL_NO_WG, void, env, ptr, tl, i32, i64) DEF_HELPER_FLAGS_5(sve2p1_st1dd_be_c, TCG_CALL_NO_WG, void, env, ptr, tl, i32, i64) + +DEF_HELPER_FLAGS_6 (sve2_famax_h,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6 (sve2_famax_s,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6 (sve2_famax_d,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_6 (sve2_famin_h,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6 (sve2_famin_s,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6 (sve2_famin_d,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, fpst, i32)
target/arm/tcg/sve_helper.c +8 -0
@@ -4742,6 +4742,14 @@ DO_ZPZZ_FP(sve_fmulx_h, uint16_t, H1_2, helper_advsimd_mulxh) DO_ZPZZ_FP(sve_fmulx_s, uint32_t, H1_4, helper_vfp_mulxs) DO_ZPZZ_FP(sve_fmulx_d, uint64_t, H1_8, helper_vfp_mulxd) +DO_ZPZZ_FP(sve2_famax_h, uint16_t, H1_2, float16_famax) +DO_ZPZZ_FP(sve2_famax_s, uint32_t, H1_4, float32_famax) +DO_ZPZZ_FP(sve2_famax_d, uint64_t, H1_8, float64_famax) + +DO_ZPZZ_FP(sve2_famin_h, uint16_t, H1_2, float16_famin) +DO_ZPZZ_FP(sve2_famin_s, uint32_t, H1_4, float32_famin) +DO_ZPZZ_FP(sve2_famin_d, uint64_t, H1_8, float64_famin) +#undef DO_ZPZZ_FP/* Three-operand expander, with one scalar operand, controlled by
target/arm/tcg/translate-sve.c +2 -0
@@ -4253,6 +4253,8 @@ DO_ZPZZ_AH_FP(FABD, aa64_sme_or_sve, sve_fabd, sve_ah_fabd) DO_ZPZZ_FP(FSCALE, aa64_sme_or_sve, sve_fscalbn) DO_ZPZZ_FP(FDIV, aa64_sme_or_sve, sve_fdiv) DO_ZPZZ_FP(FMULX, aa64_sme_or_sve, sve_fmulx) +DO_ZPZZ_FP(FAMAX, aa64_sme2_or_sve2_faminmax, sve2_famax) +DO_ZPZZ_FP(FAMIN, aa64_sme2_or_sve2_faminmax, sve2_famin)typedef void gen_helper_sve_fp2scalar (TCGv_ptr ,TCGv_ptr ,TCGv_ptr ,TCGv_i64 ,TCGv_ptr ,TCGv_i32 );
target/arm/tcg/sve.decode +2 -0
@@ -1130,6 +1130,8 @@ FSCALE 01100101 .. 00 1001 100 ... ..... ..... @rdn_pg_rm FMULX 01100101 .. 00 1010 100 ... ..... ..... @rdn_pg_rm FDIV 01100101 .. 00 1100 100 ... ..... ..... @rdm_pg_rn # FDIVR FDIV 01100101 .. 00 1101 100 ... ..... ..... @rdn_pg_rm +FAMAX 01100101 .. 00 1110 100 ... ..... ..... @rdn_pg_rm +FAMIN 01100101 .. 00 1111 100 ... ..... ..... @rdn_pg_rm # SVE floating-point arithmetic with immediate (predicated) FADD_zpzi 01100101 .. 011 000 100 ... 0000 . ..... @rdn_i1
Signature · 1 line
2.43.0
PATCH v3 5/47 target/arm: Enable FEAT_FAMINMAX for -cpu max
In reply to Richard Henderson--- target/arm/tcg/cpu64.c | 4 ++++ docs/system/arm/emulation.rst | 1 + 2 files changed, 5 insertions(+)
target/arm/tcg/cpu64.c +4 -0
@@ -1266,6 +1266,10 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ISAR2 ,ATS1A ,1 );/* FEAT_ATS1A */ SET_IDREG (isar,ID_AA64ISAR2 , t); + t =GET_IDREG (isar,ID_AA64ISAR3 ); + t =FIELD_DP64 (t,ID_AA64ISAR3 ,FAMINMAX ,1 );/* FEAT_FAMINMAX */ +SET_IDREG (isar,ID_AA64ISAR3 , t); + t =GET_IDREG (isar,ID_AA64PFR0 ); t =FIELD_DP64 (t,ID_AA64PFR0 ,FP ,1 );/* FEAT_FP16 */ t =FIELD_DP64 (t,ID_AA64PFR0 ,ADVSIMD ,1 );/* FEAT_FP16 */
docs/system/arm/emulation.rst +1 -0
@@ -68,6 +68,7 @@ the following architecture extensions: - FEAT_EVT (Enhanced Virtualization Traps) - FEAT_F32MM (Single-precision Matrix Multiplication) - FEAT_F64MM (Double-precision Matrix Multiplication) +- FEAT_FAMINMAX (Floating-point maximum and minimum absolute value instructions) - FEAT_FCMA (Floating-point complex number instructions) - FEAT_FGT (Fine-Grained Traps) - FEAT_FHM (Floating-point half-precision multiplication instructions)
Signature · 1 line
2.43.0
PATCH v3 6/47 target/arm: Update SCR bits for Arm ARM M.a.a
In reply to Richard Henderson--- target/arm/cpu.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
target/arm/cpu.h +11 -0
@@ -1796,6 +1796,17 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)#define SCR_AIEN (1ULL << 46)#define SCR_GPF (1ULL << 48)#define SCR_MECEN (1ULL << 49) +#define SCR_ENFPM (1ULL << 50) +#define SCR_TMEA (1ULL << 51) +#define SCR_TWERR (1ULL << 52) +#define SCR_PFAREN (1ULL << 53) +#define SCR_SRMASKEN (1ULL << 54) +#define SCR_ENIDCP128 (1ULL << 55) +#define SCR_DSE (1ULL << 57) +#define SCR_ENDSE (1ULL << 58) +#define SCR_FGTEN2 (1ULL << 59) +#define SCR_HDBSSEN (1ULL << 60) +#define SCR_HACEBSEN (1ULL << 61)#define SCR_NSE (1ULL << 62)/* GCSCR_ELx fields */
Signature · 1 line
2.43.0
PATCH v3 7/47 target/arm: Update HCRX bits for Arm ARM M.a.a
In reply to Richard Henderson--- target/arm/internals.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/arm/internals.h +3 -1
@@ -258,7 +258,9 @@ FIELD(VSTCR, SA, 30, 1)#define HCRX_TCR2EN (1ULL << 14)#define HCRX_SCTLR2EN (1ULL << 15)#define HCRX_GCSEN (1ULL << 22) - +#define HCRX_ENFPM (1ULL << 23) +#define HCRX_PACMEN (1ULL << 24) +#define HCRX_SRMASKEN (1ULL << 26)#define HPFAR_NS (1ULL << 63)#define HSTR_TTEE (1 << 16)
Signature · 1 line
2.43.0
PATCH v3 8/47 target/arm: Introduce FPMR
In reply to Richard HendersonIntroduce the special register FPMR and its fields. Migrate it when present.
--- target/arm/cpregs.h | 5 +++++ target/arm/cpu-features.h | 5 +++++ target/arm/cpu.h | 1 + target/arm/internals.h | 9 +++++++++ target/arm/helper.c | 12 +++++++++++- target/arm/machine.c | 20 ++++++++++++++++++++ 6 files changed, 51 insertions(+), 1 deletion(-)
target/arm/cpregs.h +5 -0
@@ -149,6 +149,11 @@ enum {* should not trap to EL2 when HCR_EL2.NV is set. */ ARM_CP_NV_NO_TRAP =1 <<22 , +/* +* Flag: Access check for this sysreg is constrained by the +* ARM pseudocode function CheckFPMREnabled(). +*/ + ARM_CP_FPMR = 1 << 23, };/*
target/arm/cpu-features.h +5 -0
@@ -1178,6 +1178,11 @@ static inline bool isar_feature_aa64_gcs(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,GCS ) !=0 ; } +static inline bool isar_feature_aa64_fpmr (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64PFR2 ,FPMR ) !=0 ; +} +static inline bool isar_feature_aa64_tgran4_lpa2 (const ARMISARegisters *id) {return FIELD_SEX64_IDREG (id,ID_AA64MMFR0 ,TGRAN4 ) >=1 ;
target/arm/cpu.h +1 -0
@@ -692,6 +692,7 @@ typedef struct CPUArchState {*/ uint64_t fpsr;uint64_t fpcr; +uint64_t fpmr;uint32_t xregs[16 ];
target/arm/internals.h +9 -0
@@ -292,6 +292,15 @@ FIELD(CNTHCTL, EVNTIS, 17, 1) FIELD(CNTHCTL, CNTVMASK, 18, 1) FIELD(CNTHCTL, CNTPMASK, 19, 1) +FIELD(FPMR, F8S1, 0, 3) +FIELD(FPMR, F8S2, 3, 3) +FIELD(FPMR, F8D, 6, 3) +FIELD(FPMR, OSM, 14, 1) +FIELD(FPMR, OSC, 15, 1) +FIELD(FPMR, LSCALE, 16, 7) +FIELD(FPMR, NSCALE, 24, 8) +FIELD (FPMR ,LSCALE2 ,32 ,6 ) +/* We use a few fake FSR values for internal purposes in M profile. * M profile cores don't have A/R format FSRs, but currently our * get_phys_addr() code assumes A/R profile and reports failures via
target/arm/helper.c +11 -1
@@ -6209,6 +6209,14 @@ static const ARMCPRegInfo aie_reginfo[] = { .type = ARM_CP_CONST, .resetvalue = 0 }, }; +static const ARMCPRegInfo fpmr_reginfo[] = { + { .name ="FPMR" , .state =ARM_CP_STATE_AA64 , + .opc0 =3 , .opc1 =3 , .crn =4 , .crm =4 , .opc2 =2 , + .access =PL0_RW , .type =ARM_CP_FPU |ARM_CP_FPMR , + .fieldoffset = offsetof(CPUARMState, vfp.fpmr), + } +}; +void register_cp_regs_for_features (ARMCPU *cpu) {/* Register all the coprocessor registers based on feature bits */
@@ -7481,10 +7489,12 @@ void register_cp_regs_for_features(ARMCPU *cpu)define_arm_cp_regs (cpu, mec_mte_reginfo); } } -if (cpu_isar_feature (aa64_aie, cpu)) {define_arm_cp_regs (cpu, aie_reginfo); } +if (cpu_isar_feature (aa64_fpmr, cpu)) { +define_arm_cp_regs (cpu, fpmr_reginfo); + }if (cpu_isar_feature (any_predinv, cpu)) {define_arm_cp_regs (cpu, predinv_reginfo);
target/arm/machine.c +20 -0
@@ -960,6 +960,25 @@ static const VMStateDescription vmstate_syndrome64 = { }, }; +static bool fpmr_needed (void *opaque) +{ +ARMCPU *cpu = opaque; + +return arm_feature (&cpu->env,ARM_FEATURE_AARCH64 ) + &&cpu_isar_feature (aa64_fpmr, cpu); +} + +static const VMStateDescription vmstate_fpmr = { + .name ="cpu/fpmr" , + .version_id =1 , + .minimum_version_id =1 , + .needed = fpmr_needed, + .fields = (const VMStateField []) { +VMSTATE_UINT64 (env.vfp.fpmr,ARMCPU ), +VMSTATE_END_OF_LIST () + }, +}; +static int cpu_pre_save (void *opaque) {ARMCPU *cpu = opaque;
@@ -1323,6 +1342,7 @@ const VMStateDescription vmstate_arm_cpu = { &vmstate_syndrome64, &vmstate_pstate64, &vmstate_event, + &vmstate_fpmr, NULL } };
Signature · 1 line
2.43.0
PATCH v3 9/47 target/arm: Update SCTLR bits for FEAT_FPMR
In reply to Richard Henderson--- target/arm/cpu.h | 1 + 1 file changed, 1 insertion(+)
target/arm/cpu.h +1 -0
@@ -1461,6 +1461,7 @@ void pmu_init(ARMCPU *cpu);#define SCTLR_DSSBS_32 (1U << 31)/* v8.5, AArch32 only */ #define SCTLR_CMOW (1ULL << 32)/* FEAT_CMOW */ #define SCTLR_MSCEN (1ULL << 33)/* FEAT_MOPS */ +#define SCTLR_EnFPM (1ULL << 34)/* FEAT_FPMR */ #define SCTLR_BT0 (1ULL << 35)/* v8.5-BTI */ #define SCTLR_BT1 (1ULL << 36)/* v8.5-BTI */ #define SCTLR_ITFSB (1ULL << 37)/* v8.5-MemTag */
Signature · 1 line
2.43.0
PATCH v3 10/47 target/arm: Enable EnFPM bits for FEAT_FPMR
In reply to Richard Henderson--- target/arm/helper.c | 9 +++++++++ 1 file changed, 9 insertions(+)
target/arm/helper.c +9 -0
@@ -787,6 +787,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)if (cpu_isar_feature (aa64_mec, cpu)) { valid_mask |=SCR_MECEN ; } +if (cpu_isar_feature (aa64_fpmr, cpu)) { + valid_mask |=SCR_ENFPM ; + } }else { valid_mask &= ~(SCR_RW |SCR_ST );if (cpu_isar_feature (aa32_ras, cpu)) {
@@ -3953,6 +3956,9 @@ static void hcrx_write(CPUARMState *env, const ARMCPRegInfo *ri,if (cpu_isar_feature (aa64_gcs, cpu)) { valid_mask |=HCRX_GCSEN ; } +if (cpu_isar_feature (aa64_fpmr, cpu)) { + valid_mask |=HCRX_ENFPM ; + }/* Clear RES0 bits. */ env->cp15.hcrx_el2 = value & valid_mask;
@@ -4026,6 +4032,9 @@ uint64_t arm_hcrx_el2_eff(CPUARMState *env)if (cpu_isar_feature (aa64_gcs, cpu)) { hcrx |=HCRX_GCSEN ; } +if (cpu_isar_feature (aa64_fpmr, cpu)) { + hcrx |=HCRX_ENFPM ; + }return hcrx; }if (arm_feature (env,ARM_FEATURE_EL3 ) && !(env->cp15.scr_el3 &SCR_HXEN )) {
Signature · 1 line
2.43.0
PATCH v3 11/47 target/arm: Clear FPMR on ResetSVEState
In reply to Richard HendersonFPMR is cleared when entering or exiting Streaming Mode.
--- target/arm/helper.c | 1 + 1 file changed, 1 insertion(+)
target/arm/helper.c +1 -0
@@ -4836,6 +4836,7 @@ static void arm_reset_sve_state(CPUARMState *env)/* Recall that FFR is stored as pregs[16]. */ memset (env->vfp.pregs,0 ,sizeof (env->vfp.pregs));vfp_set_fpsr (env,0x0800009f ); + env->vfp.fpmr =0 ; }void aarch64_set_svcr (CPUARMState *env,uint64_t new,uint64_t mask)
Signature · 1 line
2.43.0
PATCH v3 12/47 target/arm: Add FPMR_EL to TBFLAGS
In reply to Richard HendersonPrepare to perform access checks for direct and
indirect uses of FPMR.
--- target/arm/cpu.h | 1 + target/arm/tcg/translate.h | 2 ++ target/arm/tcg/hflags.c | 41 ++++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 1 + 4 files changed, 45 insertions(+)
target/arm/cpu.h +1 -0
@@ -2538,6 +2538,7 @@ FIELD(TBFLAG_A64, ZT0EXC_EL, 39, 2) FIELD(TBFLAG_A64, GCS_EN, 41, 1) FIELD(TBFLAG_A64, GCS_RVCEN, 42, 1) FIELD(TBFLAG_A64, GCSSTR_EL, 43, 2) +FIELD (TBFLAG_A64 ,FPMR_EL ,45 ,2 )/* * Helpers for using the above. Note that only the A64 accessors use
target/arm/tcg/translate.h +2 -0
@@ -199,6 +199,8 @@ typedef struct DisasContext {uint8_t gm_blocksize;/* True if the current insn_start has been updated. */ bool insn_start_updated; +/* FMPR exception EL or 0 if enabled. */ +uint8_t fpmr_el;/* Offset from VNCR_EL2 when FEAT_NV2 redirects this reg to memory */ uint32_t nv2_redirect_offset; } DisasContext;
target/arm/tcg/hflags.c +41 -0
53 lines not on this page · raw message
target/arm/tcg/translate-a64.c +1 -0
@@ -10726,6 +10726,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->gcs_en =EX_TBFLAG_A64 (tb_flags,GCS_EN ); dc->gcs_rvcen =EX_TBFLAG_A64 (tb_flags,GCS_RVCEN ); dc->gcsstr_el =EX_TBFLAG_A64 (tb_flags,GCSSTR_EL ); + dc->fpmr_el =EX_TBFLAG_A64 (tb_flags,FPMR_EL ); dc->vec_len =0 ; dc->vec_stride =0 ; dc->cp_regs = arm_cpu->cp_regs;
Signature · 1 line
2.43.0
PATCH v3 13/47 target/arm: Trap direct acceses to FPMR
In reply to Richard Henderson--- target/arm/tcg/translate-a64.c | 4 ++++ 1 file changed, 4 insertions(+)
target/arm/tcg/translate-a64.c +4 -0
@@ -2899,6 +2899,10 @@ static void handle_sys(DisasContext *s, bool isread, }if (!skip_fp_access_checks) { +if ((ri->type &ARM_CP_FPMR ) && s->fpmr_el !=0 ) { +gen_exception_insn_el (s,0 ,EXCP_UDEF , syndrome, s->fpmr_el); +return ; + }if ((ri->type &ARM_CP_FPU ) && !fp_access_check_only (s)) {return ; }else if ((ri->type &ARM_CP_SVE ) && !sve_access_check (s)) {
Signature · 1 line
2.43.0
PATCH v3 14/47 target/arm: Enable FEAT_FPMR for -cpu max
In reply to Richard Henderson--- target/arm/tcg/cpu64.c | 4 ++++ docs/system/arm/emulation.rst | 1 + 2 files changed, 5 insertions(+)
target/arm/tcg/cpu64.c +4 -0
@@ -1297,6 +1297,10 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64PFR1 ,GCS ,1 );/* FEAT_GCS */ SET_IDREG (isar,ID_AA64PFR1 , t); + t =GET_IDREG (isar,ID_AA64PFR2 ); + t =FIELD_DP64 (t,ID_AA64PFR2 ,FPMR ,1 );/* FEAT_FPMR */ +SET_IDREG (isar,ID_AA64PFR2 , t); + t =GET_IDREG (isar,ID_AA64MMFR0 ); t =FIELD_DP64 (t,ID_AA64MMFR0 ,PARANGE ,6 );/* FEAT_LPA: 52 bits */ t =FIELD_DP64 (t,ID_AA64MMFR0 ,TGRAN16 ,1 );/* 16k pages supported */
docs/system/arm/emulation.rst +1 -0
@@ -77,6 +77,7 @@ the following architecture extensions: - FEAT_FPAC (Faulting on AUT* instructions) - FEAT_FPACCOMBINE (Faulting on combined pointer authentication instructions) - FEAT_FPACC_SPEC (Speculative behavior of combined pointer authentication instructions) +- FEAT_FPMR (Floating-point mode register) - FEAT_FRINTTS (Floating-point to integer instructions) - FEAT_FlagM (Flag manipulation instructions v2) - FEAT_FlagM2 (Enhancements to flag manipulation instructions)
Signature · 1 line
2.43.0
PATCH v3 15/47 target/arm: Implement ID_AA64FPFR0
In reply to Richard Henderson--- target/arm/cpu-features.h | 9 +++++++++ target/arm/helper.c | 13 +++++++++++-- target/arm/cpu-sysregs.h.inc | 1 + 3 files changed, 21 insertions(+), 2 deletions(-)
target/arm/cpu-features.h +9 -0
@@ -401,6 +401,15 @@ FIELD(ID_AA64SMFR0, I16I64, 52, 4) FIELD(ID_AA64SMFR0, SMEVER, 56, 4) FIELD(ID_AA64SMFR0, FA64, 63, 1) +FIELD(ID_AA64FPFR0, F8E5M2, 0, 1) +FIELD(ID_AA64FPFR0, F8E4M3, 1, 1) +FIELD(ID_AA64FPFR0, F8MM4, 26, 1) +FIELD(ID_AA64FPFR0, F8MM8, 27, 1) +FIELD(ID_AA64FPFR0, F8DP2, 28, 1) +FIELD(ID_AA64FPFR0, F8DP4, 29, 1) +FIELD(ID_AA64FPFR0, F8FMA, 30, 1) +FIELD(ID_AA64FPFR0, F8CVT, 31, 1) + FIELD(ID_DFR0, COPDBG, 0, 4) FIELD(ID_DFR0, COPSDBG, 4, 4)FIELD (ID_DFR0 ,MMAPDBG ,8 ,4 )
target/arm/helper.c +11 -2
@@ -6456,11 +6456,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid3, .resetvalue = 0 }, - { .name = "ID_AA64PFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, + { .name = "ID_AA64FPFR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid3, - .resetvalue = 0 }, + .resetvalue = GET_IDREG(isar, ID_AA64FPFR0) }, { .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST,
@@ -6691,6 +6691,15 @@ void register_cp_regs_for_features(ARMCPU *cpu)R_ID_AA64SMFR0_I16I64_MASK |R_ID_AA64SMFR0_SMEVER_MASK | R_ID_AA64SMFR0_FA64_MASK }, + { .name = "ID_AA64FPFR0_EL1", + .exported_bits =R_ID_AA64FPFR0_F8E5M2_MASK | +R_ID_AA64FPFR0_F8E4M3_MASK | +R_ID_AA64FPFR0_F8MM4_MASK | +R_ID_AA64FPFR0_F8MM8_MASK | +R_ID_AA64FPFR0_F8DP2_MASK | +R_ID_AA64FPFR0_F8DP4_MASK | +R_ID_AA64FPFR0_F8FMA_MASK | + R_ID_AA64FPFR0_F8CVT_MASK }, { .name = "ID_AA64MMFR0_EL1", .exported_bits = R_ID_AA64MMFR0_ECV_MASK, .fixed_bits = (0xfu << R_ID_AA64MMFR0_TGRAN64_SHIFT) |
target/arm/cpu-sysregs.h.inc +1 -0
@@ -3,6 +3,7 @@ DEF(ID_AA64PFR0_EL1, 3, 0, 0, 4, 0) DEF(ID_AA64PFR1_EL1, 3, 0, 0, 4, 1) DEF(ID_AA64PFR2_EL1, 3, 0, 0, 4, 2) DEF(ID_AA64SMFR0_EL1, 3, 0, 0, 4, 5) +DEF(ID_AA64FPFR0_EL1, 3, 0, 0, 4, 7) DEF(ID_AA64DFR0_EL1, 3, 0, 0, 5, 0) DEF(ID_AA64DFR1_EL1, 3, 0, 0, 5, 1) DEF(ID_AA64AFR0_EL1, 3, 0, 0, 5, 4)
Signature · 1 line
2.43.0
PATCH v3 16/47 target/arm: Add isar_feature_aa64_f8cvt
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ 1 file changed, 5 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1555,6 +1555,11 @@ static inline bool isar_feature_aa64_sme2p1(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,SMEVER ) >=2 ; } +static inline bool isar_feature_aa64_f8cvt (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8CVT ); +} +/* * Combinations of feature tests, for ease of use with TRANS_FEAT. */
Signature · 1 line
2.43.0
PATCH v3 17/47 target/arm: Implement FSCALE for AdvSIMD
In reply to Richard Henderson--- target/arm/tcg/helper-a64-defs.h | 4 ++++ target/arm/tcg/vec_internal.h | 4 ++++ target/arm/tcg/translate-a64.c | 7 +++++++ target/arm/tcg/vec_helper64.c | 16 ++++++++++++++++ target/arm/tcg/a64.decode | 3 +++ 5 files changed, 34 insertions(+)
target/arm/tcg/helper-a64-defs.h +4 -0
@@ -152,6 +152,10 @@ DEF_HELPER_FLAGS_5(gvec_famin_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32 DEF_HELPER_FLAGS_5(gvec_famax_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_famin_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_fscale_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_fscale_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_fscale_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +#ifndef CONFIG_USER_ONLY DEF_HELPER_2(exception_return, void, env, i64)#endif
target/arm/tcg/vec_internal.h +4 -0
@@ -345,6 +345,10 @@ float32 float32_famin(float32, float32, float_status *);float64 float64_famax (float64 ,float64 ,float_status *);float64 float64_famin (float64 ,float64 ,float_status *); +#define float16_fscale float16_scalbn +#define float32_fscale float32_scalbn +float64 float64_fscale (float64 ,int64_t ,float_status *); +/* * Decode helper functions for predicate as counter. */
target/arm/tcg/translate-a64.c +7 -0
@@ -6496,6 +6496,13 @@ static gen_helper_gvec_3_ptr * const f_vector_famin[3] = { }; TRANS_FEAT(FAMIN, aa64_faminmax, do_fp3_vector, a, 0, f_vector_famin) +static gen_helper_gvec_3_ptr *const f_vector_fscale[3 ] = { + gen_helper_gvec_fscale_h, + gen_helper_gvec_fscale_s, + gen_helper_gvec_fscale_d, +}; +TRANS_FEAT(FSCALE, aa64_f8cvt, do_fp3_vector, a, 0, f_vector_fscale) +static bool do_fmlal (DisasContext *s,arg_qrrr_e *a,bool is_s,bool is_2) {if (fp_access_check (s)) {
target/arm/tcg/vec_helper64.c +16 -0
@@ -175,3 +175,19 @@ DO_3OP(gvec_famax_s, float32_famax, float32) DO_3OP(gvec_famin_s, float32_famin, float32) DO_3OP(gvec_famax_d, float64_famax, float64) DO_3OP(gvec_famin_d, float64_famin, float64) + +float64 float64_fscale (float64 n,int64_t m,float_status *s) +{ +/* +* Given the 'int' parameter of float64_scalbn, we have to saturate +* the 'int64_t' parameter of the operation to some value. Since +* float64 has an 11-bit exponent, saturating to 12 bits is sufficient +* to ensure that DBL_TRUE_MIN can be made to overflow. +*/ +int sat_m =MIN (MAX (m,-0xfff ),0xfff ); +return float64_scalbn (n, sat_m, s); +} + +DO_3OP(gvec_fscale_h, float16_fscale, int16_t) +DO_3OP(gvec_fscale_s, float32_fscale, int32_t) +DO_3OP (gvec_fscale_d, float64_fscale, int64_t)
target/arm/tcg/a64.decode +3 -0
@@ -1198,6 +1198,9 @@ FAMAX 0.00 1110 1.1 ..... 11011 1 ..... ..... @qrrr_sd FAMIN 0.10 1110 110 ..... 00011 1 ..... ..... @qrrr_h FAMIN 0.10 1110 1.1 ..... 11011 1 ..... ..... @qrrr_sd +FSCALE 0.10 1110 110 ..... 00111 1 ..... ..... @qrrr_h +FSCALE 0.10 1110 1.1 ..... 11111 1 ..... ..... @qrrr_sd + ### Advanced SIMD scalar x indexed element FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
Signature · 1 line
2.43.0
PATCH v3 18/47 target/arm: Implement FSCALE for SME
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sme.c | 15 +++++++++++++-- target/arm/tcg/sme.decode | 6 ++++++ 3 files changed, 24 insertions(+), 2 deletions(-)
target/arm/cpu-features.h +5 -0
@@ -1608,6 +1608,11 @@ static inline bool isar_feature_aa64_sme2_faminmax(const ARMISARegisters *id)return isar_feature_aa64_sme2 (id) &&isar_feature_aa64_faminmax (id); } +static inline bool isar_feature_aa64_sme2_f8cvt (const ARMISARegisters *id) +{ +return isar_feature_aa64_sme2 (id) &&isar_feature_aa64_f8cvt (id); +} +static inline bool isar_feature_aa64_sve_i8mm (const ARMISARegisters *id) {return isar_feature_aa64_sve (id) &&isar_feature_aa64_sme_sve_i8mm (id);
target/arm/tcg/translate-sme.c +13 -2
@@ -707,9 +707,12 @@ static bool do_z2z_n1_fpst(DisasContext *s, arg_z2z_en *a, {int esz = a->esz, n, dn, vsz, mofs;bool overlap = false; -gen_helper_gvec_3_ptr *fn; +gen_helper_gvec_3_ptr *fn = fns[esz];TCGv_ptr fpst; +if (fn ==NULL ) { +return false; + }/* These insns use MO_8 to encode BFloat16. */ if (esz ==MO_8 && !dc_isar_feature (aa64_sme_b16b16, s)) {return false;
@@ -719,7 +722,6 @@ static bool do_z2z_n1_fpst(DisasContext *s, arg_z2z_en *a, } fpst =fpstatus_ptr (esz ==MO_16 ?FPST_A64_F16 :FPST_A64 ); - fn = fns[esz]; n = a->n; dn = a->zdn; mofs =vec_full_reg_offset (s, a->zm);
@@ -831,6 +833,15 @@ static gen_helper_gvec_3_ptr * const f_vector_famin[4] = { }; TRANS_FEAT(FAMIN_nn, aa64_sme2_faminmax, do_z2z_nn_fpst, a, f_vector_famin) +static gen_helper_gvec_3_ptr *const f_vector_fscale[4 ] = { +NULL , + gen_helper_gvec_fscale_h, + gen_helper_gvec_fscale_s, + gen_helper_gvec_fscale_d, +}; +TRANS_FEAT(FSCALE_n1, aa64_sme2_f8cvt, do_z2z_n1_fpst, a, f_vector_fscale) +TRANS_FEAT (FSCALE_nn, aa64_sme2_f8cvt, do_z2z_nn_fpst, a, f_vector_fscale) + /* Add/Sub vector Z[m] to each Z[n*N] with result in ZA[d*N]. */static bool do_azz_n1 (DisasContext *s,arg_azz_n *a,int esz,GVecGen3FnVar *fn)
target/arm/tcg/sme.decode +6 -0
@@ -250,6 +250,9 @@ ADD_n1 1100000 1 .. 10 .... 1010.0 11000 .... 0 @z2z_4x1 SQDMULH_n1 1100000 1 .. 10 .... 1010.1 00000 .... 0 @z2z_2x1 SQDMULH_n1 1100000 1 .. 10 .... 1010.1 00000 .... 0 @z2z_4x1 +FSCALE_n1 1100000 1 .. 10 .... 1010.0 01100 .... 0 @z2z_2x1 +FSCALE_n1 1100000 1 .. 10 .... 1010.0 01100 .... 0 @z2z_4x1 + ### SME2 Multi-vector Multiple Vectors SVE Destructive %zm_ax2 17:4 !function=times_2
@@ -291,6 +294,9 @@ FAMAX_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 0 @z2z_4x4 FAMIN_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 1 @z2z_2x2 FAMIN_nn 1100000 1 .. 1 ..... 1011.0 01010 .... 1 @z2z_4x4 +FSCALE_nn 1100000 1 .. 1 ..... 1011.0 01100 .... 0 @z2z_2x2 +FSCALE_nn 1100000 1 .. 1 ..... 1011.0 01100 .... 0 @z2z_4x4 + ### SME2 Multi-vector Multiple and Single Array Vectors &azz_n n off rv zn zm
Signature · 1 line
2.43.0
PATCH v3 19/47 target/arm: Split vector-type.h from cpu.h
In reply to Richard HendersonWe want to be able to reference ARMVectorType etc from common code, so move it out of cpu.h.
--- target/arm/cpu.h | 38 +--------------------------------- target/arm/vector-type.h | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 37 deletions(-) create mode 100644 target/arm/vector-type.h
target/arm/cpu.h +1 -37
@@ -35,6 +35,7 @@#include "target/arm/gtimer.h" #include "target/arm/cpu-sysregs.h" #include "target/arm/mmuidx.h" +#include "target/arm/vector-type.h" #define EXCP_UDEF 1/* undefined instruction */ #define EXCP_SWI 2/* software interrupt */
@@ -140,43 +141,6 @@ typedef struct ARMGenericTimer {uint64_t ctl;/* Timer Control register */ } ARMGenericTimer; -/* Define a maximum sized vector register. -* For 32-bit, this is a 128-bit NEON/AdvSIMD register. -* For 64-bit, this is a 2048-bit SVE register. -* -* Note that the mapping between S, D, and Q views of the register bank -* differs between AArch64 and AArch32. -* In AArch32: -* Qn = regs[n].d[1]:regs[n].d[0] -* Dn = regs[n / 2].d[n & 1] -* Sn = regs[n / 4].d[n % 4 / 2], -* bits 31..0 for even n, and bits 63..32 for odd n -* (and regs[16] to regs[31] are inaccessible) -* In AArch64: -* Zn = regs[n].d[*] -* Qn = regs[n].d[1]:regs[n].d[0] -* Dn = regs[n].d[0] -* Sn = regs[n].d[0] bits 31..0 -* Hn = regs[n].d[0] bits 15..0 -* -* This corresponds to the architecturally defined mapping between -* the two execution states, and means we do not need to explicitly -* map these registers when changing states. -* -* Align the data for use with TCG host vector operations. -*/ - -#define ARM_MAX_VQ 16 - -typedef struct ARMVectorReg { - uint64_t d[2 * ARM_MAX_VQ] QEMU_ALIGNED(16); -}ARMVectorReg ; - -/* In AArch32 mode, predicate registers do not exist at all. */ -typedef struct ARMPredicateReg { - uint64_t p[DIV_ROUND_UP(2 * ARM_MAX_VQ, 8)] QEMU_ALIGNED(16); -}ARMPredicateReg ; -/* In AArch32 mode, PAC keys do not exist at all. */ typedef struct ARMPACKey { uint64_t lo, hi;
target/arm/vector-type.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v3 20/47 target/arm: Move vectors_overlap to vec_internal.h
In reply to Richard HendersonWe will shortly need this outside of sme_helper.c.
--- target/arm/tcg/vec_internal.h | 8 ++++++++ target/arm/tcg/sme_helper.c | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-)
target/arm/tcg/vec_internal.h +8 -0
@@ -21,6 +21,7 @@#define TARGET_ARM_VEC_INTERNAL_H #include "fpu/softfloat.h" +#include "vector-type.h" typedef struct CPUArchState CPUARMState ;
@@ -457,6 +458,13 @@ static inline void depositn(uint64_t *p, unsigned pos, } } +/* Determine if [x, x+nx) overlaps [y, y+ny). */ +static inline bool vectors_overlap (ARMVectorReg *x,unsigned nx, +ARMVectorReg *y,unsigned ny) +{ +return !(x + nx <= y || y + ny <= x); +} +#define DO_3OP (NAME ,FUNC ,TYPE ) \ void HELPER(NAME)(void *vd, void *vn, void *vm, \ float_status * stat, uint32_t desc) \
target/arm/tcg/sme_helper.c +0 -6
@@ -34,12 +34,6 @@#define HELPER_H "tcg/helper-sme-defs.h"#include "exec/helper-info.c.inc" -static bool vectors_overlap (ARMVectorReg *x,unsigned nx, -ARMVectorReg *y,unsigned ny) -{ -return !(x + nx <= y || y + ny <= x); -} -void helper_set_svcr (CPUARMState *env,uint32_t val,uint32_t mask) {aarch64_set_svcr (env, val, mask);
Signature · 1 line
2.43.0
PATCH v3 21/47 target/arm: Implement BF1CVTL, BF1CVTL2, BF2CVTL, BF2CVTL2 for AdvSIMD
In reply to Richard Henderson--- target/arm/helper-fp8.h | 14 ++++ target/arm/tcg/helper-fp8-defs.h | 6 ++ target/arm/tcg/translate-a64.h | 1 + target/arm/tcg/fp8_helper.c | 138 +++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 34 ++++++++ target/arm/tcg/a64.decode | 3 + target/arm/tcg/meson.build | 1 + 7 files changed, 197 insertions(+) create mode 100644 target/arm/helper-fp8.h create mode 100644 target/arm/tcg/helper-fp8-defs.h create mode 100644 target/arm/tcg/fp8_helper.c
target/arm/helper-fp8.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef HELPER_FP8_H +#define HELPER_FP8_H + +#include "exec/helper-proto-common.h" +#include "exec/helper-gen-common.h" + +#define HELPER_H "tcg/helper-fp8-defs.h" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H + +#endif /* HELPER_FP8_H */
target/arm/tcg/helper-fp8-defs.h new file +6 -0
@@ -0,0 +1,6 @@ +/* +* AArch64 FP8 helper definitions +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +DEF_HELPER_FLAGS_4 (advsimd_bfcvtl,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/translate-a64.h +1 -0
@@ -25,6 +25,7 @@ TCGv_i64 read_cpu_reg_sp(DisasContext *s, int reg, int sf);void write_fp_dreg (DisasContext *s,int reg,TCGv_i64 v);bool logic_imm_decode_wmask (uint64_t *result,unsigned int immn,unsigned int imms,unsigned int immr); +bool fpmr_access_check (DisasContext *s);bool sve_access_check (DisasContext *s);bool sme_enabled_check (DisasContext *s);bool sme_enabled_check_with_svcr (DisasContext *s,unsigned );
target/arm/tcg/fp8_helper.c new file +138 -0
138 lines not on this page · raw message
target/arm/tcg/translate-a64.c +34 -0
@@ -22,6 +22,7 @@#include "helper-a64.h" #include "helper-sme.h" #include "helper-sve.h" +#include "helper-fp8.h" #include "translate.h" #include "translate-a64.h" #include "tcg/tcg-op.h"
@@ -1457,6 +1458,24 @@ static bool fp_access_check(DisasContext *s)return fp_access_check_only (s) &&nonstreaming_check (s); } +/* +* Check that FPMR access is enabled, for an indirect reference by a +* vector instruction. See CheckFPMREnabled(). +*/ +bool fpmr_access_check (DisasContext *s) +{ +if (s->fpmr_el) { +/* +* While denied direct access to the FPMR raises SystemRegisterTrap +* and targets a specific EL, denied indirect access to the FPMR +* results in a simple UNDEFINED to the default exception level. +*/ +unallocated_encoding (s); +return false; + } +return true; +} +/* * Return <0 for non-supported element sizes, with MO_16 controlled by * FEAT_FP16; return 0 for fp disabled; otherwise return >0 for success.
@@ -10612,6 +10631,21 @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)return true; } +static bool do_f8cvt (DisasContext *s,arg_qrr_e *a, +gen_helper_gvec_2_ptr *fn,bool issrc2) +{ +if (fpmr_access_check (s) &&fp_access_check (s)) { +tcg_gen_gvec_2_ptr (vec_full_reg_offset (s, a->rd), +vec_full_reg_offset (s, a->rn), + tcg_env,16 ,vec_full_reg_size (s), + issrc2 | (a->q <<1 ) | (FPST_A64 <<2 ), fn); + } +return true; +} + +TRANS_FEAT(BF1CVTL, aa64_f8cvt, do_f8cvt, a, gen_helper_advsimd_bfcvtl, false) +TRANS_FEAT(BF2CVTL, aa64_f8cvt, do_f8cvt, a, gen_helper_advsimd_bfcvtl, true) +static bool trans_OK (DisasContext *s,arg_OK *a) {return true;
target/arm/tcg/a64.decode +3 -0
@@ -1910,6 +1910,9 @@ URSQRTE_v 0.10 1110 101 00001 11001 0 ..... ..... @qrr_s FCVTL_v 0.00 1110 0.1 00001 01111 0 ..... ..... @qrr_sd +BF1CVTL 0.10 1110 101 00001 01111 0 ..... ..... @qrr_h +BF2CVTL 0.10 1110 111 00001 01111 0 ..... ..... @qrr_h + &fcvt_q rd rn esz q shift @fcvtq_h . q:1 . ...... 001 .... ...... rn:5 rd:5 \ &fcvt_q esz=1 shift=%fcvt_f_sh_h
target/arm/tcg/meson.build +1 -0
@@ -46,6 +46,7 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'sme_helper.c', 'sve_helper.c', 'vec_helper64.c', + 'fp8_helper.c', )) arm_common_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c'))
Signature · 1 line
2.43.0
PATCH v3 22/47 target/arm: Implement BF1CVT, BF1CVTLT, BF2CVT, BF2CVTLT for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 6 ++++++ target/arm/tcg/helper-fp8-defs.h | 1 + target/arm/tcg/fp8_helper.c | 28 ++++++++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 23 +++++++++++++++++++++++ target/arm/tcg/sve.decode | 6 ++++++ 5 files changed, 64 insertions(+)
target/arm/cpu-features.h +6 -0
@@ -1629,6 +1629,12 @@ isar_feature_aa64_sme2_or_sve2_faminmax(const ARMISARegisters *id)return isar_feature_aa64_sme2_or_sve2 (id) &&isar_feature_aa64_faminmax (id); } +static inline bool +isar_feature_aa64_sme2_or_sve2_f8cvt (const ARMISARegisters *id) +{ +return isar_feature_aa64_sme2_or_sve2 (id) &&isar_feature_aa64_f8cvt (id); +} +/* * Feature tests for "does this exist in either 32-bit or 64-bit?" */
target/arm/tcg/helper-fp8-defs.h +1 -0
@@ -4,3 +4,4 @@*/ DEF_HELPER_FLAGS_4(advsimd_bfcvtl, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4 (sve2_bfcvt,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +28 -0
@@ -136,3 +136,31 @@ void HELPER(advsimd_bfcvtl)(void *vd, void *vn, CPUARMState *env, uint32_t desc)fp8_finish (env, &ctx);clear_tail (vd,16 ,simd_maxsz (desc)); } + +void HELPER (sve2_bfcvt )(void *vd,void *vn,CPUARMState *env,uint32_t desc) +{ +FP8Context ctx =fp8_src_start (env, desc,0x3f ); +uint8_t *n = vn; +uint16_t *d = vd; +size_t nelem =simd_oprsz (desc) /2 ; + +switch (ctx.f8fmt) { +case OFP8_E5M2 : +for (size_t i =0 ; i < nelem; ++i) { +float8_e5m2 e = n[H1 (2 * i + ctx.high)]; + d[H2 (i)] =fcvt_fp8e5m2_to_b16 (e, ctx.scale, &ctx.stat); + } +break ; +case OFP8_E4M3 : +for (size_t i =0 ; i < nelem; ++i) { +float8_e4m3 e = n[H1 (2 * i + ctx.high)]; + d[H2 (i)] =fcvt_fp8e4m3_to_b16 (e, ctx.scale, &ctx.stat); + } +break ; +default : +bfloat16_invalid_input (d, nelem, &ctx.stat); +break ; + } + +fp8_finish (env, &ctx); +}
target/arm/tcg/translate-sve.c +23 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "helper-sme.h" #include "helper-sve.h" +#include "helper-fp8.h" #include "translate.h" #include "translate-a64.h" #include "tcg/tcg-op.h"
@@ -4067,6 +4068,28 @@ TRANS_FEAT(FRSQRTE, aa64_sme_or_sve, gen_gvec_fpst_ah_arg_zz, s->fpcr_ah && dc_isar_feature(aa64_rpres, s) ? frsqrte_rpres_fns[a->esz] : frsqrte_fns[a->esz], a, 0) +static bool do_f8cvt (DisasContext *s,arg_rr_esz *a, +gen_helper_gvec_2_ptr *fn,bool issrc2,bool isodd) +{ +if (fpmr_access_check (s) &&sve_access_check (s)) { +unsigned vsz =vec_full_reg_size (s); +tcg_gen_gvec_2_ptr (vec_full_reg_offset (s, a->rd), +vec_full_reg_offset (s, a->rn), + tcg_env, vsz, vsz, + issrc2 | (isodd <<1 ) | (FPST_A64 <<2 ), fn); + } +return true; +} + +TRANS_FEAT (BF1CVT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_bfcvt, false, false) +TRANS_FEAT (BF2CVT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_bfcvt, true, false) +TRANS_FEAT (BF1CVTLT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_bfcvt, false, true) +TRANS_FEAT (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_bfcvt, true, true) +/* *** SVE Floating Point Compare with Zero Group */
target/arm/tcg/sve.decode +6 -0
@@ -108,6 +108,7 @@ # Two operand @pd_pn ........ esz:2 .. .... ....... rn:4 . rd:4 &rr_esz @rd_rn ........ esz:2 ...... ...... rn:5 rd:5 &rr_esz +@rd_rn_e0 ........ .. ...... ...... rn:5 rd:5 &rr_esz esz=0 @rd_rnx2 ........ ... ..... ...... ..... rd:5 &rr_esz rn=%rn_ax2 # Two operand with governing predicate, flags setting
@@ -1090,6 +1091,11 @@ FMINQV 01100100 .. 010 111 101 ... ..... ..... @rd_pg_rn FRECPE 01100101 .. 001 110 001100 ..... ..... @rd_rn FRSQRTE 01100101 .. 001 111 001100 ..... ..... @rd_rn +BF1CVT 01100101 00 001 000 001110 ..... ..... @rd_rn_e0 +BF2CVT 01100101 00 001 000 001111 ..... ..... @rd_rn_e0 +BF1CVTLT 01100101 00 001 001 001110 ..... ..... @rd_rn_e0 +BF2CVTLT 01100101 00 001 001 001111 ..... ..... @rd_rn_e0 + ### SVE FP Compare with Zero Group FCMGE_ppz0 01100101 .. 0100 00 001 ... ..... 0 .... @pd_pg_rn
Signature · 1 line
2.43.0
PATCH v3 23/47 target/arm: Rename SME BFCVT patterns to BFCVT_hs
In reply to Richard HendersonThe existing pattern is BFCVT (single-precision to BFloat16). In preparation for introducing more insns of the same name, append the operand sizes.
--- target/arm/tcg/helper-sme-defs.h | 2 +- target/arm/tcg/sme_helper.c | 2 +- target/arm/tcg/translate-sme.c | 4 ++-- target/arm/tcg/sme.decode | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
target/arm/tcg/helper-sme-defs.h +1 -1
@@ -250,7 +250,7 @@ DEF_HELPER_FLAGS_5(sme2_umlsll_idx_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, DEF_HELPER_FLAGS_5(sme2_usmlall_idx_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sme2_sumlall_idx_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sme2_bfcvt, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(sme2_bfcvt_hs, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(sme2_bfcvtn, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(sme2_fcvt_n, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32)DEF_HELPER_FLAGS_4 (sme2_fcvtn,TCG_CALL_NO_RWG , void, ptr, ptr, fpst, i32)
target/arm/tcg/sme_helper.c +1 -1
@@ -1726,7 +1726,7 @@ DO_MLALL_IDX(sme2_sumlall_idx_s, uint32_t, int8_t, uint8_t, H4, H1, +)#undef DO_MLALL_IDX/* Convert and compress */ -void HELPER (sme2_bfcvt )(void *vd,void *vs,float_status *fpst,uint32_t desc) +void HELPER (sme2_bfcvt_hs )(void *vd,void *vs,float_status *fpst,uint32_t desc) {ARMVectorReg scratch;size_t oprsz =simd_oprsz (desc);
target/arm/tcg/translate-sme.c +2 -2
@@ -1448,8 +1448,8 @@ static bool do_zz_fpst(DisasContext *s, arg_zz_n *a, int data,return true; } -TRANS_FEAT (BFCVT , aa64_sme2, do_zz_fpst, a,0 , - FPST_A64, gen_helper_sme2_bfcvt) +TRANS_FEAT (BFCVT_hs, aa64_sme2, do_zz_fpst, a,0 , + FPST_A64, gen_helper_sme2_bfcvt_hs)TRANS_FEAT (BFCVTN , aa64_sme2, do_zz_fpst, a,0 , FPST_A64, gen_helper_sme2_bfcvtn) TRANS_FEAT(FCVT_n, aa64_sme2, do_zz_fpst, a, 0,
target/arm/tcg/sme.decode +1 -1
@@ -789,7 +789,7 @@ SUB_aaz_d 11000001 111 000010 .. 111 ...00 11 ... @az_4x4_o3 @zz_4x2_n1 ........ ... ..... ...... .... . ..... \ &zz_n n=1 zd=%zd_ax4 zn=%zn_ax2 -BFCVT 11000001 011 00000 111000 ....0 ..... @zz_1x2 +BFCVT_hs 11000001 011 00000 111000 ....0 ..... @zz_1x2 BFCVTN 11000001 011 00000 111000 ....1 ..... @zz_1x2 FCVT_n 11000001 001 00000 111000 ....0 ..... @zz_1x2
Signature · 1 line
2.43.0
PATCH v3 24/47 target/arm: Implement BF1CVT, BF1CVTL, BF2CVT, BF2CVTL for SME
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 + target/arm/tcg/fp8_helper.c | 79 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 19 ++++++++ target/arm/tcg/sme.decode | 5 ++ 4 files changed, 105 insertions(+)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -5,3 +5,5 @@ DEF_HELPER_FLAGS_4(advsimd_bfcvtl, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_bfcvt, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4(sme2_bfcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4 (sme2_bfcvtl_hb,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +79 -0
82 lines not on this page · raw message
target/arm/tcg/translate-sme.c +19 -0
@@ -22,6 +22,7 @@#include "helper-a64.h" #include "helper-sme.h" #include "helper-sve.h" +#include "helper-fp8.h" #include "translate.h" #include "translate-a64.h" #include "tcg/tcg-op.h"
@@ -1532,6 +1533,24 @@ TRANS_FEAT(UUNPK_4bh, aa64_sme2, do_zz, a, 0, gen_helper_sme2_uunpk4_bh) TRANS_FEAT(UUNPK_4hs, aa64_sme2, do_zz, a, 0, gen_helper_sme2_uunpk4_hs) TRANS_FEAT(UUNPK_4sd, aa64_sme2, do_zz, a, 0, gen_helper_sme2_uunpk4_sd) +static bool do_f8cvt (DisasContext *s,arg_zz_n *a, +gen_helper_gvec_2_ptr *fn,bool issrc2) +{ +if (fpmr_access_check (s) &&sme_sm_enabled_check (s)) { +int svl =streaming_vec_reg_size (s); +tcg_gen_gvec_2_ptr (vec_full_reg_offset (s, a->zd), +vec_full_reg_offset (s, a->zn), + tcg_env, svl, svl, + issrc2 | (FPST_ZA <<2 ), fn); + } +return true; +} + +TRANS_FEAT(BF1CVT, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvt_hb, 0) +TRANS_FEAT(BF2CVT, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvt_hb, 1) +TRANS_FEAT(BF1CVTL, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvtl_hb, 0) +TRANS_FEAT(BF2CVTL, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvtl_hb, 1) +static bool do_zipuzp_4 (DisasContext *s,arg_zz_e *a,gen_helper_gvec_2 *const fn[5 ]) {
target/arm/tcg/sme.decode +5 -0
@@ -853,6 +853,11 @@ UUNPK_4bh 11000001 011 10101 111000 ....0 ...01 @zz_4x2_n1 UUNPK_4hs 11000001 101 10101 111000 ....0 ...01 @zz_4x2_n1 UUNPK_4sd 11000001 111 10101 111000 ....0 ...01 @zz_4x2_n1 +BF1CVT 11000001 011 00110 111000 ..... ....0 @zz_2x1 +BF2CVT 11000001 111 00110 111000 ..... ....0 @zz_2x1 +BF1CVTL 11000001 011 00110 111000 ..... ....1 @zz_2x1 +BF2CVTL 11000001 111 00110 111000 ..... ....1 @zz_2x1 + ZIP_4 11000001 esz:2 1 10110 111000 ...00 ... 00 \ &zz_e zd=%zd_ax4 zn=%zn_ax4 ZIP_4 11000001 001 10111 111000 ...00 ... 00 \
Signature · 1 line
2.43.0
PATCH v3 25/47 target/arm: Implement F1CVTL, F1CVTL2, F2CVTL, F2CVTL2 for AdvSIMD
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 ++ target/arm/tcg/fp8_helper.c | 56 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 3 ++ target/arm/tcg/a64.decode | 3 ++ 4 files changed, 64 insertions(+)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -7,3 +7,5 @@ DEF_HELPER_FLAGS_4(advsimd_bfcvtl, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_bfcvt, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_bfcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_bfcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_4 (advsimd_fcvtl_hb,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +56 -0
74 lines not on this page · raw message
target/arm/tcg/translate-a64.c +3 -0
@@ -10643,6 +10643,9 @@ static bool do_f8cvt(DisasContext *s, arg_qrr_e *a,return true; } +TRANS_FEAT(F1CVTL, aa64_f8cvt, do_f8cvt, a, gen_helper_advsimd_fcvtl_hb, false) +TRANS_FEAT(F2CVTL, aa64_f8cvt, do_f8cvt, a, gen_helper_advsimd_fcvtl_hb, true) + TRANS_FEAT(BF1CVTL, aa64_f8cvt, do_f8cvt, a, gen_helper_advsimd_bfcvtl, false)TRANS_FEAT (BF2CVTL , aa64_f8cvt, do_f8cvt, a, gen_helper_advsimd_bfcvtl, true)
target/arm/tcg/a64.decode +3 -0
@@ -1910,6 +1910,9 @@ URSQRTE_v 0.10 1110 101 00001 11001 0 ..... ..... @qrr_s FCVTL_v 0.00 1110 0.1 00001 01111 0 ..... ..... @qrr_sd +F1CVTL 0.10 1110 001 00001 01111 0 ..... ..... @qrr_h +F2CVTL 0.10 1110 011 00001 01111 0 ..... ..... @qrr_h + BF1CVTL 0.10 1110 101 00001 01111 0 ..... ..... @qrr_h BF2CVTL 0.10 1110 111 00001 01111 0 ..... ..... @qrr_h
Signature · 1 line
2.43.0
PATCH v3 26/47 target/arm: Implement F1CVT, F1CVTLT, F2CVT, F2CVTLT for SVE
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 1 + target/arm/tcg/fp8_helper.c | 28 ++++++++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 9 +++++++++ target/arm/tcg/sve.decode | 5 +++++ 4 files changed, 43 insertions(+)
target/arm/tcg/helper-fp8-defs.h +1 -0
@@ -9,3 +9,4 @@ DEF_HELPER_FLAGS_4(sme2_bfcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_bfcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(advsimd_fcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4 (sve2_fcvt_hb,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +28 -0
@@ -221,6 +221,34 @@ void HELPER(sve2_bfcvt)(void *vd, void *vn, CPUARMState *env, uint32_t desc)fp8_finish (env, &ctx); } +void HELPER (sve2_fcvt_hb )(void *vd,void *vn,CPUARMState *env,uint32_t desc) +{ +FP8Context ctx =fp8_src_start (env, desc,0xf ); +uint8_t *n = vn; +uint16_t *d = vd; +size_t nelem =simd_oprsz (desc) /2 ; + +switch (ctx.f8fmt) { +case OFP8_E5M2 : +for (size_t i =0 ; i < nelem; ++i) { +float8_e5m2 e = n[H1 (2 * i + ctx.high)]; + d[H2 (i)] =fcvt_fp8e5m2_to_f16 (e, ctx.scale, &ctx.stat); + } +break ; +case OFP8_E4M3 : +for (size_t i =0 ; i < nelem; ++i) { +float8_e4m3 e = n[H1 (2 * i + ctx.high)]; + d[H2 (i)] =fcvt_fp8e4m3_to_f16 (e, ctx.scale, &ctx.stat); + } +break ; +default : +float16_invalid_input (d, nelem, &ctx.stat); +break ; + } + +fp8_finish (env, &ctx); +} +void HELPER (sme2_bfcvt_hb )(void *vd,void *vn,CPUARMState *env,uint32_t desc) {FP8Context ctx =fp8_src_start (env, desc,0x3f );
target/arm/tcg/translate-sve.c +9 -0
@@ -4081,6 +4081,15 @@ static bool do_f8cvt(DisasContext *s, arg_rr_esz *a,return true; } +TRANS_FEAT (F1CVT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_fcvt_hb, false, false) +TRANS_FEAT (F2CVT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_fcvt_hb, true, false) +TRANS_FEAT (F1CVTLT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_fcvt_hb, false, true) +TRANS_FEAT (F2CVTLT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, + gen_helper_sve2_fcvt_hb, true, true) +TRANS_FEAT (BF1CVT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, gen_helper_sve2_bfcvt, false, false) TRANS_FEAT(BF2CVT, aa64_sme2_or_sve2_f8cvt, do_f8cvt, a,
target/arm/tcg/sve.decode +5 -0
@@ -1091,6 +1091,11 @@ FMINQV 01100100 .. 010 111 101 ... ..... ..... @rd_pg_rn FRECPE 01100101 .. 001 110 001100 ..... ..... @rd_rn FRSQRTE 01100101 .. 001 111 001100 ..... ..... @rd_rn +F1CVT 01100101 00 001 000 001100 ..... ..... @rd_rn_e0 +F2CVT 01100101 00 001 000 001101 ..... ..... @rd_rn_e0 +F1CVTLT 01100101 00 001 001 001100 ..... ..... @rd_rn_e0 +F2CVTLT 01100101 00 001 001 001101 ..... ..... @rd_rn_e0 + BF1CVT 01100101 00 001 000 001110 ..... ..... @rd_rn_e0 BF2CVT 01100101 00 001 000 001111 ..... ..... @rd_rn_e0 BF1CVTLT 01100101 00 001 001 001110 ..... ..... @rd_rn_e0
Signature · 1 line
2.43.0
PATCH v3 27/47 target/arm: Implement F1CVT, F1CVTL, F2CVT, F2CVTL for SME
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 + target/arm/tcg/fp8_helper.c | 79 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 5 ++ target/arm/tcg/sme.decode | 5 ++ 4 files changed, 91 insertions(+)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -10,3 +10,5 @@ DEF_HELPER_FLAGS_4(sme2_bfcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(advsimd_fcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_fcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4(sme2_fcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4 (sme2_fcvtl_hb,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +79 -0
88 lines not on this page · raw message
target/arm/tcg/translate-sme.c +5 -0
@@ -1546,6 +1546,11 @@ static bool do_f8cvt(DisasContext *s, arg_zz_n *a,return true; } +TRANS_FEAT(F1CVT, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_fcvt_hb, 0) +TRANS_FEAT(F2CVT, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_fcvt_hb, 1) +TRANS_FEAT(F1CVTL, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_fcvtl_hb, 0) +TRANS_FEAT(F2CVTL, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_fcvtl_hb, 1) + TRANS_FEAT(BF1CVT, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvt_hb, 0) TRANS_FEAT(BF2CVT, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvt_hb, 1)TRANS_FEAT (BF1CVTL , aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvtl_hb,0 )
target/arm/tcg/sme.decode +5 -0
@@ -853,6 +853,11 @@ UUNPK_4bh 11000001 011 10101 111000 ....0 ...01 @zz_4x2_n1 UUNPK_4hs 11000001 101 10101 111000 ....0 ...01 @zz_4x2_n1 UUNPK_4sd 11000001 111 10101 111000 ....0 ...01 @zz_4x2_n1 +F1CVT 11000001 001 00110 111000 ..... ....0 @zz_2x1 +F2CVT 11000001 101 00110 111000 ..... ....0 @zz_2x1 +F1CVTL 11000001 001 00110 111000 ..... ....1 @zz_2x1 +F2CVTL 11000001 101 00110 111000 ..... ....1 @zz_2x1 + BF1CVT 11000001 011 00110 111000 ..... ....0 @zz_2x1 BF2CVT 11000001 111 00110 111000 ..... ....0 @zz_2x1 BF1CVTL 11000001 011 00110 111000 ..... ....1 @zz_2x1
Signature · 1 line
2.43.0
PATCH v3 28/47 target/arm: Implement BFCVTN for SVE
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 + target/arm/tcg/fp8_helper.c | 96 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 3 + target/arm/tcg/sve.decode | 2 + 4 files changed, 103 insertions(+)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -12,3 +12,5 @@ DEF_HELPER_FLAGS_4(advsimd_fcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_fcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_fcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_fcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_4 (sve2_bfcvtn_bh,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +96 -0
117 lines not on this page · raw message
target/arm/tcg/translate-sve.c +3 -0
@@ -4099,6 +4099,9 @@ TRANS_FEAT(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, do_f8cvt, a,TRANS_FEAT (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, gen_helper_sve2_bfcvt, true, true) +TRANS_FEAT (BFCVTN , aa64_sme2_or_sve2_f8cvt, do_f8cvt, + a, gen_helper_sve2_bfcvtn_bh, false, false) +/* *** SVE Floating Point Compare with Zero Group */
target/arm/tcg/sve.decode +2 -0
@@ -1101,6 +1101,8 @@ BF2CVT 01100101 00 001 000 001111 ..... ..... @rd_rn_e0 BF1CVTLT 01100101 00 001 001 001110 ..... ..... @rd_rn_e0 BF2CVTLT 01100101 00 001 001 001111 ..... ..... @rd_rn_e0 +BFCVTN 01100101 00 001 010 001110 ....0 ..... @rd_rnx2 esz=1 + ### SVE FP Compare with Zero Group FCMGE_ppz0 01100101 .. 0100 00 001 ... ..... 0 .... @pd_pg_rn
Signature · 1 line
2.43.0
PATCH v3 29/47 target/arm: Implement FCVTN (16- to 8-bit fp) for AdvSIMD
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 + target/arm/tcg/fp8_helper.c | 66 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 15 ++++++++ target/arm/tcg/a64.decode | 2 + 4 files changed, 85 insertions(+)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -14,3 +14,5 @@ DEF_HELPER_FLAGS_4(sme2_fcvt_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_fcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_bfcvtn_bh, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_5 (gvec_fcvt_bh,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +66 -0
75 lines not on this page · raw message
target/arm/tcg/translate-a64.c +15 -0
@@ -6522,6 +6522,21 @@ static gen_helper_gvec_3_ptr * const f_vector_fscale[3] = { }; TRANS_FEAT(FSCALE, aa64_f8cvt, do_fp3_vector, a, 0, f_vector_fscale) +static bool trans_FCVTN_bh (DisasContext *s,arg_qrrr_e *a) +{ +if (!dc_isar_feature (aa64_f8cvt, s)) { +return false; + } +if (fpmr_access_check (s) &&fp_access_check (s)) { +tcg_gen_gvec_3_ptr (vec_full_reg_offset (s, a->rd), +vec_full_reg_offset (s, a->rn), +vec_full_reg_offset (s, a->rm), + tcg_env, a->q ?16 :8 ,vec_full_reg_size (s), +FPST_A64 <<2 , gen_helper_gvec_fcvt_bh); + } +return true; +} +static bool do_fmlal (DisasContext *s,arg_qrrr_e *a,bool is_s,bool is_2) {if (fp_access_check (s)) {
target/arm/tcg/a64.decode +2 -0
@@ -1201,6 +1201,8 @@ FAMIN 0.10 1110 1.1 ..... 11011 1 ..... ..... @qrrr_sd FSCALE 0.10 1110 110 ..... 00111 1 ..... ..... @qrrr_h FSCALE 0.10 1110 1.1 ..... 11111 1 ..... ..... @qrrr_sd +FCVTN_bh 0.00 1110 010 ..... 11110 1 ..... ..... @qrrr_h + ### Advanced SIMD scalar x indexed element FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
Signature · 1 line
2.43.0
PATCH v3 30/47 target/arm: Implement FCVTN, FCVTN2 (32- to 8-bit fp) for AdvSIMD
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 ++ target/arm/tcg/fp8_helper.c | 60 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 16 +++++++++ target/arm/tcg/a64.decode | 1 + 4 files changed, 79 insertions(+)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -16,3 +16,5 @@ DEF_HELPER_FLAGS_4(sme2_fcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_bfcvtn_bh, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fcvt_bh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_5 (advsimd_fcvt_bs,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +60 -0
69 lines not on this page · raw message
target/arm/tcg/translate-a64.c +16 -0
@@ -6537,6 +6537,22 @@ static bool trans_FCVTN_bh(DisasContext *s, arg_qrrr_e *a)return true; } +static bool trans_FCVTN_bs (DisasContext *s,arg_qrrr_e *a) +{ +if (!dc_isar_feature (aa64_f8cvt, s)) { +return false; + } +if (fpmr_access_check (s) &&fp_access_check (s)) { +tcg_gen_gvec_3_ptr (vec_full_reg_offset (s, a->rd), +vec_full_reg_offset (s, a->rn), +vec_full_reg_offset (s, a->rm), + tcg_env,16 ,vec_full_reg_size (s), + (a->q <<1 ) |FPST_A64 <<2 , + gen_helper_advsimd_fcvt_bs); + } +return true; +} +static bool do_fmlal (DisasContext *s,arg_qrrr_e *a,bool is_s,bool is_2) {if (fp_access_check (s)) {
target/arm/tcg/a64.decode +1 -0
@@ -1202,6 +1202,7 @@ FSCALE 0.10 1110 110 ..... 00111 1 ..... ..... @qrrr_h FSCALE 0.10 1110 1.1 ..... 11111 1 ..... ..... @qrrr_sd FCVTN_bh 0.00 1110 010 ..... 11110 1 ..... ..... @qrrr_h +FCVTN_bs 0.00 1110 000 ..... 11110 1 ..... ..... @qrrr_h ### Advanced SIMD scalar x indexed element
Signature · 1 line
2.43.0
PATCH v3 31/47 target/arm: Implement FCVTN (16- to 8-bit fp) for SVE
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 1 + target/arm/tcg/fp8_helper.c | 40 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 2 ++ target/arm/tcg/sve.decode | 1 + 4 files changed, 44 insertions(+)
target/arm/tcg/helper-fp8-defs.h +1 -0
@@ -16,5 +16,6 @@ DEF_HELPER_FLAGS_4(sme2_fcvtl_hb, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_bfcvtn_bh, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fcvt_bh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4(sve2_fcvtn_bh, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32)DEF_HELPER_FLAGS_5 (advsimd_fcvt_bs,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +40 -0
@@ -587,6 +587,46 @@ void HELPER(gvec_fcvt_bh)(void *vd, void *vn, void *vm,clear_tail (vd, oprsz,simd_maxsz (desc)); } +void HELPER (sve2_fcvtn_bh )(void *vd,void *vn,CPUARMState *env,uint32_t desc) +{ +FP8Context ctx =fp8_dst_start (env, desc); +uint16_t *n0 = vn; +uint16_t *n1 = vn +sizeof (ARMVectorReg); +uint8_t *d = vd; +bool osc =FIELD_EX64 (env->vfp.fpmr,FPMR ,OSC ); +size_t oprsz =simd_oprsz (desc); +size_t nelem = oprsz /2 ; + +switch (ctx.f8fmt) { +case OFP8_E5M2 : +for (size_t i =0 ; i < nelem; ++i) { +float16 e0 = n0[H2 (i)]; +float16 e1 = n1[H2 (i)]; + d[H1 (2 * i +0 )] = +fcvt_f16_to_fp8e5m2 (e0, ctx.scale, osc, &ctx.stat); + d[H1 (2 * i +1 )] = +fcvt_f16_to_fp8e5m2 (e1, ctx.scale, osc, &ctx.stat); + } +break ; +case OFP8_E4M3 : +for (size_t i =0 ; i < nelem; ++i) { +float16 e0 = n0[H2 (i)]; +float16 e1 = n1[H2 (i)]; + d[H1 (2 * i +0 )] = +fcvt_f16_to_fp8e4m3 (e0, ctx.scale, osc, &ctx.stat); + d[H1 (2 * i +1 )] = +fcvt_f16_to_fp8e4m3 (e1, ctx.scale, osc, &ctx.stat); + } +break ; +default : +float8_invalid_output (d, oprsz, &ctx.stat); +break ; + } + +fp8_finish (env, &ctx); +} + +void HELPER (advsimd_fcvt_bs )(void *vd,void *vn,void *vm,CPUARMState *env,uint32_t desc) {
target/arm/tcg/translate-sve.c +2 -0
@@ -4099,6 +4099,8 @@ TRANS_FEAT(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, do_f8cvt, a,TRANS_FEAT (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, gen_helper_sve2_bfcvt, true, true) +TRANS_FEAT (FCVTN , aa64_sme2_or_sve2_f8cvt, do_f8cvt, + a, gen_helper_sve2_fcvtn_bh, false, false)TRANS_FEAT (BFCVTN , aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, gen_helper_sve2_bfcvtn_bh, false, false)
target/arm/tcg/sve.decode +1 -0
@@ -1101,6 +1101,7 @@ BF2CVT 01100101 00 001 000 001111 ..... ..... @rd_rn_e0 BF1CVTLT 01100101 00 001 001 001110 ..... ..... @rd_rn_e0 BF2CVTLT 01100101 00 001 001 001111 ..... ..... @rd_rn_e0 +FCVTN 01100101 00 001 010 001100 ....0 ..... @rd_rnx2 esz=1 BFCVTN 01100101 00 001 010 001110 ....0 ..... @rd_rnx2 esz=1 ### SVE FP Compare with Zero Group
Signature · 1 line
2.43.0
Quoted 12 lines · Richard Henderson
Based-on: [email protected] ("[PATCH v2 00/40] fpu: Export some internals for targets")
v2: https://lore.kernel.org/qemu-devel/[email protected]/
Changes for v3:
- Rebase onsoftfloat-parts.h, which allows us to drop some local changes to fpu/.
- Enable ID_AA64FPFR0.F8{E5M2,E4M3}.
- ImplementFEAT_SME_LUTv2.
- ImplementFEAT_FP8FMA,FEAT_SSVE_FP8FMA.
Quoted 5 lines
I still haven't addressed the required firmware update for
tests/functional/aarch64/test_rme_virt.py
tests/functional/aarch64/test_rme_sbsaref.py
Feel free to send me the needed TF-A (and TF-RMM if needed) patches, and I'll apply this, and send you update url for assets.
Regards,
Pierrick
PATCH v3 32/47 target/arm: Implement FCVTNB, FCVTNT for SVE
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 + target/arm/tcg/fp8_helper.c | 87 +++++++++++++++++++++++++++++++- target/arm/tcg/translate-sve.c | 4 ++ target/arm/tcg/sve.decode | 2 + 4 files changed, 94 insertions(+), 1 deletion(-)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -19,3 +19,5 @@ DEF_HELPER_FLAGS_5(gvec_fcvt_bh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_fcvtn_bh, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(advsimd_fcvt_bs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4(sve2_fcvtnb_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4 (sve2_fcvtnt_bs,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +86 -1
96 lines not on this page · raw message
target/arm/tcg/translate-sve.c +4 -0
@@ -4103,6 +4103,10 @@ TRANS_FEAT(FCVTN, aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, gen_helper_sve2_fcvtn_bh, false, false) TRANS_FEAT(BFCVTN, aa64_sme2_or_sve2_f8cvt, do_f8cvt, a, gen_helper_sve2_bfcvtn_bh, false, false) +TRANS_FEAT(FCVTNB, aa64_sme2_or_sve2_f8cvt, do_f8cvt, + a, gen_helper_sve2_fcvtnb_bs, false, false) +TRANS_FEAT (FCVTNT , aa64_sme2_or_sve2_f8cvt, do_f8cvt, + a, gen_helper_sve2_fcvtnt_bs, false, false)/* *** SVE Floating Point Compare with Zero Group
target/arm/tcg/sve.decode +2 -0
@@ -1103,6 +1103,8 @@ BF2CVTLT 01100101 00 001 001 001111 ..... ..... @rd_rn_e0 FCVTN 01100101 00 001 010 001100 ....0 ..... @rd_rnx2 esz=1 BFCVTN 01100101 00 001 010 001110 ....0 ..... @rd_rnx2 esz=1 +FCVTNB 01100101 00 001 010 001101 ....0 ..... @rd_rnx2 esz=1 +FCVTNT 01100101 00 001 010 001111 ....0 ..... @rd_rnx2 esz=1 ### SVE FP Compare with Zero Group
Signature · 1 line
2.43.0
PATCH v3 33/47 target/arm: Implement FCVT (FP16 to FP8) for SME
In reply to Richard Henderson--- target/arm/tcg/translate-sme.c | 16 ++++++++++++++++ target/arm/tcg/sme.decode | 2 ++ 2 files changed, 18 insertions(+)
target/arm/tcg/translate-sme.c +16 -0
@@ -1556,6 +1556,22 @@ TRANS_FEAT(BF2CVT, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvt_hb, 1) TRANS_FEAT(BF1CVTL, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvtl_hb, 0) TRANS_FEAT(BF2CVTL, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_bfcvtl_hb, 1) +static bool trans_FCVT_bh (DisasContext *s,arg_zz_n *a) +{ +if (!dc_isar_feature (aa64_sme2_f8cvt, s)) { +return false; + } +if (fpmr_access_check (s) &&sme_sm_enabled_check (s)) { +int svl =streaming_vec_reg_size (s); +tcg_gen_gvec_3_ptr (vec_full_reg_offset (s, a->zd), +vec_full_reg_offset (s, a->zn), +vec_full_reg_offset (s, a->zn +1 ), + tcg_env, svl, svl, +FPST_ZA <<2 , gen_helper_gvec_fcvt_bh); + } +return true; +} +static bool do_zipuzp_4 (DisasContext *s,arg_zz_e *a,gen_helper_gvec_2 *const fn[5 ]) {
target/arm/tcg/sme.decode +2 -0
@@ -863,6 +863,8 @@ BF2CVT 11000001 111 00110 111000 ..... ....0 @zz_2x1 BF1CVTL 11000001 011 00110 111000 ..... ....1 @zz_2x1 BF2CVTL 11000001 111 00110 111000 ..... ....1 @zz_2x1 +FCVT_bh 11000001 001 00100 111000 ....0 ..... @zz_1x2 + ZIP_4 11000001 esz:2 1 10110 111000 ...00 ... 00 \ &zz_e zd=%zd_ax4 zn=%zn_ax4 ZIP_4 11000001 001 10111 111000 ...00 ... 00 \
Signature · 1 line
2.43.0
PATCH v3 34/47 target/arm: Implement FCVT, FCVTN (FP32 to FP8) for SME
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 2 + target/arm/tcg/fp8_helper.c | 95 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 3 + target/arm/tcg/sme.decode | 3 + 4 files changed, 103 insertions(+)
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -21,3 +21,5 @@ DEF_HELPER_FLAGS_4(sve2_fcvtn_bh, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(advsimd_fcvt_bs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_fcvtnb_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_fcvtnt_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4(sme2_fcvt_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4 (sme2_fcvtn_bs,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +95 -0
98 lines not on this page · raw message
target/arm/tcg/translate-sme.c +3 -0
@@ -1572,6 +1572,9 @@ static bool trans_FCVT_bh(DisasContext *s, arg_zz_n *a)return true; } +TRANS_FEAT(FCVT_bs, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_fcvt_bs, 0) +TRANS_FEAT(FCVTN_bs, aa64_sme2_f8cvt, do_f8cvt, a, gen_helper_sme2_fcvtn_bs, 0) +static bool do_zipuzp_4 (DisasContext *s,arg_zz_e *a,gen_helper_gvec_2 *const fn[5 ]) {
target/arm/tcg/sme.decode +3 -0
@@ -865,6 +865,9 @@ BF2CVTL 11000001 111 00110 111000 ..... ....1 @zz_2x1 FCVT_bh 11000001 001 00100 111000 ....0 ..... @zz_1x2 +FCVT_bs 11000001 001 10100 111000 ...00 ..... @zz_1x4 +FCVTN_bs 11000001 001 10100 111000 ...01 ..... @zz_1x4 + ZIP_4 11000001 esz:2 1 10110 111000 ...00 ... 00 \ &zz_e zd=%zd_ax4 zn=%zn_ax4 ZIP_4 11000001 001 10111 111000 ...00 ... 00 \
Signature · 1 line
2.43.0
PATCH v3 35/47 target/arm: Implement LUTI2, LUTI4 for AdvSIMD
In reply to Richard Henderson--- target/arm/tcg/helper-defs.h | 5 ++++ target/arm/tcg/translate-a64.c | 38 +++++++++++++++++++++++++ target/arm/tcg/vec_helper.c | 52 ++++++++++++++++++++++++++++++++++ target/arm/tcg/a64.decode | 6 ++++ 4 files changed, 101 insertions(+)
target/arm/tcg/helper-defs.h +5 -0
@@ -1122,3 +1122,8 @@ DEF_HELPER_FLAGS_4(sme2_luti4_2s, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_luti4_4h, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_luti4_4s, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_4(gvec_luti2_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_luti2_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_luti4_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4 (gvec_luti4_h,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, i32)
target/arm/tcg/translate-a64.c +38 -0
@@ -5405,6 +5405,44 @@ static bool trans_TBL_TBX(DisasContext *s, arg_TBL_TBX *a)return true; } +static bool do_lut_1 (DisasContext *s,arg_rrx_e *a,gen_helper_gvec_3 *fn) +{ +if (fp_access_check (s)) { +gen_gvec_op3_ool (s, true, a->rd, a->rn, a->rm, a->idx, fn); + } +return true; +} + +TRANS_FEAT(LUTI2_1b, aa64_lut, do_lut_1, a, gen_helper_gvec_luti2_b) +TRANS_FEAT(LUTI2_1h, aa64_lut, do_lut_1, a, gen_helper_gvec_luti2_h) +TRANS_FEAT(LUTI4_1b, aa64_lut, do_lut_1, a, gen_helper_gvec_luti4_b) + +static bool trans_LUTI4_2h (DisasContext *s,arg_rrx_e *a) +{ +if (!dc_isar_feature (aa64_lut, s)) { +return false; + } +if (fp_access_check (s)) { +/* +* (Ab)use preg_tmp to merge two disjoint 128-bit quantities +* into a sequential 256-bit table. +*/ +QEMU_BUILD_BUG_ON (sizeof_field (CPUARMState, vfp.preg_tmp) <32 ); + unsigned tmp_ofs = offsetof(CPUARMState, vfp.preg_tmp); +unsigned rn0_ofs =vec_full_reg_offset (s, a->rn); +unsigned rn1_ofs =vec_full_reg_offset (s, (a->rn +1 ) %32 ); + +tcg_gen_gvec_mov (MO_64 , tmp_ofs, rn0_ofs,16 ,16 ); +tcg_gen_gvec_mov (MO_64 , tmp_ofs +16 , rn1_ofs,16 ,16 ); + +tcg_gen_gvec_3_ool (vec_full_reg_offset (s, a->rd), tmp_ofs, +vec_full_reg_offset (s, a->rm), +16 ,vec_full_reg_size (s), + a->idx, gen_helper_gvec_luti4_h); + } +return true; +} +typedef int simd_permute_idx_fn (int i,int part,int elements); static bool do_simd_permute(DisasContext *s, arg_qrrr_e *a,
target/arm/tcg/vec_helper.c +52 -0
55 lines not on this page · raw message
target/arm/tcg/a64.decode +6 -0
@@ -1344,6 +1344,12 @@ EXT_q 0110 1110 00 0 rm:5 0 imm:4 0 rn:5 rd:5 TBL_TBX 0 q:1 00 1110 000 rm:5 0 len:2 tbx:1 00 rn:5 rd:5 +LUTI2_1b 0100 1110 100 rm:5 0 idx:2 100 rn:5 rd:5 &rrx_e esz=0 +LUTI2_1h 0100 1110 110 rm:5 0 idx:3 00 rn:5 rd:5 &rrx_e esz=1 + +LUTI4_1b 0100 1110 010 rm:5 0 idx:1 1000 rn:5 rd:5 &rrx_e esz=0 +LUTI4_2h 0100 1110 010 rm:5 0 idx:2 100 rn:5 rd:5 &rrx_e esz=1 + # Advanced SIMD Permute UZP1 0.00 1110 .. 0 ..... 0 001 10 ..... ..... @qrrr_e
Signature · 1 line
2.43.0
PATCH v3 36/47 target/arm: Implement LUTI2, LUTI4 for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 6 +++ target/arm/tcg/translate.h | 8 ++++ target/arm/tcg/translate-a64.c | 1 + target/arm/tcg/translate-sve.c | 68 ++++++++++++++++++++++++++++++++++ target/arm/tcg/sve.decode | 11 +++++- 5 files changed, 93 insertions(+), 1 deletion(-)
target/arm/cpu-features.h +6 -0
@@ -1635,6 +1635,12 @@ isar_feature_aa64_sme2_or_sve2_f8cvt(const ARMISARegisters *id)return isar_feature_aa64_sme2_or_sve2 (id) &&isar_feature_aa64_f8cvt (id); } +static inline bool +isar_feature_aa64_sme2_or_sve2_lut (const ARMISARegisters *id) +{ +return isar_feature_aa64_sme2_or_sve2 (id) &&isar_feature_aa64_lut (id); +} +/* * Feature tests for "does this exist in either 32-bit or 64-bit?" */
target/arm/tcg/translate.h +8 -0
@@ -90,6 +90,7 @@ typedef struct DisasContext {int vl;/* current vector length in bytes */ int svl;/* current streaming vector length in bytes */ int max_svl;/* maximum implemented streaming vector length */ +int max_any_vl;/* maximum implemented vector length */ bool vfp_enabled;/* FP enabled via FPSCR.EN */ int vec_len;int vec_stride;
@@ -874,4 +875,11 @@ static inline void gen_restore_rmode(TCGv_i32 old, TCGv_ptr fpst) return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); \ } +#define TRANS_FEAT_SME1_NONSTREAMING (NAME ,FEAT ,FUNC , ...) \ + static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ + { \ + s->is_nonstreaming = !dc_isar_feature(aa64_sme2, s); \ + return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); \ + } +#endif /* TARGET_ARM_TRANSLATE_H */
target/arm/tcg/translate-a64.c +1 -0
@@ -10820,6 +10820,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->vl = (EX_TBFLAG_A64 (tb_flags,VL ) +1 ) *16 ; dc->svl = (EX_TBFLAG_A64 (tb_flags,SVL ) +1 ) *16 ; dc->max_svl = arm_cpu->sme_max_vq *16 ; + dc->max_any_vl =MAX (dc->max_svl, arm_cpu->sve_max_vq *16 ); dc->pauth_active =EX_TBFLAG_A64 (tb_flags,PAUTH_ACTIVE ); dc->bt =EX_TBFLAG_A64 (tb_flags,BT ); dc->btype =EX_TBFLAG_A64 (tb_flags,BTYPE );
target/arm/tcg/translate-sve.c +68 -0
71 lines not on this page · raw message
target/arm/tcg/sve.decode +10 -1
@@ -31,6 +31,7 @@ %dtype_23_13 23:2 13:2 %index3_22_19 22:1 19:2 %index3_22_17 22:1 17:2 +%index3_22_12 22:2 12:1 %index3_19_11 19:2 11:1 %index2_20_11 20:1 11:1
@@ -1737,11 +1738,19 @@ RSUBHNT 01000101 .. 1 ..... 011 111 ..... ..... @rd_rn_rm MATCH 01000101 .. 1 ..... 100 ... ..... 0 .... @pd_pg_rn_rm NMATCH 01000101 .. 1 ..... 100 ... ..... 1 .... @pd_pg_rn_rm -### SVE2 Histogram Computation +### SVE2 Histogram Computation and Lookup Table HISTCNT 01000101 .. 1 ..... 110 ... ..... ..... @rd_pg_rn_rm HISTSEG 01000101 .. 1 ..... 101 000 ..... ..... @rd_rn_rm +LUTI2_1b 01000101 index:2 1 rm:5 101100 rn:5 rd:5 &rrx_esz esz=0 +LUTI2_1h 01000101 .. 1 rm:5 101.10 rn:5 rd:5 \ + &rrx_esz esz=1 index=%index3_22_12 + +LUTI4_1b 01000101 index:1 11 rm:5 101001 rn:5 rd:5 &rrx_esz esz=0 +LUTI4_1h 01000101 index:2 1 rm:5 101111 rn:5 rd:5 &rrx_esz esz=1 +LUTI4_2h 01000101 index:2 1 rm:5 101101 rn:5 rd:5 &rrx_esz esz=1 + ## SVE2 floating-point pairwise operations FADDP 01100100 .. 010 00 0 100 ... ..... ..... @rdn_pg_rm
Signature · 1 line
2.43.0
PATCH v3 37/47 target/arm: Enable FEAT_LUT for -cpu max
In reply to Richard Henderson--- target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 2 files changed, 2 insertions(+)
target/arm/tcg/cpu64.c +1 -0
@@ -1263,6 +1263,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ISAR2 ,BC ,1 );/* FEAT_HBC */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,WFXT ,2 );/* FEAT_WFxT */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,CSSC ,1 );/* FEAT_CSSC */ + t =FIELD_DP64 (t,ID_AA64ISAR2 ,LUT ,1 );/* FEAT_LUT */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,ATS1A ,1 );/* FEAT_ATS1A */ SET_IDREG (isar,ID_AA64ISAR2 , t);
docs/system/arm/emulation.rst +1 -0
@@ -101,6 +101,7 @@ the following architecture extensions: - FEAT_LSE (Large System Extensions) - FEAT_LSE2 (Large System Extensions v2) - FEAT_LSE128 (128-bit Atomics) +- FEAT_LUT (Lookup table instructions with 2-bit and 4-bit indices) - FEAT_LVA (Large Virtual Address space) - FEAT_MEC (Memory Encryption Contexts)
Signature · 1 line
2.43.0
PATCH v3 38/47 target/arm: Enable FEAT_FP8 for -cpu max
In reply to Richard Henderson--- target/arm/tcg/cpu64.c | 6 ++++++ docs/system/arm/emulation.rst | 1 + 2 files changed, 7 insertions(+)
target/arm/tcg/cpu64.c +6 -0
@@ -1391,6 +1391,12 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64SMFR0 ,FA64 ,1 );/* FEAT_SME_FA64 */ SET_IDREG (isar,ID_AA64SMFR0 , t); + t =GET_IDREG (isar,ID_AA64FPFR0 ); + t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8E5M2 ,1 );/* FEAT_FP8 */ + t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8E4M3 ,1 );/* FEAT_FP8 */ + t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8CVT ,1 );/* FEAT_FP8 */ +SET_IDREG (isar,ID_AA64FPFR0 , t); +/* Replicate the same data to the 32-bit id registers. */ aa32_max_features (cpu);
docs/system/arm/emulation.rst +1 -0
@@ -74,6 +74,7 @@ the following architecture extensions: - FEAT_FHM (Floating-point half-precision multiplication instructions) - FEAT_FP (Floating Point extensions) - FEAT_FP16 (Half-precision floating-point data processing) +- FEAT_FP8 (FP8 convert instructions) - FEAT_FPAC (Faulting on AUT* instructions) - FEAT_FPACCOMBINE (Faulting on combined pointer authentication instructions) - FEAT_FPACC_SPEC (Speculative behavior of combined pointer authentication instructions)
Signature · 1 line
2.43.0
PATCH v3 39/47 target/arm: Update ID_AA64SMFR0_EL1 fields to ARM M.b
In reply to Richard Henderson--- target/arm/cpu-features.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
target/arm/cpu-features.h +11 -0
@@ -388,17 +388,28 @@ FIELD(ID_AA64ZFR0, F16MM, 48, 4) FIELD(ID_AA64ZFR0, F32MM, 52, 4) FIELD(ID_AA64ZFR0, F64MM, 56, 4) +FIELD(ID_AA64SMFR0, SMOP4, 0, 1) +FIELD(ID_AA64SMFR0, STMOP, 16, 1) +FIELD(ID_AA64SMFR0, SFEXPA, 23, 1) +FIELD(ID_AA64SMFR0, AES, 24, 1) +FIELD(ID_AA64SMFR0, SBITPERM, 25, 1) +FIELD(ID_AA64SMFR0, SF8DP2, 28, 1) +FIELD(ID_AA64SMFR0, SF8DP4, 29, 1) +FIELD(ID_AA64SMFR0, SF8FMA, 30, 1) FIELD(ID_AA64SMFR0, F32F32, 32, 1) FIELD(ID_AA64SMFR0, BI32I32, 33, 1) FIELD(ID_AA64SMFR0, B16F32, 34, 1) FIELD(ID_AA64SMFR0, F16F32, 35, 1) FIELD(ID_AA64SMFR0, I8I32, 36, 4) +FIELD(ID_AA64SMFR0, F8F32, 40, 1) +FIELD(ID_AA64SMFR0, F8F16, 41, 1) FIELD(ID_AA64SMFR0, F16F16, 42, 1) FIELD(ID_AA64SMFR0, B16B16, 43, 1) FIELD(ID_AA64SMFR0, I16I32, 44, 4) FIELD(ID_AA64SMFR0, F64F64, 48, 1) FIELD(ID_AA64SMFR0, I16I64, 52, 4) FIELD(ID_AA64SMFR0, SMEVER, 56, 4) +FIELD(ID_AA64SMFR0, LUTv2, 60, 1) FIELD(ID_AA64SMFR0, FA64, 63, 1)FIELD (ID_AA64FPFR0 ,F8E5M2 ,0 ,1 )
Signature · 1 line
2.43.0
PATCH v3 40/47 target/arm: Implement MOVT (vector to table)
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sme.c | 18 ++++++++++++++++++ target/arm/tcg/sme.decode | 2 ++ 3 files changed, 25 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1556,6 +1556,11 @@ static inline bool isar_feature_aa64_sme_fa64(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,FA64 ); } +static inline bool isar_feature_aa64_sme_lutv2 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64SMFR0 , LUTv2); +} +static inline bool isar_feature_aa64_sme2 (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,SMEVER ) !=0 ;
target/arm/tcg/translate-sme.c +18 -0
@@ -391,6 +391,24 @@ static bool do_movt(DisasContext *s, arg_MOVT_rzt *a, TRANS_FEAT(MOVT_rzt, aa64_sme2, do_movt, a, tcg_gen_ld_i64) TRANS_FEAT(MOVT_ztr, aa64_sme2, do_movt, a, tcg_gen_st_i64) +static bool trans_MOVT_ztz (DisasContext *s,arg_MOVT_ztz *a) +{ +if (!dc_isar_feature (aa64_sme_lutv2, s)) { +return false; + } +if (sme_sm_enabled_check (s) &&sme2_zt0_enabled_check (s)) { +int svl =streaming_vec_reg_size (s); +int tsize =MIN (svl,64 ); +int offset = (a->off % (64 / tsize)) * tsize; + +tcg_gen_gvec_mov (MO_64 , + offsetof(CPUARMState, za_state.zt0) + offset, +vec_full_reg_offset (s, a->rt), tsize, + offset ? tsize : 64); + } +return true; +} +static bool trans_LDST1 (DisasContext *s,arg_LDST1 *a) {typedef void GenLdSt1 (TCGv_env ,TCGv_ptr ,TCGv_ptr ,TCGv ,TCGv_i64 );
target/arm/tcg/sme.decode +2 -0
@@ -141,6 +141,8 @@ MOVAZ_zt4 11000000 11 00011 0 v:1 .. 00110 za:3 zr:3 00 \ MOVT_rzt 1100 0000 0100 1100 0 off:3 00 11111 rt:5 MOVT_ztr 1100 0000 0100 1110 0 off:3 00 11111 rt:5 +MOVT_ztz 1100 0000 0100 1111 00 off:2 00 11111 rt:5 + ### SME Memory &ldst esz rs pg rn rm za off v:bool st:bool
Signature · 1 line
2.43.0
PATCH v3 41/47 target/arm: Implement LUTI4 (four registers, 8-bit)
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/helper-defs.h | 1 + target/arm/tcg/translate-sme.c | 6 ++++++ target/arm/tcg/vec_helper.c | 14 ++++++++++++++ target/arm/tcg/sme.decode | 6 ++++++ 5 files changed, 32 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1629,6 +1629,11 @@ static inline bool isar_feature_aa64_sme2_f8cvt(const ARMISARegisters *id)return isar_feature_aa64_sme2 (id) &&isar_feature_aa64_f8cvt (id); } +static inline bool isar_feature_aa64_sme2p1_lutv2 (const ARMISARegisters *id) +{ +return isar_feature_aa64_sme2p1 (id) &&isar_feature_aa64_sme_lutv2 (id); +} +static inline bool isar_feature_aa64_sve_i8mm (const ARMISARegisters *id) {return isar_feature_aa64_sve (id) &&isar_feature_aa64_sme_sve_i8mm (id);
target/arm/tcg/helper-defs.h +1 -0
@@ -1120,6 +1120,7 @@ DEF_HELPER_FLAGS_4(sme2_luti4_2b, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_luti4_2h, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_luti4_2s, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_4(sme2_luti4_4b, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_luti4_4h, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32)DEF_HELPER_FLAGS_4 (sme2_luti4_4s,TCG_CALL_NO_RWG , void, ptr, ptr, env, i32)
target/arm/tcg/translate-sme.c +6 -0
@@ -1846,6 +1846,9 @@ TRANS_FEAT(LUTI4_c_2s, aa64_sme2, do_lut, a, gen_helper_sme2_luti4_2s, false) TRANS_FEAT(LUTI4_c_4h, aa64_sme2, do_lut, a, gen_helper_sme2_luti4_4h, false) TRANS_FEAT(LUTI4_c_4s, aa64_sme2, do_lut, a, gen_helper_sme2_luti4_4s, false) +TRANS_FEAT (LUTI4_c_4b, aa64_sme_lutv2, do_lut, a, + gen_helper_sme2_luti4_4b, false) +static bool do_lut_s4 (DisasContext *s,arg_lut *a,gen_helper_gvec_2_ptr *fn) {return !(a->zd &0b01100 ) &&do_lut (s, a, fn, true);
@@ -1866,3 +1869,6 @@ TRANS_FEAT(LUTI4_s_2b, aa64_sme2p1, do_lut_s8, a, gen_helper_sme2_luti4_2b) TRANS_FEAT(LUTI4_s_2h, aa64_sme2p1, do_lut_s8, a, gen_helper_sme2_luti4_2h) TRANS_FEAT(LUTI4_s_4h, aa64_sme2p1, do_lut_s4, a, gen_helper_sme2_luti4_4h) + +TRANS_FEAT (LUTI4_s_4b, aa64_sme2p1_lutv2, do_lut_s4, a, + gen_helper_sme2_luti4_4b)
target/arm/tcg/vec_helper.c +14 -0
@@ -3346,6 +3346,20 @@ DO_SME2_LUT(4,4,s, 4)#undef DO_SME2_LUT +void helper_sme2_luti4_4b (void *zd,void *zn,CPUARMState *env,uint32_t desc) +{ +unsigned vl =simd_oprsz (desc); +unsigned strided =extract32 (desc,SIMD_DATA_SHIFT ,1 ); +unsigned dstride = !strided ?1 :4 ; +uint64_t indexes[ARM_MAX_VQ *4 ]; + +memcpy (&indexes, zn, vl); +memcpy ((void *)&indexes + vl, zn +sizeof (ARMVectorReg), vl); + +do_lut_b (zd, indexes, (void *)env->za_state.zt0, vl,0 , + dstride *sizeof (ARMVectorReg),4 ,32 ,4 ); +} +void HELPER (gvec_luti2_b )(void *vd,void *vn,void *vm,uint32_t desc) {unsigned part =simd_data (desc);
target/arm/tcg/sme.decode +6 -0
@@ -1014,8 +1014,14 @@ LUTI4_c_2s 1100 0000 1000 101 idx:2 1 10 00 zn:5 .... 0 &lut zd=%zd_ax2 LUTI4_c_4h 1100 0000 1000 101 idx:1 10 01 00 zn:5 ... 00 &lut zd=%zd_ax4 LUTI4_c_4s 1100 0000 1000 101 idx:1 10 10 00 zn:5 ... 00 &lut zd=%zd_ax4 +LUTI4_c_4b 1100 0000 1000 101 1 00 00 00 ....0 ...00 \ + &lut zd=%zd_ax4 zn=%zn_ax2 idx=0 + # LUTI4, strided (must check zd alignment) LUTI4_s_2b 1100 0000 1001 101 idx:2 1 00 00 zn:5 zd:5 &lut LUTI4_s_2h 1100 0000 1001 101 idx:2 1 01 00 zn:5 zd:5 &lut LUTI4_s_4h 1100 0000 1001 101 idx:1 10 01 00 zn:5 zd:5 &lut + +LUTI4_s_4b 1100 0000 1001 101 1 00 00 00 ....0 zd:5 \ + &lut zn=%zn_ax2 idx=0
Signature · 1 line
2.43.0
PATCH v3 42/47 target/arm: Enable FEAT_SME_LUTv2 for -cpu max
In reply to Richard Henderson--- target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 2 files changed, 2 insertions(+)
target/arm/tcg/cpu64.c +1 -0
@@ -1388,6 +1388,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64SMFR0 ,F64F64 ,1 );/* FEAT_SME_F64F64 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,I16I64 ,0xf );/* FEAT_SME_I16I64 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,SMEVER ,2 );/* FEAT_SME2p1 */ + t =FIELD_DP64 (t,ID_AA64SMFR0 , LUTv2,1 );/* FEAT_SME_LUTv2 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,FA64 ,1 );/* FEAT_SME_FA64 */ SET_IDREG (isar,ID_AA64SMFR0 , t);
docs/system/arm/emulation.rst +1 -0
@@ -158,6 +158,7 @@ the following architecture extensions: - FEAT_SME_F16F16 (Non-widening half-precision FP16 arithmetic for SME2) - FEAT_SME_F64F64 (Double-precision floating-point outer product instructions) - FEAT_SME_I16I64 (16-bit to 64-bit integer widening outer product instructions) +- FEAT_SME_LUTv2 (Lookup table instructions with 4-bit indices and 8-bit elements) - FEAT_SVE (Scalable Vector Extension) - FEAT_SVE_AES (Scalable Vector AES instructions) - FEAT_SVE_B16B16 (Non-widening BFloat16 arithmetic for SVE2)
Signature · 1 line
2.43.0
PATCH v3 43/47 target/arm: Implement FMLALB, FMLALT for AdvSIMD
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 ++ target/arm/tcg/helper-fp8-defs.h | 3 + target/arm/tcg/fp8_helper.c | 105 +++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 16 +++++ target/arm/tcg/a64.decode | 8 +++ 5 files changed, 137 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1576,6 +1576,11 @@ static inline bool isar_feature_aa64_f8cvt(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8CVT ); } +static inline bool isar_feature_aa64_f8fma (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8FMA ); +} +/* * Combinations of feature tests, for ease of use with TRANS_FEAT. */
target/arm/tcg/helper-fp8-defs.h +3 -0
@@ -23,3 +23,6 @@ DEF_HELPER_FLAGS_4(sve2_fcvtnb_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sve2_fcvtnt_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_fcvt_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_4(sme2_fcvtn_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_5(gvec_fmla_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_5 (gvec_fmla_idx_hb,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +105 -0
108 lines not on this page · raw message
target/arm/tcg/translate-a64.c +16 -0
@@ -7384,6 +7384,22 @@ TRANS_FEAT(FMLSL_vi, aa64_fhm, do_fmlal_idx, a, true, false) TRANS_FEAT(FMLAL2_vi, aa64_fhm, do_fmlal_idx, a, false, true) TRANS_FEAT(FMLSL2_vi, aa64_fhm, do_fmlal_idx, a, true, true) +static bool do_fmla_fp8 (DisasContext *s,arg_rxx *a, +gen_helper_gvec_3_ptr *fn) +{ +if (fpmr_access_check (s) &&fp_access_check (s)) { +tcg_gen_gvec_3_ptr (vec_full_reg_offset (s, a->rd), +vec_full_reg_offset (s, a->rn), +vec_full_reg_offset (s, a->rm), + tcg_env,16 ,vec_full_reg_size (s), + a->idxn | (a->idxm <<2 ), fn); + } +return true; +} + +TRANS_FEAT(FMLAL_hb_v, aa64_f8fma, do_fmla_fp8, a, gen_helper_gvec_fmla_hb) +TRANS_FEAT(FMLAL_hb_vi, aa64_f8fma, do_fmla_fp8, a, gen_helper_gvec_fmla_idx_hb) +static bool do_int3_vector_idx (DisasContext *s,arg_qrrx_e *a,gen_helper_gvec_3 *const fns[2 ]) {
target/arm/tcg/a64.decode +8 -0
@@ -25,6 +25,7 @@ %esz_hsd 22:2 !function=xor_2 %hl 11:1 21:1 %hlm 11:1 20:2 +%hlm4 11:1 19:3 &r rn &rrr rd rn rm
@@ -38,6 +39,7 @@ &rri_e rd rn imm esz &rrr_e rd rn rm esz &rrx_e rd rn rm idx esz +&rxx rd rn rm idxn idxm &rrrr_e rd rn rm ra esz &qrr_e q rd rn esz &qrri_e q rd rn imm esz
@@ -1204,6 +1206,9 @@ FSCALE 0.10 1110 1.1 ..... 11111 1 ..... ..... @qrrr_sd FCVTN_bh 0.00 1110 010 ..... 11110 1 ..... ..... @qrrr_h FCVTN_bs 0.00 1110 000 ..... 11110 1 ..... ..... @qrrr_h +FMLAL_hb_v 0 idxn:1 00 1110 110 rm:5 11111 1 rn:5 rd:5 \ + &rxx idxm=0 + ### Advanced SIMD scalar x indexed element FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
@@ -1322,6 +1327,9 @@ SQDMLAL_vi 0.00 1111 10 . ..... 0011 . 0 ..... ..... @qrrx_s SQDMLSL_vi 0.00 1111 01 .. .... 0111 . 0 ..... ..... @qrrx_h SQDMLSL_vi 0.00 1111 10 . ..... 0111 . 0 ..... ..... @qrrx_s +FMLAL_hb_vi 0 idxn:1 00 1111 11 ... rm:3 0000 . 0 rn:5 rd:5 \ + &rxx idxm=%hlm4 + # Floating-point conditional select FCSEL 0001 1110 .. 1 rm:5 cond:4 11 rn:5 rd:5 esz=%esz_hsd
Signature · 1 line
2.43.0
PATCH v3 44/47 target/arm: Implement FMLALB, FMLALT (FP8 to FP16) for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 33 +++++++++++++++++++++++++++++++++ target/arm/tcg/sve.decode | 7 +++++++ 3 files changed, 45 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1531,6 +1531,11 @@ static inline bool isar_feature_aa64_sve_b16b16(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,B16B16 ); } +static inline bool isar_feature_aa64_ssve_f8fma (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,SF8FMA ); +} +static inline bool isar_feature_aa64_sme_b16b16 (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,B16B16 );
target/arm/tcg/translate-sve.c +33 -0
@@ -8336,3 +8336,36 @@ static bool trans_LUTI4_2h(DisasContext *s, arg_LUTI4_2h *a) }return true; } + +static bool do_fmla_fp8 (DisasContext *s,arg_rxx *a,gen_helper_gvec_3_ptr *fn) +{ +bool fp8fma =dc_isar_feature (aa64_f8fma, s); +bool ssve_fp8fma =dc_isar_feature (aa64_ssve_f8fma, s); +bool ok = false; + +/* Feature detection and enabling are complex here. */ +if (!(ssve_fp8fma || (fp8fma &&dc_isar_feature (aa64_sve2, s)))) { +return false; + } +if (fpmr_access_check (s)) { +if (fp8fma) { + s->is_nonstreaming = !ssve_fp8fma; + ok =sve_access_check (s); + }else { + ok =sme_sm_enabled_check (s); + } + } + +if (ok) { +unsigned vsz =vec_full_reg_size (s); +tcg_gen_gvec_3_ptr (vec_full_reg_offset (s, a->rd), +vec_full_reg_offset (s, a->rn), +vec_full_reg_offset (s, a->rm), + tcg_env, vsz, vsz, + a->idxn | (a->idxm <<2 ), fn); + } +return true; +} + +TRANS(FMLAL_hb, do_fmla_fp8, a, gen_helper_gvec_fmla_hb) +TRANS (FMLAL_idx_hb, do_fmla_fp8, a, gen_helper_gvec_fmla_idx_hb)
target/arm/tcg/sve.decode +7 -0
@@ -29,6 +29,7 @@ %imm9_16_10 16:s6 10:3 %size_23 23:2 %dtype_23_13 23:2 13:2 +%index4_19_10 19:2 10:2 %index3_22_19 22:1 19:2 %index3_22_17 22:1 17:2 %index3_22_12 22:2 12:1
@@ -73,6 +74,7 @@ &rri rd rn imm &rr_dbm rd rn dbm &rrri rd rn rm imm +&rxx rd rn rm idxn idxm &rri_esz rd rn imm esz &rrri_esz rd rn rm imm esz &rrr_esz rd rn rm esz
@@ -1864,6 +1866,8 @@ BFMLALT_zzzw 01100100 11 1 ..... 10 0 00 1 ..... ..... @rda_rn_rm_ex esz=2 BFMLSLB_zzzw 01100100 11 1 ..... 10 1 00 0 ..... ..... @rda_rn_rm_ex esz=2 BFMLSLT_zzzw 01100100 11 1 ..... 10 1 00 1 ..... ..... @rda_rn_rm_ex esz=2 +FMLAL_hb 01100100 10 1 rm:5 100 idxn:1 10 rn:5 rd:5 &rxx idxm=0 + ### SVE2 floating-point dot-product FDOT_zzzz 01100100 00 1 ..... 10 0 00 0 ..... ..... @rda_rn_rm_ex esz=2 BFDOT_zzzz 01100100 01 1 ..... 10 0 00 0 ..... ..... @rda_rn_rm_ex esz=2
@@ -1880,6 +1884,9 @@ BFMLALT_zzxw 01100100 11 1 ..... 0100.1 ..... ..... @rrxr_3a esz=2 BFMLSLB_zzxw 01100100 11 1 ..... 0110.0 ..... ..... @rrxr_3a esz=2 BFMLSLT_zzxw 01100100 11 1 ..... 0110.1 ..... ..... @rrxr_3a esz=2 +FMLAL_idx_hb 01100100 idxn:1 01 .. rm:3 0101 .. rn:5 rd:5 \ + &rxx idxm=%index4_19_10 + ### SVE2 floating-point dot-product (indexed) FDOT_zzxz 01100100 00 1 ..... 010000 ..... ..... @rrxr_2 esz=2
Signature · 1 line
2.43.0
PATCH v3 45/47 target/arm: Implement FMLALL{BB, BT, TB, TT} for AdvSIMD
In reply to Richard Henderson--- target/arm/tcg/helper-fp8-defs.h | 3 ++ target/arm/tcg/fp8_helper.c | 81 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 3 ++ target/arm/tcg/a64.decode | 7 +++ 4 files changed, 94 insertions(+)
target/arm/tcg/helper-fp8-defs.h +3 -0
@@ -26,3 +26,6 @@ DEF_HELPER_FLAGS_4(sme2_fcvtn_bs, TCG_CALL_NO_RWG, void, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fmla_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fmla_idx_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_5(gvec_fmla_sb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_5 (gvec_fmla_idx_sb,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +81 -0
84 lines not on this page · raw message
target/arm/tcg/translate-a64.c +3 -0
@@ -7400,6 +7400,9 @@ static bool do_fmla_fp8(DisasContext *s, arg_rxx *a, TRANS_FEAT(FMLAL_hb_v, aa64_f8fma, do_fmla_fp8, a, gen_helper_gvec_fmla_hb) TRANS_FEAT(FMLAL_hb_vi, aa64_f8fma, do_fmla_fp8, a, gen_helper_gvec_fmla_idx_hb) +TRANS_FEAT(FMLALL_sb_v, aa64_f8fma, do_fmla_fp8, a, gen_helper_gvec_fmla_sb) +TRANS_FEAT(FMLALL_sb_vi, aa64_f8fma, do_fmla_fp8, a, gen_helper_gvec_fmla_idx_sb) +static bool do_int3_vector_idx (DisasContext *s,arg_qrrx_e *a,gen_helper_gvec_3 *const fns[2 ]) {
target/arm/tcg/a64.decode +7 -0
@@ -1209,6 +1209,10 @@ FCVTN_bs 0.00 1110 000 ..... 11110 1 ..... ..... @qrrr_h FMLAL_hb_v 0 idxn:1 00 1110 110 rm:5 11111 1 rn:5 rd:5 \ &rxx idxm=0 +%fmlall_idxn 30:1 22:1 +FMLALL_sb_v 0.00 1110 0.0 rm:5 110001 rn:5 rd:5 \ + &rxx idxm=0 idxn=%fmlall_idxn + ### Advanced SIMD scalar x indexed element FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
@@ -1330,6 +1334,9 @@ SQDMLSL_vi 0.00 1111 10 . ..... 0111 . 0 ..... ..... @qrrx_s FMLAL_hb_vi 0 idxn:1 00 1111 11 ... rm:3 0000 . 0 rn:5 rd:5 \ &rxx idxm=%hlm4 +FMLALL_sb_vi 0 . 10 1111 0 . ... rm:3 1000 . 0 rn:5 rd:5 \ + &rxx idxm=%hlm4 idxn=%fmlall_idxn + # Floating-point conditional select FCSEL 0001 1110 .. 1 rm:5 cond:4 11 rn:5 rd:5 esz=%esz_hsd
Signature · 1 line
2.43.0
PATCH v3 46/47 target/arm: Implement FMLALL{BB,BT,TB,TT} for SVE
In reply to Richard Henderson--- target/arm/tcg/translate-sve.c | 3 +++ target/arm/tcg/sve.decode | 5 +++++ 2 files changed, 8 insertions(+)
target/arm/tcg/translate-sve.c +3 -0
@@ -8369,3 +8369,6 @@ static bool do_fmla_fp8(DisasContext *s, arg_rxx *a, gen_helper_gvec_3_ptr *fn) TRANS(FMLAL_hb, do_fmla_fp8, a, gen_helper_gvec_fmla_hb) TRANS(FMLAL_idx_hb, do_fmla_fp8, a, gen_helper_gvec_fmla_idx_hb) + +TRANS(FMLALL_sb, do_fmla_fp8, a, gen_helper_gvec_fmla_sb) +TRANS (FMLALL_idx_sb, do_fmla_fp8, a, gen_helper_gvec_fmla_idx_sb)
target/arm/tcg/sve.decode +5 -0
@@ -1868,6 +1868,8 @@ BFMLSLT_zzzw 01100100 11 1 ..... 10 1 00 1 ..... ..... @rda_rn_rm_ex esz=2 FMLAL_hb 01100100 10 1 rm:5 100 idxn:1 10 rn:5 rd:5 &rxx idxm=0 +FMLALL_sb 01100100 00 1 rm:5 10 idxn:2 10 rn:5 rd:5 &rxx idxm=0 + ### SVE2 floating-point dot-product FDOT_zzzz 01100100 00 1 ..... 10 0 00 0 ..... ..... @rda_rn_rm_ex esz=2 BFDOT_zzzz 01100100 01 1 ..... 10 0 00 0 ..... ..... @rda_rn_rm_ex esz=2
@@ -1887,6 +1889,9 @@ BFMLSLT_zzxw 01100100 11 1 ..... 0110.1 ..... ..... @rrxr_3a esz=2 FMLAL_idx_hb 01100100 idxn:1 01 .. rm:3 0101 .. rn:5 rd:5 \ &rxx idxm=%index4_19_10 +FMLALL_idx_sb 01100100 idxn:2 1 .. rm:3 1100 .. rn:5 rd:5 \ + &rxx idxm=%index4_19_10 + ### SVE2 floating-point dot-product (indexed) FDOT_zzxz 01100100 00 1 ..... 010000 ..... ..... @rrxr_2 esz=2
Signature · 1 line
2.43.0
PATCH v3 47/47 target/arm: Enable FEAT_FP8FMA, FEAT_SSVE_FP8FMA for -cpu max
In reply to Richard Henderson--- target/arm/tcg/cpu64.c | 2 ++ docs/system/arm/emulation.rst | 2 ++ 2 files changed, 4 insertions(+)
target/arm/tcg/cpu64.c +2 -0
@@ -1377,6 +1377,7 @@ void aarch64_max_tcg_initfn(Object *obj)SET_IDREG (isar,ID_AA64DFR0 , t); t =GET_IDREG (isar,ID_AA64SMFR0 ); + t =FIELD_DP64 (t,ID_AA64SMFR0 ,SF8FMA ,1 );/* FEAT_SSVE_FP8FMA */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,F32F32 ,1 );/* FEAT_SME */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,BI32I32 ,1 );/* FEAT_SME2 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,B16F32 ,1 );/* FEAT_SME */
@@ -1395,6 +1396,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =GET_IDREG (isar,ID_AA64FPFR0 ); t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8E5M2 ,1 );/* FEAT_FP8 */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8E4M3 ,1 );/* FEAT_FP8 */ + t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8FMA ,1 );/* FEAT_FP8FMA */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8CVT ,1 );/* FEAT_FP8 */ SET_IDREG (isar,ID_AA64FPFR0 , t);
docs/system/arm/emulation.rst +2 -0
@@ -75,6 +75,7 @@ the following architecture extensions: - FEAT_FP (Floating Point extensions) - FEAT_FP16 (Half-precision floating-point data processing) - FEAT_FP8 (FP8 convert instructions) +- FEAT_FP8FMA (FP8 multiply-accumulate to half-precision and single-precision instructions) - FEAT_FPAC (Faulting on AUT* instructions) - FEAT_FPACCOMBINE (Faulting on combined pointer authentication instructions) - FEAT_FPACC_SPEC (Speculative behavior of combined pointer authentication instructions)
@@ -159,6 +160,7 @@ the following architecture extensions: - FEAT_SME_F64F64 (Double-precision floating-point outer product instructions) - FEAT_SME_I16I64 (16-bit to 64-bit integer widening outer product instructions) - FEAT_SME_LUTv2 (Lookup table instructions with 4-bit indices and 8-bit elements) +- FEAT_SSVE_FP8FMA (SVE2 FP8 multiply-accumulate to half-precision and single-precision instructions in Streaming SVE mode) - FEAT_SVE (Scalable Vector Extension) - FEAT_SVE_AES (Scalable Vector AES instructions) - FEAT_SVE_B16B16 (Non-widening BFloat16 arithmetic for SVE2)
Signature · 1 line
2.43.0