@samitouri / QOSamiQemu / commits / 891388a9dd

target/arm: Implement FSCALE for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260522220306.235200-21-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Richard Henderson committed May 22, 2026 at 15:02 UTC 891388a9dd5e5459e64ba3acc23c3f3cf716f670
6 files changed +24 -6
target/arm/tcg/a64.decode
+3
@@ -1198,6 +1198,9 @@ FAMAX 0.00 1110 1.1 ..... 11011 1 ..... ..... @qrrr_sd
1198 FAMIN 0.10 1110 110 ..... 00011 1 ..... ..... @qrrr_h
1199 FAMIN 0.10 1110 1.1 ..... 11011 1 ..... ..... @qrrr_sd
1200
1201 +FSCALE 0.10 1110 110 ..... 00111 1 ..... ..... @qrrr_h
1202 +FSCALE 0.10 1110 1.1 ..... 11111 1 ..... ..... @qrrr_sd
1203 +
1204 ### Advanced SIMD scalar x indexed element
1205
1206 FMUL_si 0101 1111 00 .. .... 1001 . 0 ..... ..... @rrx_h
target/arm/tcg/helper-a64-defs.h
+4
@@ -152,6 +152,10 @@ DEF_HELPER_FLAGS_5(gvec_famin_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32
152 DEF_HELPER_FLAGS_5(gvec_famax_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32)
153 DEF_HELPER_FLAGS_5(gvec_famin_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32)
154
155 +DEF_HELPER_FLAGS_5(gvec_fscale_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32)
156 +DEF_HELPER_FLAGS_5(gvec_fscale_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32)
157 +DEF_HELPER_FLAGS_5(gvec_fscale_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32)
158 +
159 #ifndef CONFIG_USER_ONLY
160 DEF_HELPER_2(exception_return, void, env, i64)
161 #endif
target/arm/tcg/sve_helper.c
-6
@@ -4736,12 +4736,6 @@ DO_ZPZZ_FP(sve_ah_fabd_h, uint16_t, H1_2, ah_abd_h)
4736 DO_ZPZZ_FP(sve_ah_fabd_s, uint32_t, H1_4, ah_abd_s)
4737 DO_ZPZZ_FP(sve_ah_fabd_d, uint64_t, H1_8, ah_abd_d)
4738
4739 -static inline float64 scalbn_d(float64 a, int64_t b, float_status *s)
4740 -{
4741 - int b_int = MIN(MAX(b, INT_MIN), INT_MAX);
4742 - return float64_scalbn(a, b_int, s);
4743 -}
4744 -
4739 DO_ZPZZ_FP(sve_fscalbn_h, int16_t, H1_2, float16_scalbn)
4740 DO_ZPZZ_FP(sve_fscalbn_s, int32_t, H1_4, float32_scalbn)
4741 DO_ZPZZ_FP(sve_fscalbn_d, int64_t, H1_8, scalbn_d)
target/arm/tcg/translate-a64.c
+7
@@ -6493,6 +6493,13 @@ static gen_helper_gvec_3_ptr * const f_vector_famin[3] = {
6493 };
6494 TRANS_FEAT(FAMIN, aa64_faminmax, do_fp3_vector, a, 0, f_vector_famin)
6495
6496 +static gen_helper_gvec_3_ptr * const f_vector_fscale[3] = {
6497 + gen_helper_gvec_fscale_h,
6498 + gen_helper_gvec_fscale_s,
6499 + gen_helper_gvec_fscale_d,
6500 +};
6501 +TRANS_FEAT(FSCALE, aa64_f8cvt, do_fp3_vector, a, 0, f_vector_fscale)
6502 +
6503 static bool do_fmlal(DisasContext *s, arg_qrrr_e *a, bool is_s, bool is_2)
6504 {
6505 if (fp_access_check(s)) {
target/arm/tcg/vec_helper64.c
+4
@@ -178,3 +178,7 @@ DO_3OP(gvec_famax_s, float32_famax, float32)
178 DO_3OP(gvec_famin_s, float32_famin, float32)
179 DO_3OP(gvec_famax_d, float64_famax, float64)
180 DO_3OP(gvec_famin_d, float64_famin, float64)
181 +
182 +DO_3OP(gvec_fscale_h, float16_scalbn, int16_t)
183 +DO_3OP(gvec_fscale_s, float32_scalbn, int32_t)
184 +DO_3OP(gvec_fscale_d, scalbn_d, int64_t)
target/arm/tcg/vec_internal.h
+6
@@ -349,6 +349,12 @@ float32 float32_famin(float32, float32, float_status *);
349 float64 float64_famax(float64, float64, float_status *);
350 float64 float64_famin(float64, float64, float_status *);
351
352 +static inline float64 scalbn_d(float64 a, int64_t b, float_status *s)
353 +{
354 + int b_int = MIN(MAX(b, INT_MIN), INT_MAX);
355 + return float64_scalbn(a, b_int, s);
356 +}
357 +
358 /*
359 * Decode helper functions for predicate as counter.
360 */