target/arm: Implement FEAT_FP8
v9 cover target/arm: Implement FEAT_FP8
Changes for v9:
- Include 3 arm patches from the fp internals patch set.
- Generalize TRANS_FEAT_STREAMING_SME2 to TRANS_FEAT_STREAMING_IF, pulled from an in-progress FEAT_SVE2p2 tree.
Changes for v8:
- 23 patches upstream
- Rebase adjustments
- Rewrite arm_init_fp_status per feedback
r~
Richard Henderson (45):
target/arm: Use FloatParts64 in bfdotadd_ebf
target/arm: Drop oddstatus from is_ebf and bfdotadd_ebf target/arm: Use FloatParts64 in f16_dotadd
target/arm: Generalize TRANS_FEAT_STREAMING_SME2 target/arm: Introduce arm_init_fp_status
target/arm: Set e4m3_nan_is_snan
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: Implement FDOT (FP8 to FP32) for AdvSIMD target/arm: Implement FDOT (FP8 to FP32) for SVE target/arm: Enable FEAT_FP8DOT4, FEAT_SSVE_FP8DOT4 for -cpu max target/arm: Implement FDOT (FP8 to FP16) for AdvSIMD target/arm: Implement FDOT (FP8 to FP16) for SVE target/arm: Enable FEAT_FP8DOT2, FEAT_SSVE_FP8DOT2 for -cpu max target/arm: Implement FMMLA (FP8 to FP32) for AdvSIMD target/arm: Implement FMMLA (FP8 to FP32) for SVE target/arm: Enable FEAT_F8F32MM for -cpu max
target/arm: Implement FMMLA (FP8 to FP16) for AdvSIMD target/arm: Implement FMMLA (FP8 to FP16) for SVE target/arm: Enable FEAT_F8F16MM for -cpu max
target/arm/cpu-features.h | 83 +++ target/arm/helper-fp8.h | 14 + target/arm/tcg/helper-defs.h | 6 + target/arm/tcg/helper-fp8-defs.h | 40 ++ target/arm/tcg/helper-sme-defs.h | 2 +- target/arm/tcg/translate-a64.h | 1 + target/arm/tcg/translate.h | 7 +- target/arm/tcg/vec_internal.h | 12 +- linux-user/aarch64/elfload.c | 13 + target/arm/cpu.c | 20 +- target/arm/tcg/cpu64.c | 16 + target/arm/tcg/fp8_helper.c | 858 +++++++++++++++++++++++++++++++ target/arm/tcg/sme_helper.c | 104 ++-- target/arm/tcg/translate-a64.c | 160 ++++++ target/arm/tcg/translate-sme.c | 71 ++- target/arm/tcg/translate-sve.c | 245 ++++++++- target/arm/tcg/vec_helper.c | 193 ++++--- docs/system/arm/emulation.rst | 11 + target/arm/tcg/a64.decode | 39 ++ target/arm/tcg/meson.build | 1 + target/arm/tcg/sme.decode | 25 +- target/arm/tcg/sve.decode | 48 +- 22 files changed, 1814 insertions(+), 155 deletions(-) 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
Signature · 1 line
2.43.0
PATCH v9 1/45 target/arm: Use FloatParts64 in bfdotadd_ebf
Use softfloat-parts.h so that we can more naturally perform the required operations witha single rounding step. This happens to also simplify the NaN detection step.
Message-Id: <[email protected]>
--- target/arm/tcg/vec_helper.c | 77 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 37 deletions(-)
target/arm/tcg/vec_helper.c +40 -37
@@ -22,6 +22,7 @@#include "helper.h" #include "tcg/tcg-gvec-desc.h" #include "fpu/softfloat.h" +#include "fpu/softfloat-parts.h" #include "qemu/int128.h" #include "crypto/clmul.h" #include "vec_internal.h"
@@ -2895,61 +2896,63 @@ float32 bfdotadd(float32 sum, uint32_t e1, uint32_t e2, float_status *fpst)float32 bfdotadd_ebf (float32 sum,uint32_t e1,uint32_t e2,float_status *fpst,float_status *fpst_odd) { +/* Unpack two BFloat16 into two Float32, trivially. */ float32 s1r = e1 <<16 ;float32 s1c = e1 &0xffff0000u ;float32 s2r = e2 <<16 ;float32 s2c = e2 &0xffff0000u ;float32 t32; +/* +* Compare f16_dotadd() in sme_helper.c, but here we have +* bfloat16 inputs. In particular that means that we do not +* want the FPCR.FZ16 flush semantics, so we use the normal +* float_status for the input handling here. +*/ +FloatParts64 p1r =float32_unpack_canonical (s1r, fpst); +FloatParts64 p1c =float32_unpack_canonical (s1c, fpst); +FloatParts64 p2r =float32_unpack_canonical (s2r, fpst); +FloatParts64 p2c =float32_unpack_canonical (s2c, fpst); + +int all_mask = (float_cmask (p1r.cls) |float_cmask (p1c.cls) | +float_cmask (p1r.cls) |float_cmask (p1c.cls)); +/* C.f. FPProcessNaNs4 */ -if (float32_is_any_nan (s1r) ||float32_is_any_nan (s1c) || -float32_is_any_nan (s2r) ||float32_is_any_nan (s2c)) { -if (float32_is_signaling_nan (s1r, fpst)) { - t32 = s1r; - }else if (float32_is_signaling_nan (s1c, fpst)) { - t32 = s1c; - }else if (float32_is_signaling_nan (s2r, fpst)) { - t32 = s2r; - }else if (float32_is_signaling_nan (s2c, fpst)) { - t32 = s2c; - }else if (float32_is_any_nan (s1r)) { - t32 = s1r; - }else if (float32_is_any_nan (s1c)) { - t32 = s1c; - }else if (float32_is_any_nan (s2r)) { - t32 = s2r; +if (unlikely (all_mask & float_cmask_anynan)) { +if (unlikely (all_mask & float_cmask_snan)) { +if (p1r.cls == float_class_snan) { + t32 = s1r; + }else if (p1c.cls == float_class_snan) { + t32 = s1c; + }else if (p2r.cls == float_class_snan) { + t32 = s2r; + }else { + t32 = s2c; + } }else { - t32 = s2c; +if (p1r.cls == float_class_qnan) { + t32 = s1r; + }else if (p1c.cls == float_class_qnan) { + t32 = s1c; + }else if (p2r.cls == float_class_qnan) { + t32 = s2r; + }else { + t32 = s2c; + } }/* * FPConvertNaN(FPProcessNaN(t32)) will be done as part * of the final addition below. */ }else { -/* -* Compare f16_dotadd() in sme_helper.c, but here we have -* bfloat16 inputs. In particular that means that we do not -* want the FPCR.FZ16 flush semantics, so we use the normal -* float_status for the input handling here. -*/ -float64 e1r =float32_to_float64 (s1r, fpst); -float64 e1c =float32_to_float64 (s1c, fpst); -float64 e2r =float32_to_float64 (s2r, fpst); -float64 e2c =float32_to_float64 (s2c, fpst); -float64 t64; -/* * The ARM pseudocode function FPDot performs both multiplies -* and the add with a single rounding operation. Emulate this -* by performing the first multiply in round-to-odd, then doing -* the second multiply as fused multiply-add, and rounding to -* float32 all in one step. +* and the add with a single rounding operation. */ - t64 =float64_mul (e1r, e2r, fpst_odd); - t64 =float64r32_muladd (e1c, e2c, t64,0 , fpst); +FloatParts64 tmp =parts64_mul (&p1r, &p2r, fpst); + tmp =parts64_muladd (&p1c, &p2c, &tmp,0 , fpst); -/* This conversion is exact, because we've already rounded. */ - t32 =float64_to_float32 (t64, fpst); + t32 =float32_round_pack_canonical (&tmp, fpst); }/* The final accumulation step is not fused. */
Signature · 1 line
2.43.0
PATCH v9 2/45 target/arm: Drop oddstatus from is_ebf and bfdotadd_ebf
In reply to Richard HendersonThis argument is no longer used.
Message-Id: <[email protected]>
--- target/arm/tcg/vec_internal.h | 12 +++------ target/arm/tcg/sme_helper.c | 6 ++--- target/arm/tcg/vec_helper.c | 50 +++++++++++++++-------------------- 3 files changed, 29 insertions(+), 39 deletions(-)
target/arm/tcg/vec_internal.h +4 -8
@@ -271,7 +271,6 @@ float32 bfdotadd(float32 sum, uint32_t e1, uint32_t e2, float_status *fpst);* @sum: addend * @e1, @e2: multiplicand vectors * @fpst: floating-point status to use -* @fpst_odd: floating-point status to use for round-to-odd operations * * BFloat16 2-way dot product of @e1 & @e2, accumulating with @sum. * The @e1 and @e2 operands correspond to the 32-bit source vector
@@ -280,23 +279,20 @@ float32 bfdotadd(float32 sum, uint32_t e1, uint32_t e2, float_status *fpst);* Corresponds to the ARM pseudocode function BFDotAdd, specialized * for the FPCR.EBF == 1 case. */ -float32 bfdotadd_ebf (float32 sum,uint32_t e1,uint32_t e2, -float_status *fpst,float_status *fpst_odd); +float32 bfdotadd_ebf (float32 sum,uint32_t e1,uint32_t e2,float_status *fpst);/** * is_ebf: * @env: CPU state * @statusp: pointer to floating point status to fill in -* @oddstatusp: pointer to floating point status to fill in for round-to-odd * * Determine whether a BFDotAdd operation should use FPCR.EBF = 0 -* or FPCR.EBF = 1 semantics. On return, has initialized *statusp -* and *oddstatusp to suitable float_status arguments to use with either -* bfdotadd() or bfdotadd_ebf(). +* or FPCR.EBF = 1 semantics. On return, has initialized *statusp as suitable +* for float_status arguments to either bfdotadd() or bfdotadd_ebf(). * Returns true for EBF = 1, false for EBF = 0. (The caller should use this * to decide whether to call bfdotadd() or bfdotadd_ebf().) */ -bool is_ebf (CPUARMState *env,float_status *statusp,float_status *oddstatusp); +bool is_ebf (CPUARMState *env,float_status *statusp);/* * Negate as for FPCR.AH=1 -- do not negate NaNs.
target/arm/tcg/sme_helper.c +3 -3
@@ -1429,9 +1429,9 @@ static void do_bfmopa_w(void *vza, void *vzn, void *vzm, uint32_t desc, uint32_t negx, bool ah_neg) { intptr_t row, col, oprsz = simd_maxsz(desc); -float_status fpst, fpst_odd; +float_status fpst; -if (is_ebf (env, &fpst, &fpst_odd)) { +if (is_ebf (env, &fpst)) {for (row =0 ; row < oprsz; ) {uint16_t prow = pn[H2 (row >>4 )]; do {
@@ -1452,7 +1452,7 @@ static void do_bfmopa_w(void *vza, void *vzn, void *vzm,uint32_t m = *(uint32_t *)(vzm +H1_4 (col)); m =f16mop_adj_pair (m, pcol,0 ); - *a =bfdotadd_ebf (*a, n, m, &fpst, &fpst_odd); + *a =bfdotadd_ebf (*a, n, m, &fpst); } col +=4 ; pcol >>=4 ;
target/arm/tcg/vec_helper.c +22 -28
119 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v9 3/45 target/arm: Use FloatParts64 in f16_dotadd
In reply to Richard HendersonUse softfloat-parts.h so that we can more naturally perform the required operations witha single rounding step. This happens to also simplify the NaN detection step.
Message-Id: <[email protected]>
--- target/arm/tcg/sme_helper.c | 96 ++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 56 deletions(-)
target/arm/tcg/sme_helper.c +40 -56
@@ -27,6 +27,7 @@#include "accel/tcg/helper-retaddr.h" #include "qemu/int128.h" #include "fpu/softfloat.h" +#include "fpu/softfloat-parts.h" #include "vec_internal.h" #include "sve_ldst_internal.h"
@@ -1221,18 +1222,15 @@ static inline uint32_t bf16mop_ah_neg_adj_pair(uint32_t pair, uint32_t pg) }static float32 f16_dotadd (float32 sum,uint32_t e1,uint32_t e2, -float_status *s_f16,float_status *s_std, -float_status *s_odd) +float_status *s_f16,float_status *s_std) {/* -* We need three different float_status for different parts of this +* We need two different float_status for different parts of this * operation: * - the input conversion of the float16 values must use the * f16-specific float_status, so that the FPCR.FZ16 control is applied * - operations on float32 including the final accumulation must use * the normal float_status, so that FPCR.FZ is applied -* - we have pre-set-up copy of s_std which is set to round-to-odd, -* for the multiply (see below) */ float16 h1r = e1 &0xffff ;float16 h1c = e1 >>16 ;
@@ -1240,48 +1238,49 @@ static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2,float16 h2c = e2 >>16 ;float32 t32; +FloatParts64 p1r =float16_unpack_canonical (h1r, s_f16); +FloatParts64 p1c =float16_unpack_canonical (h1c, s_f16); +FloatParts64 p2r =float16_unpack_canonical (h2r, s_f16); +FloatParts64 p2c =float16_unpack_canonical (h2c, s_f16); + +int all_mask = (float_cmask (p1r.cls) |float_cmask (p1c.cls) | +float_cmask (p1r.cls) |float_cmask (p1c.cls)); +/* C.f. FPProcessNaNs4 */ -if (float16_is_any_nan (h1r) ||float16_is_any_nan (h1c) || -float16_is_any_nan (h2r) ||float16_is_any_nan (h2c)) { +if (unlikely (all_mask & float_cmask_anynan)) {float16 t16; -if (float16_is_signaling_nan (h1r, s_f16)) { - t16 = h1r; - }else if (float16_is_signaling_nan (h1c, s_f16)) { - t16 = h1c; - }else if (float16_is_signaling_nan (h2r, s_f16)) { - t16 = h2r; - }else if (float16_is_signaling_nan (h2c, s_f16)) { - t16 = h2c; - }else if (float16_is_any_nan (h1r)) { - t16 = h1r; - }else if (float16_is_any_nan (h1c)) { - t16 = h1c; - }else if (float16_is_any_nan (h2r)) { - t16 = h2r; +if (unlikely (all_mask & float_cmask_snan)) { +if (p1r.cls == float_class_snan) { + t16 = h1r; + }else if (p1c.cls == float_class_snan) { + t16 = h1c; + }else if (p2r.cls == float_class_snan) { + t16 = h2r; + }else { + t16 = h2c; + } }else { - t16 = h2c; +if (p1r.cls == float_class_qnan) { + t16 = h1r; + }else if (p1c.cls == float_class_qnan) { + t16 = h1c; + }else if (p2r.cls == float_class_qnan) { + t16 = h2r; + }else { + t16 = h2c; + } } t32 =float16_to_float32 (t16, true, s_f16); }else { -float64 e1r =float16_to_float64 (h1r, true, s_f16); -float64 e1c =float16_to_float64 (h1c, true, s_f16); -float64 e2r =float16_to_float64 (h2r, true, s_f16); -float64 e2c =float16_to_float64 (h2c, true, s_f16); -float64 t64; -/* * The ARM pseudocode function FPDot performs both multiplies -* and the add with a single rounding operation. Emulate this -* by performing the first multiply in round-to-odd, then doing -* the second multiply as fused multiply-add, and rounding to -* float32 all in one step. +* and the add with a single rounding operation. */ - t64 =float64_mul (e1r, e2r, s_odd); - t64 =float64r32_muladd (e1c, e2c, t64,0 , s_std); +FloatParts64 tmp =parts64_mul (&p1r, &p2r, s_std); + tmp =parts64_muladd (&p1c, &p2c, &tmp,0 , s_std); -/* This conversion is exact, because we've already rounded. */ - t32 =float64_to_float32 (t64, s_std); + t32 =float32_round_pack_canonical (&tmp, s_std); }/* The final accumulation step is not fused. */
@@ -1293,9 +1292,6 @@ static void do_fmopa_w_h(void *vza, void *vzn, void *vzm, uint16_t *pn, uint32_t negx, bool ah_neg) { intptr_t row, col, oprsz = simd_maxsz(desc); -float_status fpst_odd = env->vfp.fp_status[FPST_ZA ]; - -set_float_rounding_mode (float_round_to_odd, &fpst_odd);for (row =0 ; row < oprsz; ) {uint16_t prow = pn[H2 (row >>4 )];
@@ -1319,8 +1315,7 @@ static void do_fmopa_w_h(void *vza, void *vzn, void *vzm, uint16_t *pn, m =f16mop_adj_pair (m, pcol,0 ); *a =f16_dotadd (*a, n, m, &env->vfp.fp_status[FPST_ZA_F16 ], - &env->vfp.fp_status[FPST_ZA ], - &fpst_odd); + &env->vfp.fp_status[FPST_ZA ]); } col +=4 ; pcol >>=4 ;
@@ -1357,15 +1352,12 @@ void HELPER(sme2_fdot_h)(void *vd, void *vn, void *vm, void *va,bool za =extract32 (desc,SIMD_DATA_SHIFT ,1 );float_status *fpst_std = &env->vfp.fp_status[za ?FPST_ZA :FPST_A64 ];float_status *fpst_f16 = &env->vfp.fp_status[za ?FPST_ZA_F16 :FPST_A64_F16 ]; -float_status fpst_odd = *fpst_std;float32 *d = vd, *a = va;uint32_t *n = vn, *m = vm; -set_float_rounding_mode (float_round_to_odd, &fpst_odd); -for (i =0 ; i < oprsz /sizeof (float32); ++i) { d[H4 (i)] =f16_dotadd (a[H4 (i)], n[H4 (i)], m[H4 (i)], - fpst_f16, fpst_std, &fpst_odd); + fpst_f16, fpst_std); } }
@@ -1379,17 +1371,14 @@ void HELPER(sme2_fdot_idx_h)(void *vd, void *vn, void *vm, void *va,bool za =extract32 (desc,SIMD_DATA_SHIFT +2 ,1 );float_status *fpst_std = &env->vfp.fp_status[za ?FPST_ZA :FPST_A64 ];float_status *fpst_f16 = &env->vfp.fp_status[za ?FPST_ZA_F16 :FPST_A64_F16 ]; -float_status fpst_odd = *fpst_std;float32 *d = vd, *a = va;uint32_t *n = vn, *m = (uint32_t *)vm +H4 (idx); -set_float_rounding_mode (float_round_to_odd, &fpst_odd); -for (i =0 ; i < elements; i += eltspersegment) {uint32_t mm = m[i];for (j =0 ; j < eltspersegment; ++j) { d[H4 (i + j)] =f16_dotadd (a[H4 (i + j)], n[H4 (i + j)], mm, - fpst_f16, fpst_std, &fpst_odd); + fpst_f16, fpst_std); } } }
@@ -1402,24 +1391,19 @@ void HELPER(sme2_fvdot_idx_h)(void *vd, void *vn, void *vm, void *va,intptr_t eltspersegment =MIN (4 , elements);int idx =extract32 (desc,SIMD_DATA_SHIFT ,2 );int sel =extract32 (desc,SIMD_DATA_SHIFT +2 ,1 ); -float_status fpst_odd, *fpst_std, *fpst_f16;float32 *d = vd, *a = va;uint16_t *n0 = vn;uint16_t *n1 = vn +sizeof (ARMVectorReg);uint32_t *m = (uint32_t *)vm +H4 (idx); - fpst_std = &env->vfp.fp_status[FPST_ZA ]; - fpst_f16 = &env->vfp.fp_status[FPST_ZA_F16 ]; - fpst_odd = *fpst_std; -set_float_rounding_mode (float_round_to_odd, &fpst_odd); -for (i =0 ; i < elements; i += eltspersegment) {uint32_t mm = m[i];for (j =0 ; j < eltspersegment; ++j) {uint32_t nn = (n0[H2 (2 * (i + j) + sel)]) | (n1[H2 (2 * (i + j) + sel)] <<16 ); d[i +H4 (j)] =f16_dotadd (a[i +H4 (j)], nn, mm, - fpst_f16, fpst_std, &fpst_odd); + &env->vfp.fp_status[FPST_ZA_F16 ], + &env->vfp.fp_status[FPST_ZA ]); } } }
Signature · 1 line
2.43.0
Re: [PATCH v9 03/45] target/arm: Use FloatParts64 in f16_dotadd
Quoted 15 lines · Richard Henderson
Use
softfloat-parts.hso that we can more naturally perform the required operations witha single rounding step. This happens to also simplify the NaN detection step.Signed-off-by Richard Henderson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
--- target/arm/tcg/sme_helper.c | 96 ++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 56 deletions(-)
Review static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2, · line 1247
Quoted 10 lines
(quoted diff) +7
-0@@ -1240,48 +1238,49 @@ static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2, float16 h2c = e2 >> 16; float32 t32; + FloatParts64 p1r = float16_unpack_canonical(h1r, s_f16); + FloatParts64 p1c = float16_unpack_canonical(h1c, s_f16); + FloatParts64 p2r = float16_unpack_canonical(h2r, s_f16); + FloatParts64 p2c = float16_unpack_canonical(h2c, s_f16); + + int all_mask = (float_cmask(p1r.cls) | float_cmask(p1c.cls) | + float_cmask(p1r.cls) | float_cmask(p1c.cls));
This looks like a cut-and-paste error : we don't take account of p2r.cls and p2c.cls, so if those inputs are NaNs we won't handle them correctly. This should fix it:
target/arm/tcg/sme_helper.c +0 -0
@@ -1244,7 +1244,7 @@ static float32 f16_dotadd(float32 sum, uint32_t
e1, uint32_t e2,
FloatParts64 p2c = float16_unpack_canonical(h2c, s_f16);
int all_mask = (float_cmask(p1r.cls) | float_cmask(p1c.cls) |
- float_cmask(p1r.cls) | float_cmask(p1c.cls)); + float_cmask(p2r.cls) | float_cmask(p2c.cls));
/* C.f. FPProcessNaNs4 */
if (unlikely(all_mask & float_cmask_anynan)) {thanks
-- PMM
Re: [PATCH v9 03/45] target/arm: Use FloatParts64 in f16_dotadd
Quoted 43 lines · Peter Maydell
Quoted 15 lines · Richard Henderson
Use
softfloat-parts.hso that we can more naturally perform the required operations witha single rounding step. This happens to also simplify the NaN detection step.Signed-off-by Richard Henderson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
--- target/arm/tcg/sme_helper.c | 96 ++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 56 deletions(-)Review static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2, · line 1247
Quoted 10 lines
(quoted diff) +7
-0@@ -1240,48 +1238,49 @@ static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2, float16 h2c = e2 >> 16; float32 t32; + FloatParts64 p1r = float16_unpack_canonical(h1r, s_f16); + FloatParts64 p1c = float16_unpack_canonical(h1c, s_f16); + FloatParts64 p2r = float16_unpack_canonical(h2r, s_f16); + FloatParts64 p2c = float16_unpack_canonical(h2c, s_f16); + + int all_mask = (float_cmask(p1r.cls) | float_cmask(p1c.cls) | + float_cmask(p1r.cls) | float_cmask(p1c.cls));This looks like a cut-and-paste error : we don't take account of p2r.cls and p2c.cls, so if those inputs are NaNs we won't handle them correctly. This should fix it:
target/arm/tcg/sme_helper.c +1
-1@@ -1244,7 +1244,7 @@ static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2, FloatParts64 p2c = float16_unpack_canonical(h2c, s_f16);int all_mask = (float_cmask (p1r.cls) |float_cmask (p1c.cls) | -float_cmask (p1r.cls) |float_cmask (p1c.cls)); +float_cmask (p2r.cls) |float_cmask (p2c.cls));/* C.f. FPProcessNaNs4 */
Quoted 1 line
if (unlikely(all_mask & float_cmask_anynan)) {Gah. Same error in patch 1.
r~
Re: [PATCH v9 03/45] target/arm: Use FloatParts64 in f16_dotadd
In reply to Richard HendersonQuoted 30 lines · Richard Henderson
Use
softfloat-parts.hso that we can more naturally perform the required operations witha single rounding step. This happens to also simplify the NaN detection step.Signed-off-by Richard Henderson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
---target/arm/tcg/sme_helper.c +1
-6@@ -27,6 +27,7 @@#include "accel/tcg/helper-retaddr.h" #include "qemu/int128.h" #include "fpu/softfloat.h" +#include "fpu/softfloat-parts.h" #include "vec_internal.h" #include "sve_ldst_internal.h" }else { -float64 e1r =float16_to_float64 (h1r, true, s_f16); -float64 e1c =float16_to_float64 (h1c, true, s_f16); -float64 e2r =float16_to_float64 (h2r, true, s_f16); -float64 e2c =float16_to_float64 (h2c, true, s_f16); -float64 t64; -/* * The ARM pseudocode function FPDot performs both multiplies
target/arm/tcg/sme_helper.c
Quoted 10 lines
target/arm/tcg/sme_helper.c +3
-6-* and the add with a single rounding operation. Emulate this -* by performing the first multiply in round-to-odd, then doing -* the second multiply as fused multiply-add, and rounding to -* float32 all in one step. +* and the add with a single rounding operation. */ - t64 =float64_mul (e1r, e2r, s_odd); - t64 =float64r32_muladd (e1c, e2c, t64,0 , s_std); +FloatParts64 tmp =parts64_mul (&p1r, &p2r, s_std); + tmp =parts64_muladd (&p1c, &p2c, &tmp,0 , s_std);
This change results in our incorrectly reporting an input-denormal-used exception when FPCR.AH=1 and some of the halfprec inputs are denormal. (For AH=1 we are supposed to set IDC for input-denormal-used only for single and double precision inputs, not for halfprec. We achieve that by having vfp_get_fpsr_from_host() mask out the input_denormal_used flag from FPST_STD_F16.)
I think this worked previously because we did a float_to_float conversion using the f16 status (float_to_float consumes an input denormal, which we don't report because we use the f16 status), and any f16 denormal is not a denormal in f64 and so the 64-bit ops never see an input denormal, so using s_std wasn't a problem ? (Also, for the operation using s_odd that is a copy of an fp_status so any exception flags set there never get copied back to the live version. Presumably we relied on it never being able to generate an exception?)
I think it might be right to use s_f16 instead of s_std in these three operations:
@@ -1277,10 +1277,10 @@ static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2,
* The ARM pseudocode function FPDot performs both multiplies
* and the add with a single rounding operation. */
- FloatParts64 tmp = parts64_mul(&p1r, &p2r, s_std); - tmp = parts64_muladd(&p1c, &p2c, &tmp, 0, s_std); + FloatParts64 tmp = parts64_mul(&p1r, &p2r, s_f16); + tmp = parts64_muladd(&p1c, &p2c, &tmp, 0, s_f16);
- t32 = float32_round_pack_canonical(&tmp, s_std);
+ t32 = float32_round_pack_canonical(&tmp, s_f16);
}
/* The final accumulation step is not fused. */I think it doesn't matter whether we use s_std or s_f16 in the final round-and-pack step, because the only differences between the F16 and normal fpstatus are to do with input denormals (separate flush-to-zero control, and different denormal-consumed reporting), and that happens in the "unpack" and "do operation" steps; nothing cares in "pack". I went with s_f16 because we usually do the whole "unpack; operation; pack" sequence with a single fp status.
thanks
-- PMM
Re: [PATCH v9 03/45] target/arm: Use FloatParts64 in f16_dotadd
Quoted 41 lines · Peter Maydell
Quoted 39 lines · Richard Henderson
Use
softfloat-parts.hso that we can more naturally perform the required operations witha single rounding step. This happens to also simplify the NaN detection step.Signed-off-by Richard Henderson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
---target/arm/tcg/sme_helper.c +3
-12@@ -27,6 +27,7 @@#include "accel/tcg/helper-retaddr.h" #include "qemu/int128.h" #include "fpu/softfloat.h" +#include "fpu/softfloat-parts.h" #include "vec_internal.h" #include "sve_ldst_internal.h" }else { -float64 e1r =float16_to_float64 (h1r, true, s_f16); -float64 e1c =float16_to_float64 (h1c, true, s_f16); -float64 e2r =float16_to_float64 (h2r, true, s_f16); -float64 e2c =float16_to_float64 (h2c, true, s_f16); -float64 t64; -/* * The ARM pseudocode function FPDot performs both multiplies -* and the add with a single rounding operation. Emulate this -* by performing the first multiply in round-to-odd, then doing -* the second multiply as fused multiply-add, and rounding to -* float32 all in one step. +* and the add with a single rounding operation. */ - t64 =float64_mul (e1r, e2r, s_odd); - t64 =float64r32_muladd (e1c, e2c, t64,0 , s_std); +FloatParts64 tmp =parts64_mul (&p1r, &p2r, s_std);
Quoted 8 lines
Quoted 1 line
+ tmp =
parts64_muladd(&p1c, &p2c, &tmp, 0, s_std);This change results in our incorrectly reporting an input-denormal-used exception when FPCR.AH=1 and some of the halfprec inputs are denormal. (For AH=1 we are supposed to set IDC for input-denormal-used only for single and double precision inputs, not for halfprec. We achieve that by having
vfp_get_fpsr_from_host()mask out theinput_denormal_usedflag fromFPST_STD_F16.)
Oh, right.
Quoted 7 lines
I think this worked previously because we did a
float_to_floatconversion using the f16 status (float_to_floatconsumes an input denormal, which we don't report because we use the f16 status), and any f16 denormal is not a denormal in f64 and so the 64-bit ops never see an input denormal, so usings_stdwasn't a problem ?
That sounds right.
Quoted 4 lines
(Also, for the operation using
s_oddthat
is a copy of anfp_statusso any exception flags set there never get copied back to the live version. Presumably we relied on it never being able to generate an exception?)
I didn't think we were relying on that, only avoiding swapping rounding mode for each vector element.
Quoted 8 lines
I think it doesn't matter whether we use
s_stdors_f16in the final round-and-pack step, because the only differences between the F16 and normal fpstatus are to do with input denormals (separate flush-to-zero control, and different denormal-consumed reporting), and that happens in the "unpack" and "do operation" steps; nothing cares in "pack". I went withs_f16because we usually do the whole "unpack; operation; pack" sequence with a single fp status.
Yep, thanks.
r~
PATCH v9 4/45 target/arm: Generalize TRANS_FEAT_STREAMING_SME2
In reply to Richard HendersonRename to TRANS_FEAT_STREAMING_IF and add a new parameter.
--- target/arm/tcg/translate.h | 6 +++--- target/arm/tcg/translate-sve.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-)
target/arm/tcg/translate.h +3 -3
@@ -877,12 +877,12 @@ static inline void gen_restore_rmode(TCGv_i32 old, TCGv_ptr fpst)/* * For SVE insns which are only valid in Streaming SVE mode when -* SME2 is implemented +* FEAT_STREAM is implemented. */ -#define TRANS_FEAT_STREAMING_SME2 (NAME ,FEAT ,FUNC , ...) \ +#define TRANS_FEAT_STREAMING_IF (NAME ,FEAT ,FEAT_STREAM ,FUNC , ...) \ static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ { \ - s->is_nonstreaming = !dc_isar_feature(aa64_sme2, s); \ + s->is_nonstreaming = !dc_isar_feature(FEAT_STREAM, s); \ return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); \ }
target/arm/tcg/translate-sve.c +6 -6
@@ -4261,9 +4261,9 @@ static gen_helper_gvec_4_ptr * const sve2_famax_zpzz_fns[4] = { gen_helper_sve2_famax_s, gen_helper_sve2_famax_d }; -TRANS_FEAT_STREAMING_SME2 (FAMAX , aa64_sme2_or_sve2_faminmax, - gen_gvec_fpst_arg_zpzz, - sve2_famax_zpzz_fns[a->esz], a) +TRANS_FEAT_STREAMING_IF (FAMAX , aa64_sme2_or_sve2_faminmax, aa64_sme2, + gen_gvec_fpst_arg_zpzz, + sve2_famax_zpzz_fns[a->esz], a)static gen_helper_gvec_4_ptr *const sve2_famin_zpzz_fns[4 ] = { NULL,
@@ -4271,9 +4271,9 @@ static gen_helper_gvec_4_ptr * const sve2_famin_zpzz_fns[4] = { gen_helper_sve2_famin_s, gen_helper_sve2_famin_d }; -TRANS_FEAT_STREAMING_SME2 (FAMIN , aa64_sme2_or_sve2_faminmax, - gen_gvec_fpst_arg_zpzz, - sve2_famin_zpzz_fns[a->esz], a) +TRANS_FEAT_STREAMING_IF (FAMIN , aa64_sme2_or_sve2_faminmax, aa64_sme2, + gen_gvec_fpst_arg_zpzz, + sve2_famin_zpzz_fns[a->esz], a)typedef void gen_helper_sve_fp2scalar (TCGv_ptr ,TCGv_ptr ,TCGv_ptr ,TCGv_i64 ,TCGv_ptr ,TCGv_i32 );
Signature · 1 line
2.43.0
Re: [PATCH v9 04/45] target/arm: Generalize TRANS_FEAT_STREAMING_SME2
Quoted 4 lines · Richard Henderson
Rename to
TRANS_FEAT_STREAMING_IFand add a new parameter.Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v9 5/45 target/arm: Introduce arm_init_fp_status
In reply to Richard HendersonCreate a function to set all default controls for a float_status. Other settings for specific FPST will be set afterward.
--- target/arm/cpu.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
target/arm/cpu.c +11 -8
@@ -304,6 +304,13 @@ static void cp_reg_check_reset(gpointer key, gpointer value, gpointer opaque)assert (oldvalue == newvalue); } +static void arm_init_fp_status (float_status *s) +{ +memset (s,0 ,sizeof (*s)); +arm_set_default_fp_behaviours (s); +/* We want 0 for all other settings. */ +} +static void arm_cpu_reset_hold (Object *obj,ResetType type) {CPUState *cs =CPU (obj);
@@ -626,20 +633,16 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) env->sau.ctrl =0 ; } +for (int i =0 ; i <FPST_COUNT ; i++) { +arm_init_fp_status (&env->vfp.fp_status[i]); + } +set_flush_to_zero (1 , &env->vfp.fp_status[FPST_STD ]);set_flush_inputs_to_zero (1 , &env->vfp.fp_status[FPST_STD ]);set_default_nan_mode (1 , &env->vfp.fp_status[FPST_STD ]);set_default_nan_mode (1 , &env->vfp.fp_status[FPST_STD_F16 ]);set_default_nan_mode (1 , &env->vfp.fp_status[FPST_ZA ]);set_default_nan_mode (1 , &env->vfp.fp_status[FPST_ZA_F16 ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_A32 ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_A64 ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_ZA ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_STD ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_A32_F16 ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_A64_F16 ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_ZA_F16 ]); -arm_set_default_fp_behaviours (&env->vfp.fp_status[FPST_STD_F16 ]);arm_set_ah_fp_behaviours (&env->vfp.fp_status[FPST_AH ]);set_flush_to_zero (1 , &env->vfp.fp_status[FPST_AH ]);set_flush_inputs_to_zero (1 , &env->vfp.fp_status[FPST_AH ]);
Signature · 1 line
2.43.0
Re: [PATCH v9 05/45] target/arm: Introduce arm_init_fp_status
Quoted 6 lines · Richard Henderson
Create a function to set all default controls for a
float_status. Other settings for specific FPST will be set afterward.Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v9 6/45 target/arm: Set e4m3_nan_is_snan
In reply to Richard HendersonThe unique e4m3 nan encoding is SNaN for Arm.
--- target/arm/cpu.c | 1 + 1 file changed, 1 insertion(+)
target/arm/cpu.c +1 -0
@@ -308,6 +308,7 @@ static void arm_init_fp_status(float_status *s) {memset (s,0 ,sizeof (*s));arm_set_default_fp_behaviours (s); +set_float_e4m3_nan_is_snan (true, s);/* We want 0 for all other settings. */ }
Signature · 1 line
2.43.0
Re: [PATCH v9 06/45] target/arm: Set e4m3_nan_is_snan
Quoted 5 lines · Richard Henderson
The unique e4m3 nan encoding is SNaN for Arm.
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v9 7/45 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 | 124 +++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 34 +++++++++ target/arm/tcg/a64.decode | 3 + target/arm/tcg/meson.build | 1 + 7 files changed, 183 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 +124 -0
124 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.
@@ -10695,6 +10714,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
@@ -1921,6 +1921,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
@@ -41,6 +41,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 v9 8/45 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 | 16 ++++++++++++++++ target/arm/tcg/translate-sve.c | 23 +++++++++++++++++++++++ target/arm/tcg/sve.decode | 6 ++++++ 5 files changed, 52 insertions(+)
target/arm/cpu-features.h +6 -0
@@ -1653,6 +1653,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 +16 -0
@@ -122,3 +122,19 @@ void HELPER(advsimd_bfcvtl)(void *vd, void *vn, CPUARMState *env, uint32_t desc)fp8_cvt_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 ); +fp8_input_fn *input_fmt = fp8_input_fmt[ctx.f8fmt]; +uint8_t *n = vn; +uint16_t *d = vd; +size_t nelem =simd_oprsz (desc) /2 ; + +for (size_t i =0 ; i < nelem; ++i) { + d[H2 (i)] =fcvt_fp8_to_b16 (n[H1 (2 * i + ctx.high)], + input_fmt, ctx.scale, &ctx.stat); + } + +fp8_cvt_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"
@@ -4068,6 +4069,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_STREAMING_IF (BF1CVT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + do_f8cvt, a, gen_helper_sve2_bfcvt, false, false) +TRANS_FEAT_STREAMING_IF (BF2CVT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + do_f8cvt, a, gen_helper_sve2_bfcvt, true, false) +TRANS_FEAT_STREAMING_IF (BF1CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + do_f8cvt, a, gen_helper_sve2_bfcvt, false, true) +TRANS_FEAT_STREAMING_IF (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + 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
Re: [PATCH v9 08/45] target/arm: Implement BF1CVT, BF1CVTLT, BF2CVT, BF2CVTLT for SVE
Quoted 9 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 6 ++++++ target/arm/tcg/helper-fp8-defs.h | 1 + target/arm/tcg/fp8_helper.c | 16 ++++++++++++++++ target/arm/tcg/translate-sve.c | 23 +++++++++++++++++++++++ target/arm/tcg/sve.decode | 6 ++++++ 5 files changed, 52 insertions(+)
thanks
-- PMM
PATCH v9 9/45 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 , - s->fpcr_ah ? FPST_AH : FPST_A64, gen_helper_sme2_bfcvt) +TRANS_FEAT (BFCVT_hs, aa64_sme2, do_zz_fpst, a,0 , + s->fpcr_ah ? FPST_AH : FPST_A64, gen_helper_sme2_bfcvt_hs)TRANS_FEAT (BFCVTN , aa64_sme2, do_zz_fpst, a,0 , s->fpcr_ah ? FPST_AH : 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 v9 10/45 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 | 47 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 19 +++++++++++++ target/arm/tcg/sme.decode | 5 ++++ 4 files changed, 73 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 +47 -0
50 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
Re: [PATCH v9 10/45] target/arm: Implement BF1CVT, BF1CVTL, BF2CVT, BF2CVTL for SME
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/helper-fp8-defs.h | 2 ++ target/arm/tcg/fp8_helper.c | 47 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 19 +++++++++++++ target/arm/tcg/sme.decode | 5 ++++ 4 files changed, 73 insertions(+)
thanks
-- PMM
PATCH v9 11/45 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 | 29 +++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 3 +++ target/arm/tcg/a64.decode | 3 +++ 4 files changed, 37 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 +29 -0
@@ -103,6 +103,14 @@ static bfloat16 fcvt_fp8_to_b16(uint8_t x, fp8_input_fn *f8fmt,return bfloat16_round_pack_canonical (&p, s); } +static float16 fcvt_fp8_to_f16 (uint8_t x,fp8_input_fn *f8fmt, +int scale,float_status *s) +{ +FloatParts64 p =f8fmt (x, s); + p =parts64_scalbn (&p, scale, s); +return float16_round_pack_canonical (&p, s); +} +void HELPER (advsimd_bfcvtl )(void *vd,void *vn,CPUARMState *env,uint32_t desc) {FP8Context ctx =fp8_src_start (env, desc,0x3f );
@@ -123,6 +131,27 @@ void HELPER(advsimd_bfcvtl)(void *vd, void *vn, CPUARMState *env, uint32_t desc)clear_tail (vd,16 ,simd_maxsz (desc)); } +void HELPER (advsimd_fcvtl_hb )(void *vd,void *vn, +CPUARMState *env,uint32_t desc) +{ +FP8Context ctx =fp8_src_start (env, desc,0xf ); +fp8_input_fn *input_fmt = fp8_input_fmt[ctx.f8fmt]; +uint8_t *n = vn, scratch[16 ]; +float16 *d = vd; + +if (vd == vn) { + n =memcpy (scratch, vn,16 ); + } + n += ctx.high *8 ; + +for (size_t i =0 ; i <8 ; ++i) { + d[H2 (i)] =fcvt_fp8_to_f16 (n[H1 (i)], input_fmt, ctx.scale, &ctx.stat); + } + +fp8_cvt_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 );
target/arm/tcg/translate-a64.c +3 -0
@@ -10726,6 +10726,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
@@ -1921,6 +1921,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
Re: [PATCH v9 11/45] target/arm: Implement F1CVTL, F1CVTL2, F2CVTL, F2CVTL2 for AdvSIMD
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v9 12/45 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 | 16 ++++++++++++++++ target/arm/tcg/translate-sve.c | 9 +++++++++ target/arm/tcg/sve.decode | 5 +++++ 4 files changed, 31 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 +16 -0
@@ -168,6 +168,22 @@ void HELPER(sve2_bfcvt)(void *vd, void *vn, CPUARMState *env, uint32_t desc)fp8_cvt_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 ); +fp8_input_fn *input_fmt = fp8_input_fmt[ctx.f8fmt]; +uint8_t *n = vn; +uint16_t *d = vd; +size_t nelem =simd_oprsz (desc) /2 ; + +for (size_t i =0 ; i < nelem; ++i) { + d[H2 (i)] =fcvt_fp8_to_f16 (n[H1 (2 * i + ctx.high)], + input_fmt, ctx.scale, &ctx.stat); + } + +fp8_cvt_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
@@ -4082,6 +4082,15 @@ static bool do_f8cvt(DisasContext *s, arg_rr_esz *a,return true; } +TRANS_FEAT_STREAMING_IF (F1CVT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + do_f8cvt, a, gen_helper_sve2_fcvt_hb, false, false) +TRANS_FEAT_STREAMING_IF (F2CVT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + do_f8cvt, a, gen_helper_sve2_fcvt_hb, true, false) +TRANS_FEAT_STREAMING_IF (F1CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + do_f8cvt, a, gen_helper_sve2_fcvt_hb, false, true) +TRANS_FEAT_STREAMING_IF (F2CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, + do_f8cvt, a, gen_helper_sve2_fcvt_hb, true, true) +TRANS_FEAT_STREAMING_IF (BF1CVT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, do_f8cvt, a, gen_helper_sve2_bfcvt, false, false) TRANS_FEAT_STREAMING_IF(BF2CVT, aa64_sme2_or_sve2_f8cvt, aa64_sme2,
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
Re: [PATCH v9 12/45] target/arm: Implement F1CVT, F1CVTLT, F2CVT, F2CVTLT for SVE
Quoted 3 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v9 13/45 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 | 47 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 5 ++++ target/arm/tcg/sme.decode | 5 ++++ 4 files changed, 59 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 +47 -0
56 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
Re: [PATCH v9 13/45] target/arm: Implement F1CVT, F1CVTL, F2CVT, F2CVTL for SME
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/helper-fp8-defs.h | 2 ++ target/arm/tcg/fp8_helper.c | 47 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 5 ++++ target/arm/tcg/sme.decode | 5 ++++ 4 files changed, 59 insertions(+)
thanks
-- PMM
PATCH v9 14/45 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 | 92 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 3 ++ target/arm/tcg/sve.decode | 2 + 4 files changed, 99 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 +92 -0
107 lines not on this page · raw message
target/arm/tcg/translate-sve.c +3 -0
@@ -4100,6 +4100,9 @@ TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2,TRANS_FEAT_STREAMING_IF (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, 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
Re: [PATCH v9 14/45] target/arm: Implement BFCVTN for SVE
target/arm/tcg/translate-sve.c TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2, · line 4104
Quoted 13 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>target/arm/tcg/translate-sve.c +2
-0@@ -4100,6 +4100,9 @@ TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2,TRANS_FEAT_STREAMING_IF (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, 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)
The pseudocode has
if IsFeatureImplemented(FEAT_SME2) then CheckSVEEnabled(); else CheckNonStreamingSVEEnabled(); end;
so shouldn't this be TRANS_FEAT_STREAMING_IF(..., aa64_sme2, ...) ?
Otherwise
thanks
-- PMM
Re: [PATCH v9 14/45] target/arm: Implement BFCVTN for SVE
Quoted 18 lines · Peter Maydell
target/arm/tcg/translate-sve.c TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2, · line 4104
Quoted 13 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>target/arm/tcg/translate-sve.c +2
-0@@ -4100,6 +4100,9 @@ TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2,TRANS_FEAT_STREAMING_IF (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, 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)The pseudocode has
Quoted 4 lines
if
IsFeatureImplemented(FEAT_SME2)then CheckSVEEnabled(); else CheckNonStreamingSVEEnabled(); end;so shouldn't this be
TRANS_FEAT_STREAMING_IF(..., aa64_sme2, ...)?
Yep.
r~
PATCH v9 15/45 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 | 37 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 15 +++++++++++++ target/arm/tcg/a64.decode | 2 ++ 4 files changed, 56 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 +37 -0
@@ -180,6 +180,13 @@ static uint8_t fcvt_b16_to_fp8(bfloat16 x, fcvt_fp8_output_fn *f8fmt,return f8fmt (&p, scale, saturate, s); } +static uint8_t fcvt_f16_to_fp8 (float16 x,fcvt_fp8_output_fn *f8fmt, +int scale,bool saturate,float_status *s) +{ +FloatParts64 p =float16_unpack_canonical (x, s); +return f8fmt (&p, scale, saturate, s); +} +void HELPER (advsimd_bfcvtl )(void *vd,void *vn,CPUARMState *env,uint32_t desc) {FP8Context ctx =fp8_src_start (env, desc,0x3f );
@@ -369,3 +376,33 @@ void HELPER(sve2_bfcvtn_bh)(void *vd, void *vn, CPUARMState *env, uint32_t desc)fp8_cvt_finish (env, &ctx); } + +void HELPER (gvec_fcvt_bh )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8Context ctx =fp8_dst_start (env, desc, true); +fcvt_fp8_output_fn *output_fmt = fcvt_fp8_output_fmt[ctx.f8fmt]; +uint16_t *n = vn; +uint16_t *m = vm; +uint8_t *d = vd; +bool osc =FIELD_EX64 (env->vfp.fpmr,FPMR ,OSC ); +size_t oprsz =simd_oprsz (desc); +size_t nelem = oprsz /2 ; +ARMVectorReg scratch; + +if (vd == vm) { + m =memcpy (&scratch, vm, oprsz); + } + +for (size_t i =0 ; i < nelem; ++i) { + d[H1 (i)] =fcvt_f16_to_fp8 (n[H2 (i)], output_fmt, + ctx.scale, osc, &ctx.stat); + } +for (size_t i =0 ; i < nelem; ++i) { + d[H1 (i) + nelem] =fcvt_f16_to_fp8 (m[H2 (i)], output_fmt, + ctx.scale, osc, &ctx.stat); + } + +fp8_cvt_finish (env, &ctx); +clear_tail (vd, oprsz,simd_maxsz (desc)); +}
target/arm/tcg/translate-a64.c +15 -0
@@ -6605,6 +6605,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
@@ -1212,6 +1212,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
Re: [PATCH v9 15/45] target/arm: Implement FCVTN (16- to 8-bit fp) for AdvSIMD
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/helper-fp8-defs.h | 2 ++ target/arm/tcg/fp8_helper.c | 37 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 15 +++++++++++++ target/arm/tcg/a64.decode | 2 ++ 4 files changed, 56 insertions(+)
thanks
-- PMM
PATCH v9 16/45 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 | 33 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 16 ++++++++++++++++ target/arm/tcg/a64.decode | 1 + 4 files changed, 52 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 +33 -0
@@ -187,6 +187,13 @@ static uint8_t fcvt_f16_to_fp8(float16 x, fcvt_fp8_output_fn *f8fmt,return f8fmt (&p, scale, saturate, s); } +static uint8_t fcvt_f32_to_fp8 (float32 x,fcvt_fp8_output_fn *f8fmt, +int scale,bool saturate,float_status *s) +{ +FloatParts64 p =float32_unpack_canonical (x, s); +return f8fmt (&p, scale, saturate, s); +} +void HELPER (advsimd_bfcvtl )(void *vd,void *vn,CPUARMState *env,uint32_t desc) {FP8Context ctx =fp8_src_start (env, desc,0x3f );
@@ -406,3 +413,29 @@ void HELPER(gvec_fcvt_bh)(void *vd, void *vn, void *vm,fp8_cvt_finish (env, &ctx);clear_tail (vd, oprsz,simd_maxsz (desc)); } + +void HELPER (advsimd_fcvt_bs )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8Context ctx =fp8_dst_start (env, desc, false); +fcvt_fp8_output_fn *output_fmt = fcvt_fp8_output_fmt[ctx.f8fmt]; +uint32_t *n = vn, *m = vm, scratch[4 ]; +uint8_t *d = vd +8 * ctx.high; +bool osc =FIELD_EX64 (env->vfp.fpmr,FPMR ,OSC ); + +if (vd == vm) { + m =memcpy (scratch, vm,16 ); + } + +for (size_t i =0 ; i <4 ; ++i) { + d[H1 (i +0 )] =fcvt_f32_to_fp8 (n[H4 (i)], output_fmt, + ctx.scale, osc, &ctx.stat); + } +for (size_t i =0 ; i <4 ; ++i) { + d[H1 (i +4 )] =fcvt_f32_to_fp8 (m[H4 (i)], output_fmt, + ctx.scale, osc, &ctx.stat); + } + +fp8_cvt_finish (env, &ctx); +clear_tail (vd, ctx.high ?16 :8 ,simd_maxsz (desc)); +}
target/arm/tcg/translate-a64.c +16 -0
@@ -6620,6 +6620,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
@@ -1213,6 +1213,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
Re: [PATCH v9 16/45] target/arm: Implement FCVTN, FCVTN2 (32- to 8-bit fp) for AdvSIMD
Quoted 3 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v9 17/45 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 | 23 +++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 2 ++ target/arm/tcg/sve.decode | 1 + 4 files changed, 27 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 +23 -0
@@ -414,6 +414,29 @@ 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, true); +fcvt_fp8_output_fn *output_fmt = fcvt_fp8_output_fmt[ctx.f8fmt]; +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 ; + +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_fp8 (e0, output_fmt, + ctx.scale, osc, &ctx.stat); + d[H1 (2 * i +1 )] =fcvt_f16_to_fp8 (e1, output_fmt, + ctx.scale, osc, &ctx.stat); + } + +fp8_cvt_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
@@ -4100,6 +4100,8 @@ TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2,TRANS_FEAT_STREAMING_IF (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, 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
Re: [PATCH v9 17/45] target/arm: Implement FCVTN (16- to 8-bit fp) for SVE
target/arm/tcg/translate-sve.c TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2, · line 4104
Quoted 9 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>target/arm/tcg/translate-sve.c +2
-0@@ -4100,6 +4100,8 @@ TRANS_FEAT_STREAMING_IF(BF1CVTLT, aa64_sme2_or_sve2_f8cvt, aa64_sme2,TRANS_FEAT_STREAMING_IF (BF2CVTLT , aa64_sme2_or_sve2_f8cvt, aa64_sme2, 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)
This also I think should be streaming-if-SME2.
Otherwise
thanks
-- PMM
PATCH v9 18/45 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 | 47 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 4 +++ target/arm/tcg/sve.decode | 2 ++ 4 files changed, 55 insertions(+)
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 +47 -0
50 lines not on this page · raw message
target/arm/tcg/translate-sve.c +4 -0
@@ -4104,6 +4104,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=2 +FCVTNT 01100101 00 001 010 001111 ....0 ..... @rd_rnx2 esz=2 ### SVE FP Compare with Zero Group
Signature · 1 line
2.43.0
Re: [PATCH v9 18/45] target/arm: Implement FCVTNB, FCVTNT for SVE
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>target/arm/tcg/translate-sve.c +0
-0
target/arm/tcg/translate-sve.c TRANS_FEAT(FCVTN, aa64_sme2_or_sve2_f8cvt, do_f8cvt, · line 4110
Quoted 7 lines
target/arm/tcg/translate-sve.c +4
-0@@ -4104,6 +4104,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)
Also only streaming if SME2.
Otherwise
thanks
-- PMM
PATCH v9 19/45 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
Re: [PATCH v9 19/45] target/arm: Implement FCVT (FP16 to FP8) for SME
Quoted 6 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/translate-sme.c | 16 ++++++++++++++++ target/arm/tcg/sme.decode | 2 ++ 2 files changed, 18 insertions(+)
thanks
-- PMM
PATCH v9 20/45 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 | 59 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-sme.c | 3 ++ target/arm/tcg/sme.decode | 3 ++ 4 files changed, 67 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 +59 -0
62 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
Re: [PATCH v9 20/45] target/arm: Implement FCVT, FCVTN (FP32 to FP8) for SME
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v9 21/45 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
@@ -5488,6 +5488,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
@@ -1355,6 +1355,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
Re: [PATCH v9 21/45] target/arm: Implement LUTI2, LUTI4 for AdvSIMD
Quoted 9 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- 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(+)
thanks
-- PMM
PATCH v9 22/45 target/arm: Implement LUTI2, LUTI4 for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 6 +++ target/arm/tcg/translate.h | 1 + target/arm/tcg/translate-a64.c | 1 + target/arm/tcg/translate-sve.c | 68 ++++++++++++++++++++++++++++++++++ target/arm/tcg/sve.decode | 11 +++++- 5 files changed, 86 insertions(+), 1 deletion(-)
target/arm/cpu-features.h +6 -0
@@ -1659,6 +1659,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 +1 -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;
target/arm/tcg/translate-a64.c +1 -0
@@ -10903,6 +10903,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
Re: [PATCH v9 22/45] target/arm: Implement LUTI2, LUTI4 for SVE
Quoted 3 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v9 23/45 target/arm: Enable FEAT_LUT for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 1 + target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 3 files changed, 3 insertions(+)
linux-user/aarch64/elfload.c +1 -0
@@ -221,6 +221,7 @@ abi_ulong get_elf_hwcap2(CPUState *cs)GET_FEATURE_ID (aa64_lse128,ARM_HWCAP2_A64_LSE128 );GET_FEATURE_ID (aa64_faminmax,ARM_HWCAP2_A64_FAMINMAX );GET_FEATURE_ID (aa64_fpmr,ARM_HWCAP2_A64_FPMR ); +GET_FEATURE_ID (aa64_lut,ARM_HWCAP2_A64_LUT );return hwcaps; }
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 ,2 );/* FEAT_CSSC, FEAT_CMPBR */ + 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
@@ -102,6 +102,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
Re: [PATCH v9 23/45] target/arm: Enable FEAT_LUT for -cpu max
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v9 24/45 target/arm: Enable FEAT_FP8 for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 3 +++ target/arm/tcg/cpu64.c | 6 ++++++ docs/system/arm/emulation.rst | 1 + 3 files changed, 10 insertions(+)
linux-user/aarch64/elfload.c +3 -0
@@ -222,6 +222,9 @@ abi_ulong get_elf_hwcap2(CPUState *cs)GET_FEATURE_ID (aa64_faminmax,ARM_HWCAP2_A64_FAMINMAX );GET_FEATURE_ID (aa64_fpmr,ARM_HWCAP2_A64_FPMR );GET_FEATURE_ID (aa64_lut,ARM_HWCAP2_A64_LUT ); +GET_FEATURE_ID (aa64_f8cvt,ARM_HWCAP2_A64_F8CVT | +ARM_HWCAP2_A64_F8E4M3 | +ARM_HWCAP2_A64_F8E5M2 );return hwcaps; }
target/arm/tcg/cpu64.c +6 -0
@@ -1392,6 +1392,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
@@ -75,6 +75,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
Re: [PATCH v9 24/45] target/arm: Enable FEAT_FP8 for -cpu max
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/aarch64/elfload.c | 3 +++ target/arm/tcg/cpu64.c | 6 ++++++ docs/system/arm/emulation.rst | 1 + 3 files changed, 10 insertions(+)
thanks
-- PMM
PATCH v9 25/45 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
@@ -397,17 +397,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 v9 26/45 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
@@ -1580,6 +1580,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
Re: [PATCH v9 26/45] target/arm: Implement MOVT (vector to table)
Quoted 3 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v9 27/45 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
@@ -1653,6 +1653,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
Re: [PATCH v9 27/45] target/arm: Implement LUTI4 (four registers, 8-bit)
Quoted 9 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- 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(+)
thanks
-- PMM
PATCH v9 28/45 target/arm: Enable FEAT_SME_LUTv2 for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 1 + target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 3 files changed, 3 insertions(+)
linux-user/aarch64/elfload.c +1 -0
@@ -222,6 +222,7 @@ abi_ulong get_elf_hwcap2(CPUState *cs)GET_FEATURE_ID (aa64_faminmax,ARM_HWCAP2_A64_FAMINMAX );GET_FEATURE_ID (aa64_fpmr,ARM_HWCAP2_A64_FPMR );GET_FEATURE_ID (aa64_lut,ARM_HWCAP2_A64_LUT ); +GET_FEATURE_ID (aa64_sme2p1_lutv2,ARM_HWCAP2_A64_SME_LUTV2 );GET_FEATURE_ID (aa64_f8cvt,ARM_HWCAP2_A64_F8CVT |ARM_HWCAP2_A64_F8E4M3 |ARM_HWCAP2_A64_F8E5M2 );
target/arm/tcg/cpu64.c +1 -0
@@ -1389,6 +1389,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
@@ -160,6 +160,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
Re: [PATCH v9 28/45] target/arm: Enable FEAT_SME_LUTv2 for -cpu max
Quoted 3 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v9 29/45 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
@@ -1600,6 +1600,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
@@ -7467,6 +7467,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
@@ -1215,6 +1217,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
@@ -1333,6 +1338,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
Re: [PATCH v9 29/45] target/arm: Implement FMLALB, FMLALT for AdvSIMD
Quoted 17 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
target/arm/tcg/fp8_helper.c +13
-0+ +static FP8MulContext fp8_mul_start (CPUARMState *env,int scale_mask) +{ +uint64_t fpmr = env->vfp.fpmr; + +FP8MulContext ret = { + .stat = env->vfp.fp_status[FPST_A64 ], + .fmt1 = fp8_input_fmt[FIELD_EX64 (fpmr,FPMR ,F8S1 )], + .fmt2 = fp8_input_fmt[FIELD_EX64 (fpmr,FPMR ,F8S2 )], + .scale = -(FIELD_EX64 (fpmr,FPMR ,LSCALE ) & scale_mask), + }; + +set_flush_to_zero (0 , &ret.stat);
target/arm/tcg/fp8_helper.c void HELPER(sme2_fcvtn_bs)(void *vd, void *vn, CPUARMState *env, uint32_t desc) · line 600
Quoted 10 lines
target/arm/tcg/fp8_helper.c +10
-0+set_flush_inputs_to_zero (0 , &ret.stat); +set_default_nan_mode (true, &ret.stat); +set_float_rounding_mode (FIELD_EX64 (fpmr,FPMR ,OSM ) + ? float_round_nearest_even_max + : float_round_nearest_even, &ret.stat); + +/* +* FP8 multiplies don't update FPSR.{IDC,IOC,IXC,UFC}. +* Since this is multiply-add, DZC does not apply and only OFC remains. +*/
I think this comment hasn't been updated to match the code changes following our previous discussion about what fp status flags FP8 multiplies update:
https://lore.kernel.org/qemu-devel/CAFEAcA_4wU+wndbAqjnObpvnLit11OVDZvTZ1RWy_q0cNfH7uA@mail.gmail.com/
We ended up concluding that we don't need to update any FPSR flags, but the comment still talks about the OFC bit.
Perhaps something like:
/*
* FP8 multiplies don't update any of the FPSR exception flags,
* so we do not need an fp8_mul_finish() to propagate status
* changes back from ret.stat into env->vfp.fp_status[]. */
?
Otherwise
thanks
-- PMM
PATCH v9 30/45 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
@@ -1555,6 +1555,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
@@ -8355,3 +8355,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
Re: [PATCH v9 30/45] target/arm: Implement FMLALB, FMLALT (FP8 to FP16) for SVE
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 33 +++++++++++++++++++++++++++++++++ target/arm/tcg/sve.decode | 7 +++++++ 3 files changed, 45 insertions(+)
thanks
-- PMM
PATCH v9 31/45 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 | 55 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 3 ++ target/arm/tcg/a64.decode | 7 ++++ 4 files changed, 68 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 +55 -0
64 lines not on this page · raw message
target/arm/tcg/translate-a64.c +3 -0
@@ -7483,6 +7483,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
@@ -1220,6 +1220,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
@@ -1341,6 +1345,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
Re: [PATCH v9 31/45] target/arm: Implement FMLALL{BB, BT, TB, TT} for AdvSIMD
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v9 32/45 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
@@ -8388,3 +8388,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
Re: [PATCH v9 32/45] target/arm: Implement FMLALL{BB, BT, TB, TT} for SVE
Quoted 6 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/translate-sve.c | 3 +++ target/arm/tcg/sve.decode | 5 +++++ 2 files changed, 8 insertions(+)
thanks
-- PMM
PATCH v9 33/45 target/arm: Enable FEAT_FP8FMA, FEAT_SSVE_FP8FMA for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 2 ++ target/arm/tcg/cpu64.c | 2 ++ docs/system/arm/emulation.rst | 2 ++ 3 files changed, 6 insertions(+)
linux-user/aarch64/elfload.c +2 -0
@@ -226,6 +226,8 @@ abi_ulong get_elf_hwcap2(CPUState *cs)GET_FEATURE_ID (aa64_f8cvt,ARM_HWCAP2_A64_F8CVT |ARM_HWCAP2_A64_F8E4M3 |ARM_HWCAP2_A64_F8E5M2 ); +GET_FEATURE_ID (aa64_f8fma,ARM_HWCAP2_A64_F8FMA ); +GET_FEATURE_ID (aa64_ssve_f8fma,ARM_HWCAP2_A64_SME_SF8FMA );return hwcaps; }
target/arm/tcg/cpu64.c +2 -0
@@ -1378,6 +1378,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 */
@@ -1396,6 +1397,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
@@ -76,6 +76,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)
@@ -161,6 +162,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
Re: [PATCH v9 33/45] target/arm: Enable FEAT_FP8FMA, FEAT_SSVE_FP8FMA for -cpu max
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/aarch64/elfload.c | 2 ++ target/arm/tcg/cpu64.c | 2 ++ docs/system/arm/emulation.rst | 2 ++ 3 files changed, 6 insertions(+)
thanks
-- PMM
PATCH v9 34/45 target/arm: Implement FDOT (FP8 to FP32) 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 | 39 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 30 ++++++++++++++++++++++++ target/arm/tcg/a64.decode | 4 ++++ 5 files changed, 81 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1610,6 +1610,11 @@ static inline bool isar_feature_aa64_f8fma(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8FMA ); } +static inline bool isar_feature_aa64_f8dp4 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8DP4 ); +} +/* * Combinations of feature tests, for ease of use with TRANS_FEAT. */
target/arm/tcg/helper-fp8-defs.h +3 -0
@@ -29,3 +29,6 @@ DEF_HELPER_FLAGS_5(gvec_fmla_idx_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, 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) + +DEF_HELPER_FLAGS_5(gvec_fdot_sb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_5 (gvec_fdot_idx_sb,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +39 -0
@@ -728,3 +728,42 @@ void HELPER(gvec_fmla_idx_sb)(void *vd, void *vn, void *vm,clear_tail (vd, oprsz,simd_maxsz (desc)); } + +void HELPER (gvec_fdot_sb )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8MulContext ctx =fp8_mul_start (env,-1 ); +size_t oprsz =simd_oprsz (desc); +size_t nelem = oprsz /4 ; +uint32_t *n = vn; +uint32_t *m = vm; +float32 *d = vd; + +for (size_t i =0 ; i < nelem; i++) { + d[i] =f8dotadd_s (n[i], m[i],4 , d[i], &ctx); + } + +clear_tail (vd, oprsz,simd_maxsz (desc)); +} + +void HELPER (gvec_fdot_idx_sb )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8MulContext ctx =fp8_mul_start (env,-1 ); +size_t idx =simd_data (desc); +size_t oprsz =simd_oprsz (desc); +size_t nelem = oprsz /4 ; +uint32_t *n = vn; +uint32_t *m = vm; +float32 *d = vd; +size_t i =0 ; + +do { +uint32_t e1 = m[i +H4 (idx)]; +do { + d[i] =f8dotadd_s (n[i], e1,4 , d[i], &ctx); + }while (++i %4 !=0 ); + }while (i < nelem); + +clear_tail (vd, oprsz,simd_maxsz (desc)); +}
target/arm/tcg/translate-a64.c +30 -0
@@ -7486,6 +7486,36 @@ 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_f8dot (DisasContext *s,arg_qrrr_e *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, a->q ?16 :8 ,vec_full_reg_size (s), +0 , fn); + } +return true; +} + +TRANS_FEAT(FDOT_sb_v, aa64_f8dp4, do_f8dot, a, gen_helper_gvec_fdot_sb) + +static bool do_f8dot_idx (DisasContext *s,arg_qrrx_e *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, a->q ?16 :8 ,vec_full_reg_size (s), + a->idx, fn); + } +return true; +} + +TRANS_FEAT(FDOT_sb_vi, aa64_f8dp4, do_f8dot_idx, a, gen_helper_gvec_fdot_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 +4 -0
@@ -1224,6 +1224,8 @@ FMLAL_hb_v 0 idxn:1 00 1110 110 rm:5 11111 1 rn:5 rd:5 \ FMLALL_sb_v 0.00 1110 0.0 rm:5 110001 rn:5 rd:5 \ &rxx idxm=0 idxn=%fmlall_idxn +FDOT_sb_v 0.00 1110 000 ..... 11111 1 ..... ..... @qrrr_s + ### Advanced SIMD scalar x indexed element FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
@@ -1348,6 +1350,8 @@ FMLAL_hb_vi 0 idxn:1 00 1111 11 ... rm:3 0000 . 0 rn:5 rd:5 \ FMLALL_sb_vi 0 . 10 1111 0 . ... rm:3 1000 . 0 rn:5 rd:5 \ &rxx idxm=%hlm4 idxn=%fmlall_idxn +FDOT_sb_vi 0.00 1111 00 . ..... 0000 . 0 ..... ..... @qrrx_s + # 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
Re: [PATCH v9 34/45] target/arm: Implement FDOT (FP8 to FP32) for AdvSIMD
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 5 ++++ target/arm/tcg/helper-fp8-defs.h | 3 +++ target/arm/tcg/fp8_helper.c | 39 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 30 ++++++++++++++++++++++++ target/arm/tcg/a64.decode | 4 ++++
thanks
-- PMM
PATCH v9 35/45 target/arm: Implement FDOT (FP8 to FP32) for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 35 ++++++++++++++++++++++++++++++++++ target/arm/tcg/sve.decode | 4 ++++ 3 files changed, 44 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1560,6 +1560,11 @@ 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_ssve_f8dp4 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,SF8DP4 ); +} +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 +35 -0
@@ -8391,3 +8391,38 @@ 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) + +static bool do_f8dp4 (DisasContext *s,gen_helper_gvec_3_ptr *fn, +int rd,int rn,int rm,int index) +{ +bool fp8dp4 =dc_isar_feature (aa64_f8dp4, s); +bool ssve_fp8dp4 =dc_isar_feature (aa64_ssve_f8dp4, s); +bool ok = false; + +/* Feature detection and enabling are complex here. */ +if (!(ssve_fp8dp4 || (fp8dp4 &&dc_isar_feature (aa64_sve2, s)))) { +return false; + } +if (fpmr_access_check (s)) { +if (fp8dp4) { + s->is_nonstreaming = !ssve_fp8dp4; + 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, rd), +vec_full_reg_offset (s, rn), +vec_full_reg_offset (s, rm), + tcg_env, vsz, vsz, + index, fn); + } +return true; +} + +TRANS(FDOT_sb, do_f8dp4, gen_helper_gvec_fdot_sb, a->rd, a->rn, a->rm, 0) +TRANS (FDOT_idx_sb, do_f8dp4, gen_helper_gvec_fdot_idx_sb, + a->rd, a->rn, a->rm, a->index)
target/arm/tcg/sve.decode +4 -0
@@ -1874,6 +1874,8 @@ FMLALL_sb 01100100 00 1 rm:5 10 idxn:2 10 rn:5 rd:5 &rxx idxm=0 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 +FDOT_sb 01100100 01 1 ..... 10 0 00 1 ..... ..... @rda_rn_rm_ex esz=2 + ### SVE2 floating-point multiply-add long (indexed) FMLALB_zzxw 01100100 10 1 ..... 0100.0 ..... ..... @rrxr_3a esz=2
@@ -1897,6 +1899,8 @@ FMLALL_idx_sb 01100100 idxn:2 1 .. rm:3 1100 .. rn:5 rd:5 \ FDOT_zzxz 01100100 00 1 ..... 010000 ..... ..... @rrxr_2 esz=2 BFDOT_zzxz 01100100 01 1 ..... 010000 ..... ..... @rrxr_2 esz=2 +FDOT_idx_sb 01100100 01 1 ..... 010001 ..... ..... @rrxr_2 esz=2 + ### SVE broadcast predicate element &psel esz pd pn pm rv imm
Signature · 1 line
2.43.0
Re: [PATCH v9 35/45] target/arm: Implement FDOT (FP8 to FP32) for SVE
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v9 36/45 target/arm: Enable FEAT_FP8DOT4, FEAT_SSVE_FP8DOT4 for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 2 ++ target/arm/tcg/cpu64.c | 2 ++ docs/system/arm/emulation.rst | 2 ++ 3 files changed, 6 insertions(+)
linux-user/aarch64/elfload.c +2 -0
@@ -227,7 +227,9 @@ abi_ulong get_elf_hwcap2(CPUState *cs)ARM_HWCAP2_A64_F8E4M3 | ARM_HWCAP2_A64_F8E5M2);GET_FEATURE_ID (aa64_f8fma,ARM_HWCAP2_A64_F8FMA ); +GET_FEATURE_ID (aa64_f8dp4,ARM_HWCAP2_A64_F8DP4 );GET_FEATURE_ID (aa64_ssve_f8fma,ARM_HWCAP2_A64_SME_SF8FMA ); +GET_FEATURE_ID (aa64_ssve_f8dp4,ARM_HWCAP2_A64_SME_SF8DP4 );return hwcaps; }
target/arm/tcg/cpu64.c +2 -0
@@ -1378,6 +1378,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 ,SF8DP4 ,1 );/* FEAT_SSVE_FP8DOT4 */ 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 */
@@ -1397,6 +1398,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 ,F8DP4 ,1 );/* FEAT_FP8DOT4 */ 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
@@ -76,6 +76,7 @@ the following architecture extensions: - FEAT_FP (Floating Point extensions) - FEAT_FP16 (Half-precision floating-point data processing) - FEAT_FP8 (FP8 convert instructions) +- FEAT_FP8DOT4 (FP8 4-way dot product to single-precision 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)
@@ -162,6 +163,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_FP8DOT4 (SVE2 FP8 4-way dot product to single-precision instructions in Streaming SVE mode) - 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)
Signature · 1 line
2.43.0
Re: [PATCH v9 36/45] target/arm: Enable FEAT_FP8DOT4, FEAT_SSVE_FP8DOT4 for -cpu max
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/aarch64/elfload.c | 2 ++ target/arm/tcg/cpu64.c | 2 ++ docs/system/arm/emulation.rst | 2 ++ 3 files changed, 6 insertions(+)
thanks
-- PMM
PATCH v9 37/45 target/arm: Implement FDOT (FP8 to FP16) 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 | 39 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 2 ++ target/arm/tcg/a64.decode | 2 ++ 5 files changed, 51 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1620,6 +1620,11 @@ static inline bool isar_feature_aa64_f8dp4(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8DP4 ); } +static inline bool isar_feature_aa64_f8dp2 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8DP2 ); +} +/* * Combinations of feature tests, for ease of use with TRANS_FEAT. */
target/arm/tcg/helper-fp8-defs.h +3 -0
@@ -32,3 +32,6 @@ DEF_HELPER_FLAGS_5(gvec_fmla_idx_sb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, DEF_HELPER_FLAGS_5(gvec_fdot_sb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fdot_idx_sb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_5(gvec_fdot_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_5 (gvec_fdot_idx_hb,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +39 -0
@@ -767,3 +767,42 @@ void HELPER(gvec_fdot_idx_sb)(void *vd, void *vn, void *vm,clear_tail (vd, oprsz,simd_maxsz (desc)); } + +void HELPER (gvec_fdot_hb )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8MulContext ctx =fp8_mul_start (env,0xf ); +size_t oprsz =simd_oprsz (desc); +size_t nelem = oprsz /2 ; +uint16_t *n = vn; +uint16_t *m = vm; +float16 *d = vd; + +for (size_t i =0 ; i < nelem; i++) { + d[i] =f8dotadd_h (n[i], m[i],2 , d[i], &ctx); + } + +clear_tail (vd, oprsz,simd_maxsz (desc)); +} + +void HELPER (gvec_fdot_idx_hb )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8MulContext ctx =fp8_mul_start (env,0xf ); +size_t idx =simd_data (desc); +size_t oprsz =simd_oprsz (desc); +size_t nelem = oprsz /2 ; +uint16_t *n = vn; +uint16_t *m = vm; +float16 *d = vd; +size_t i =0 ; + +do { +uint16_t e1 = m[i +H2 (idx)]; +do { + d[i] =f8dotadd_h (n[i], e1,2 , d[i], &ctx); + }while (++i %8 !=0 ); + }while (i < nelem); + +clear_tail (vd, oprsz,simd_maxsz (desc)); +}
target/arm/tcg/translate-a64.c +2 -0
@@ -7500,6 +7500,7 @@ static bool do_f8dot(DisasContext *s, arg_qrrr_e *a, } TRANS_FEAT(FDOT_sb_v, aa64_f8dp4, do_f8dot, a, gen_helper_gvec_fdot_sb) +TRANS_FEAT(FDOT_hb_v, aa64_f8dp2, do_f8dot, a, gen_helper_gvec_fdot_hb)static bool do_f8dot_idx (DisasContext *s,arg_qrrx_e *a,gen_helper_gvec_3_ptr *fn)
@@ -7515,6 +7516,7 @@ static bool do_f8dot_idx(DisasContext *s, arg_qrrx_e *a, } TRANS_FEAT(FDOT_sb_vi, aa64_f8dp4, do_f8dot_idx, a, gen_helper_gvec_fdot_idx_sb) +TRANS_FEAT(FDOT_hb_vi, aa64_f8dp2, do_f8dot_idx, a, gen_helper_gvec_fdot_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 +2 -0
@@ -1225,6 +1225,7 @@ FMLALL_sb_v 0.00 1110 0.0 rm:5 110001 rn:5 rd:5 \ &rxx idxm=0 idxn=%fmlall_idxn FDOT_sb_v 0.00 1110 000 ..... 11111 1 ..... ..... @qrrr_s +FDOT_hb_v 0.00 1110 010 ..... 11111 1 ..... ..... @qrrr_h ### Advanced SIMD scalar x indexed element
@@ -1351,6 +1352,7 @@ FMLALL_sb_vi 0 . 10 1111 0 . ... rm:3 1000 . 0 rn:5 rd:5 \ &rxx idxm=%hlm4 idxn=%fmlall_idxn FDOT_sb_vi 0.00 1111 00 . ..... 0000 . 0 ..... ..... @qrrx_s +FDOT_hb_vi 0.00 1111 01 .. .... 0000 . 0 ..... ..... @qrrx_h # Floating-point conditional select
Signature · 1 line
2.43.0
Re: [PATCH v9 37/45] target/arm: Implement FDOT (FP8 to FP16) for AdvSIMD
Quoted 9 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 5 ++++ target/arm/tcg/helper-fp8-defs.h | 3 +++ target/arm/tcg/fp8_helper.c | 39 ++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 2 ++ target/arm/tcg/a64.decode | 2 ++ 5 files changed, 51 insertions(+)
thanks
-- PMM
PATCH v9 38/45 target/arm: Implement FDOT (FP8 to FP16) for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 35 ++++++++++++++++++++++++++++++++++ target/arm/tcg/sve.decode | 2 ++ 3 files changed, 42 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1565,6 +1565,11 @@ static inline bool isar_feature_aa64_ssve_f8dp4(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,SF8DP4 ); } +static inline bool isar_feature_aa64_ssve_f8dp2 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,SF8DP2 ); +} +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 +35 -0
@@ -8426,3 +8426,38 @@ static bool do_f8dp4(DisasContext *s, gen_helper_gvec_3_ptr *fn, TRANS(FDOT_sb, do_f8dp4, gen_helper_gvec_fdot_sb, a->rd, a->rn, a->rm, 0)TRANS (FDOT_idx_sb, do_f8dp4, gen_helper_gvec_fdot_idx_sb, a->rd, a->rn, a->rm, a->index) + +static bool do_f8dp2 (DisasContext *s,gen_helper_gvec_3_ptr *fn, +int rd,int rn,int rm,int index) +{ +bool fp8dp2 =dc_isar_feature (aa64_f8dp2, s); +bool ssve_fp8dp2 =dc_isar_feature (aa64_ssve_f8dp2, s); +bool ok = false; + +/* Feature detection and enabling are complex here. */ +if (!(ssve_fp8dp2 || (fp8dp2 &&dc_isar_feature (aa64_sve2, s)))) { +return false; + } +if (fpmr_access_check (s)) { +if (fp8dp2) { + s->is_nonstreaming = !ssve_fp8dp2; + 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, rd), +vec_full_reg_offset (s, rn), +vec_full_reg_offset (s, rm), + tcg_env, vsz, vsz, + index, fn); + } +return true; +} + +TRANS(FDOT_hb, do_f8dp2, gen_helper_gvec_fdot_hb, a->rd, a->rn, a->rm, 0) +TRANS (FDOT_idx_hb, do_f8dp2, gen_helper_gvec_fdot_idx_hb, + a->rd, a->rn, a->rm, a->index)
target/arm/tcg/sve.decode +2 -0
@@ -1875,6 +1875,7 @@ 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 FDOT_sb 01100100 01 1 ..... 10 0 00 1 ..... ..... @rda_rn_rm_ex esz=2 +FDOT_hb 01100100 00 1 ..... 10 0 00 1 ..... ..... @rda_rn_rm_ex esz=1 ### SVE2 floating-point multiply-add long (indexed)
@@ -1900,6 +1901,7 @@ FDOT_zzxz 01100100 00 1 ..... 010000 ..... ..... @rrxr_2 esz=2 BFDOT_zzxz 01100100 01 1 ..... 010000 ..... ..... @rrxr_2 esz=2 FDOT_idx_sb 01100100 01 1 ..... 010001 ..... ..... @rrxr_2 esz=2 +FDOT_idx_hb 01100100 00 1 ..... 0100.1 ..... ..... @rrx_3a esz=1 ### SVE broadcast predicate element
Signature · 1 line
2.43.0
Re: [PATCH v9 38/45] target/arm: Implement FDOT (FP8 to FP16) for SVE
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 35 ++++++++++++++++++++++++++++++++++ target/arm/tcg/sve.decode | 2 ++ 3 files changed, 42 insertions(+)
thanks
-- PMM
PATCH v9 39/45 target/arm: Enable FEAT_FP8DOT2, FEAT_SSVE_FP8DOT2 for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 2 ++ target/arm/tcg/cpu64.c | 2 ++ docs/system/arm/emulation.rst | 2 ++ 3 files changed, 6 insertions(+)
linux-user/aarch64/elfload.c +2 -0
@@ -228,8 +228,10 @@ abi_ulong get_elf_hwcap2(CPUState *cs) ARM_HWCAP2_A64_F8E5M2);GET_FEATURE_ID (aa64_f8fma,ARM_HWCAP2_A64_F8FMA );GET_FEATURE_ID (aa64_f8dp4,ARM_HWCAP2_A64_F8DP4 ); +GET_FEATURE_ID (aa64_f8dp2,ARM_HWCAP2_A64_F8DP2 );GET_FEATURE_ID (aa64_ssve_f8fma,ARM_HWCAP2_A64_SME_SF8FMA );GET_FEATURE_ID (aa64_ssve_f8dp4,ARM_HWCAP2_A64_SME_SF8DP4 ); +GET_FEATURE_ID (aa64_ssve_f8dp2,ARM_HWCAP2_A64_SME_SF8DP2 );return hwcaps; }
target/arm/tcg/cpu64.c +2 -0
@@ -1378,6 +1378,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 ,SF8DP2 ,1 );/* FEAT_SSVE_FP8DOT2 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,SF8DP4 ,1 );/* FEAT_SSVE_FP8DOT4 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,SF8FMA ,1 );/* FEAT_SSVE_FP8FMA */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,F32F32 ,1 );/* FEAT_SME */
@@ -1398,6 +1399,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 ,F8DP2 ,1 );/* FEAT_FP8DOT2 */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8DP4 ,1 );/* FEAT_FP8DOT4 */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8FMA ,1 );/* FEAT_FP8FMA */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8CVT ,1 );/* FEAT_FP8 */
docs/system/arm/emulation.rst +2 -0
@@ -76,6 +76,7 @@ the following architecture extensions: - FEAT_FP (Floating Point extensions) - FEAT_FP16 (Half-precision floating-point data processing) - FEAT_FP8 (FP8 convert instructions) +- FEAT_FP8DOT2 (FP8 2-way dot product to half-precision instructions) - FEAT_FP8DOT4 (FP8 4-way dot product to single-precision instructions) - FEAT_FP8FMA (FP8 multiply-accumulate to half-precision and single-precision instructions) - FEAT_FPAC (Faulting on AUT* instructions)
@@ -163,6 +164,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_FP8DOT2 (SVE2 FP8 2-way dot product to half-precision instructions in Streaming SVE mode) - FEAT_SSVE_FP8DOT4 (SVE2 FP8 4-way dot product to single-precision instructions in Streaming SVE mode) - FEAT_SSVE_FP8FMA (SVE2 FP8 multiply-accumulate to half-precision and single-precision instructions in Streaming SVE mode) - FEAT_SVE (Scalable Vector Extension)
Signature · 1 line
2.43.0
Re: [PATCH v9 39/45] target/arm: Enable FEAT_FP8DOT2, FEAT_SSVE_FP8DOT2 for -cpu max
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/aarch64/elfload.c | 2 ++ target/arm/tcg/cpu64.c | 2 ++ docs/system/arm/emulation.rst | 2 ++ 3 files changed, 6 insertions(+)
thanks
-- PMM
PATCH v9 40/45 target/arm: Implement FMMLA (FP8 to FP32) for AdvSIMD
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/helper-fp8-defs.h | 2 ++ target/arm/tcg/fp8_helper.c | 25 +++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 1 + target/arm/tcg/a64.decode | 2 ++ 5 files changed, 35 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1630,6 +1630,11 @@ static inline bool isar_feature_aa64_f8dp2(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8DP2 ); } +static inline bool isar_feature_aa64_f8mm8 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8MM8 ); +} +/* * Combinations of feature tests, for ease of use with TRANS_FEAT. */
target/arm/tcg/helper-fp8-defs.h +2 -0
@@ -35,3 +35,5 @@ DEF_HELPER_FLAGS_5(gvec_fdot_idx_sb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, DEF_HELPER_FLAGS_5(gvec_fdot_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fdot_idx_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) + +DEF_HELPER_FLAGS_5 (gvec_fmmla_sb,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +25 -0
@@ -806,3 +806,28 @@ void HELPER(gvec_fdot_idx_hb)(void *vd, void *vn, void *vm,clear_tail (vd, oprsz,simd_maxsz (desc)); } + +void HELPER (gvec_fmmla_sb )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8MulContext ctx =fp8_mul_start (env,-1 ); +size_t oprsz =simd_oprsz (desc); +size_t nseg = oprsz /16 ; +uint64_t *n = vn; +uint64_t *m = vm; +float32 *d = vd; + +for (size_t seg =0 ; seg < nseg; seg++, d +=4 , n +=2 , m +=2 ) { +float32 d0 =f8dotadd_s (n[0 ], m[0 ],8 , d[H4 (0 )], &ctx); +float32 d1 =f8dotadd_s (n[0 ], m[1 ],8 , d[H4 (1 )], &ctx); +float32 d2 =f8dotadd_s (n[1 ], m[0 ],8 , d[H4 (2 )], &ctx); +float32 d3 =f8dotadd_s (n[1 ], m[1 ],8 , d[H4 (3 )], &ctx); + + d[H4 (0 )] = d0; + d[H4 (1 )] = d1; + d[H4 (2 )] = d2; + d[H4 (3 )] = d3; + } + +clear_tail (vd, oprsz,simd_maxsz (desc)); +}
target/arm/tcg/translate-a64.c +1 -0
@@ -7501,6 +7501,7 @@ static bool do_f8dot(DisasContext *s, arg_qrrr_e *a, TRANS_FEAT(FDOT_sb_v, aa64_f8dp4, do_f8dot, a, gen_helper_gvec_fdot_sb) TRANS_FEAT(FDOT_hb_v, aa64_f8dp2, do_f8dot, a, gen_helper_gvec_fdot_hb) +TRANS_FEAT(FMMLA_sb, aa64_f8mm8, do_f8dot, a, gen_helper_gvec_fmmla_sb)static bool do_f8dot_idx (DisasContext *s,arg_qrrx_e *a,gen_helper_gvec_3_ptr *fn)
target/arm/tcg/a64.decode +2 -0
@@ -1227,6 +1227,8 @@ FMLALL_sb_v 0.00 1110 0.0 rm:5 110001 rn:5 rd:5 \ FDOT_sb_v 0.00 1110 000 ..... 11111 1 ..... ..... @qrrr_s FDOT_hb_v 0.00 1110 010 ..... 11111 1 ..... ..... @qrrr_h +FMMLA_sb 0110 1110 100 ..... 11101 1 ..... ..... @rrr_q1e0 + ### Advanced SIMD scalar x indexed element FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
Signature · 1 line
2.43.0
Re: [PATCH v9 40/45] target/arm: Implement FMMLA (FP8 to FP32) for AdvSIMD
Quoted 9 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/helper-fp8-defs.h | 2 ++ target/arm/tcg/fp8_helper.c | 25 +++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 1 + target/arm/tcg/a64.decode | 2 ++ 5 files changed, 35 insertions(+)
thanks
-- PMM
PATCH v9 41/45 target/arm: Implement FMMLA (FP8 to FP32) for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 16 ++++++++++++++++ target/arm/tcg/sve.decode | 2 ++ 3 files changed, 23 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1703,6 +1703,11 @@ 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_sve2_f8mm8 (const ARMISARegisters *id) +{ +return isar_feature_aa64_sve2 (id) &&isar_feature_aa64_f8mm8 (id); +} +static inline bool isar_feature_aa64_sme2_or_sve2_faminmax (const ARMISARegisters *id) {
target/arm/tcg/translate-sve.c +16 -0
@@ -8461,3 +8461,19 @@ static bool do_f8dp2(DisasContext *s, gen_helper_gvec_3_ptr *fn, TRANS(FDOT_hb, do_f8dp2, gen_helper_gvec_fdot_hb, a->rd, a->rn, a->rm, 0)TRANS (FDOT_idx_hb, do_f8dp2, gen_helper_gvec_fdot_idx_hb, a->rd, a->rn, a->rm, a->index) + +static bool do_fmmla_fp8 (DisasContext *s,arg_rrrr_esz *a, +gen_helper_gvec_3_ptr *fn) +{ +if (fpmr_access_check (s) &&sve_access_check (s)) { +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,0 , fn); + } +return true; +} + +TRANS_FEAT_NONSTREAMING (FMMLA_sb, aa64_sve2_f8mm8, do_fmmla_fp8, a, + gen_helper_gvec_fmmla_sb)
target/arm/tcg/sve.decode +2 -0
@@ -1808,6 +1808,8 @@ BFMMLA 01100100 01 1 ..... 111 001 ..... ..... @rda_rn_rm_ex esz=1 FMMLA_s 01100100 10 1 ..... 111 001 ..... ..... @rda_rn_rm_ex esz=2 FMMLA_d 01100100 11 1 ..... 111 001 ..... ..... @rda_rn_rm_ex esz=3 +FMMLA_sb 01100100 00 1 ..... 111 000 ..... ..... @rda_rn_rm_ex esz=2 + ### SVE2 Memory Gather Load Group # SVE2 64-bit gather non-temporal load (scalar plus 64-bit unscaled offsets)
Signature · 1 line
2.43.0
Re: [PATCH v9 41/45] target/arm: Implement FMMLA (FP8 to FP32) for SVE
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v9 42/45 target/arm: Enable FEAT_F8F32MM for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 1 + target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 3 files changed, 3 insertions(+)
linux-user/aarch64/elfload.c +1 -0
@@ -171,6 +171,7 @@ abi_ulong get_elf_hwcap(CPUState *cs)GET_FEATURE_ID (aa64_rcpc_8_4,ARM_HWCAP_A64_ILRCPC );GET_FEATURE_ID (aa64_gcs,ARM_HWCAP_A64_GCS );GET_FEATURE_ID (aa64_cmpbr,ARM_HWCAP_A64_CMPBR ); +GET_FEATURE_ID (aa64_f8mm8,ARM_HWCAP_A64_F8MM8 );return hwcaps; }
target/arm/tcg/cpu64.c +1 -0
@@ -1399,6 +1399,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 ,F8MM8 ,1 );/* FEAT_F8F32MM */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8DP2 ,1 );/* FEAT_FP8DOT2 */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8DP4 ,1 );/* FEAT_FP8DOT4 */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8FMA ,1 );/* FEAT_FP8FMA */
docs/system/arm/emulation.rst +1 -0
@@ -67,6 +67,7 @@ the following architecture extensions: - FEAT_EPAC (Enhanced pointer authentication) - FEAT_ETS2 (Enhanced Translation Synchronization) - FEAT_EVT (Enhanced Virtualization Traps) +- FEAT_F8F32MM (8-bit floating-point matrix multiply-accumulate to single-precision) - FEAT_F32MM (Single-precision Matrix Multiplication) - FEAT_F64MM (Double-precision Matrix Multiplication) - FEAT_FAMINMAX (Floating-point maximum and minimum absolute value instructions)
Signature · 1 line
2.43.0
Re: [PATCH v9 42/45] target/arm: Enable FEAT_F8F32MM for -cpu max
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/aarch64/elfload.c | 1 + target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 3 files changed, 3 insertions(+)
thanks
-- PMM
PATCH v9 43/45 target/arm: Implement FMMLA (FP8 to FP16) for AdvSIMD
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/helper-fp8-defs.h | 1 + target/arm/tcg/fp8_helper.c | 25 +++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 1 + target/arm/tcg/a64.decode | 1 + 5 files changed, 33 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1635,6 +1635,11 @@ static inline bool isar_feature_aa64_f8mm8(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8MM8 ); } +static inline bool isar_feature_aa64_f8mm4 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64FPFR0 ,F8MM4 ); +} +/* * Combinations of feature tests, for ease of use with TRANS_FEAT. */
target/arm/tcg/helper-fp8-defs.h +1 -0
@@ -37,3 +37,4 @@ DEF_HELPER_FLAGS_5(gvec_fdot_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fdot_idx_hb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_fmmla_sb, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, env, i32) +DEF_HELPER_FLAGS_5 (gvec_fmmla_hb,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, env, i32)
target/arm/tcg/fp8_helper.c +25 -0
@@ -831,3 +831,28 @@ void HELPER(gvec_fmmla_sb)(void *vd, void *vn, void *vm,clear_tail (vd, oprsz,simd_maxsz (desc)); } + +void HELPER (gvec_fmmla_hb )(void *vd,void *vn,void *vm, +CPUARMState *env,uint32_t desc) +{ +FP8MulContext ctx =fp8_mul_start (env,0xf ); +size_t oprsz =simd_oprsz (desc); +size_t nseg = oprsz /8 ; +uint32_t *n = vn; +uint32_t *m = vm; +float16 *d = vd; + +for (size_t seg =0 ; seg < nseg; seg++, d +=4 , n +=2 , m +=2 ) { +float16 d0 =f8dotadd_h (n[H4 (0 )], m[H4 (0 )],4 , d[H2 (0 )], &ctx); +float16 d1 =f8dotadd_h (n[H4 (0 )], m[H4 (1 )],4 , d[H2 (1 )], &ctx); +float16 d2 =f8dotadd_h (n[H4 (1 )], m[H4 (0 )],4 , d[H2 (2 )], &ctx); +float16 d3 =f8dotadd_h (n[H4 (1 )], m[H4 (1 )],4 , d[H2 (3 )], &ctx); + + d[H2 (0 )] = d0; + d[H2 (1 )] = d1; + d[H2 (2 )] = d2; + d[H2 (3 )] = d3; + } + +clear_tail (vd, oprsz,simd_maxsz (desc)); +}
target/arm/tcg/translate-a64.c +1 -0
@@ -7502,6 +7502,7 @@ static bool do_f8dot(DisasContext *s, arg_qrrr_e *a, TRANS_FEAT(FDOT_sb_v, aa64_f8dp4, do_f8dot, a, gen_helper_gvec_fdot_sb) TRANS_FEAT(FDOT_hb_v, aa64_f8dp2, do_f8dot, a, gen_helper_gvec_fdot_hb) TRANS_FEAT(FMMLA_sb, aa64_f8mm8, do_f8dot, a, gen_helper_gvec_fmmla_sb) +TRANS_FEAT(FMMLA_hb, aa64_f8mm4, do_f8dot, a, gen_helper_gvec_fmmla_hb)static bool do_f8dot_idx (DisasContext *s,arg_qrrx_e *a,gen_helper_gvec_3_ptr *fn)
target/arm/tcg/a64.decode +1 -0
@@ -1228,6 +1228,7 @@ FDOT_sb_v 0.00 1110 000 ..... 11111 1 ..... ..... @qrrr_s FDOT_hb_v 0.00 1110 010 ..... 11111 1 ..... ..... @qrrr_h FMMLA_sb 0110 1110 100 ..... 11101 1 ..... ..... @rrr_q1e0 +FMMLA_hb 0110 1110 000 ..... 11101 1 ..... ..... @rrr_q1e0 ### Advanced SIMD scalar x indexed element
Signature · 1 line
2.43.0
Re: [PATCH v9 43/45] target/arm: Implement FMMLA (FP8 to FP16) for AdvSIMD
Quoted 10 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/helper-fp8-defs.h | 1 + target/arm/tcg/fp8_helper.c | 25 +++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 1 + target/arm/tcg/a64.decode | 1 + 5 files changed, 33 insertions(+)
thanks
-- PMM
PATCH v9 44/45 target/arm: Implement FMMLA (FP8 to FP16) for SVE
In reply to Richard Henderson--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 2 ++ target/arm/tcg/sve.decode | 1 + 3 files changed, 8 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1713,6 +1713,11 @@ static inline bool isar_feature_aa64_sve2_f8mm8(const ARMISARegisters *id)return isar_feature_aa64_sve2 (id) &&isar_feature_aa64_f8mm8 (id); } +static inline bool isar_feature_aa64_sve2_f8mm4 (const ARMISARegisters *id) +{ +return isar_feature_aa64_sve2 (id) &&isar_feature_aa64_f8mm4 (id); +} +static inline bool isar_feature_aa64_sme2_or_sve2_faminmax (const ARMISARegisters *id) {
target/arm/tcg/translate-sve.c +2 -0
@@ -8477,3 +8477,5 @@ static bool do_fmmla_fp8(DisasContext *s, arg_rrrr_esz *a,TRANS_FEAT_NONSTREAMING (FMMLA_sb, aa64_sve2_f8mm8, do_fmmla_fp8, a, gen_helper_gvec_fmmla_sb) +TRANS_FEAT_NONSTREAMING (FMMLA_hb, aa64_sve2_f8mm4, do_fmmla_fp8, a, + gen_helper_gvec_fmmla_hb)
target/arm/tcg/sve.decode +1 -0
@@ -1809,6 +1809,7 @@ FMMLA_s 01100100 10 1 ..... 111 001 ..... ..... @rda_rn_rm_ex esz=2 FMMLA_d 01100100 11 1 ..... 111 001 ..... ..... @rda_rn_rm_ex esz=3 FMMLA_sb 01100100 00 1 ..... 111 000 ..... ..... @rda_rn_rm_ex esz=2 +FMMLA_hb 01100100 01 1 ..... 111 000 ..... ..... @rda_rn_rm_ex esz=1 ### SVE2 Memory Gather Load Group
Signature · 1 line
2.43.0
Re: [PATCH v9 44/45] target/arm: Implement FMMLA (FP8 to FP16) for SVE
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu-features.h | 5 +++++ target/arm/tcg/translate-sve.c | 2 ++ target/arm/tcg/sve.decode | 1 + 3 files changed, 8 insertions(+)
thanks
-- PMM
PATCH v9 45/45 target/arm: Enable FEAT_F8F16MM for -cpu max
In reply to Richard Henderson--- linux-user/aarch64/elfload.c | 1 + target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 3 files changed, 3 insertions(+)
linux-user/aarch64/elfload.c +1 -0
@@ -172,6 +172,7 @@ abi_ulong get_elf_hwcap(CPUState *cs)GET_FEATURE_ID (aa64_gcs,ARM_HWCAP_A64_GCS );GET_FEATURE_ID (aa64_cmpbr,ARM_HWCAP_A64_CMPBR );GET_FEATURE_ID (aa64_f8mm8,ARM_HWCAP_A64_F8MM8 ); +GET_FEATURE_ID (aa64_f8mm4,ARM_HWCAP_A64_F8MM4 );return hwcaps; }
target/arm/tcg/cpu64.c +1 -0
@@ -1399,6 +1399,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 ,F8MM4 ,1 );/* FEAT_F8F16MM */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8MM8 ,1 );/* FEAT_F8F32MM */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8DP2 ,1 );/* FEAT_FP8DOT2 */ t =FIELD_DP64 (t,ID_AA64FPFR0 ,F8DP4 ,1 );/* FEAT_FP8DOT4 */
docs/system/arm/emulation.rst +1 -0
@@ -67,6 +67,7 @@ the following architecture extensions: - FEAT_EPAC (Enhanced pointer authentication) - FEAT_ETS2 (Enhanced Translation Synchronization) - FEAT_EVT (Enhanced Virtualization Traps) +- FEAT_F8F16MM (8-bit floating-point matrix multiply-accumulate to half-precision) - FEAT_F8F32MM (8-bit floating-point matrix multiply-accumulate to single-precision) - FEAT_F32MM (Single-precision Matrix Multiplication) - FEAT_F64MM (Double-precision Matrix Multiplication)
Signature · 1 line
2.43.0
Re: [PATCH v9 45/45] target/arm: Enable FEAT_F8F16MM for -cpu max
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/aarch64/elfload.c | 1 + target/arm/tcg/cpu64.c | 1 + docs/system/arm/emulation.rst | 1 + 3 files changed, 3 insertions(+)
thanks
-- PMM
Quoted 6 lines · Richard Henderson
Changes for v9:
- Include 3 arm patches from the fp internals patch set.
- GeneralizeTRANS_FEAT_STREAMING_SME2toTRANS_FEAT_STREAMING_IF, pulled from an in-progressFEAT_SVE2p2tree.
Quoted 6 lines
Changes for v8:
- 23 patches upstream
- Rebase adjustments
- Rewritearm_init_fp_statusper feedbackr~
I think I've reviewed all of this now (either unconditionally or "with this fix" r-bys); if you can get a respin out by Thursday I should be able to get it into a pullreq this week I think.
thanks
-- PMM