target/arm: Implement SVE2 FLOGB
RFC PATCH v2 1/1 target/arm: Implement SVE2 FLOGB
Signed-off-by Stephen Long <[email protected]>
---
I made the changes Richard requested. I took out the status field for the helper function.
include/fpu/softfloat.h | 5 +++ target/arm/helper-sve.h | 4 +++ target/arm/sve.decode | 4 +++ target/arm/sve_helper.c | 63 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 9 ++++++ 5 files changed, 85 insertions(+)
include/fpu/softfloat.h +5 -0
@@ -260,6 +260,11 @@ static inline int float16_is_zero_or_denormal(float16 a)return (float16_val (a) &0x7c00 ) ==0 ; } +static inline bool float16_is_normal (float16 a) +{ +return (((float16_val (a) >>10 ) +1 ) &0x1f ) >=2 ; +} +static inline float16 float16_abs (float16 a) {/* Note that abs does *not* handle NaN specially, nor does
target/arm/helper-sve.h +4 -0
@@ -2731,3 +2731,7 @@ DEF_HELPER_FLAGS_5(sve2_sqrdcmlah_idx_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve2_sqrdcmlah_idx_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_4(flogb_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(flogb_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(flogb_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
target/arm/sve.decode +4 -0
@@ -1568,3 +1568,7 @@ SM4E 01000101 00 10001 1 11100 0 ..... ..... @rdn_rm_e0 # SVE2 crypto constructive binary operations SM4EKEY 01000101 00 1 ..... 11110 0 ..... ..... @rd_rn_rm_e0 RAX1 01000101 00 1 ..... 11110 1 ..... ..... @rd_rn_rm_e0 + +### SVE2 floating-point convert to integer + +FLOGB 01100101 00 011 esz:2 0101 pg:3 rn:5 rd:5 &rpr_esz
target/arm/sve_helper.c +63 -0
66 lines not on this page · raw message
target/arm/translate-sve.c +9 -0
@@ -8253,3 +8253,12 @@ static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) }return true; } + +static bool trans_FLOGB (DisasContext *s,arg_rpr_esz *a) +{ +static gen_helper_gvec_3 *const fns[] = { +NULL , gen_helper_flogb_h, + gen_helper_flogb_s, gen_helper_flogb_d + }; +return do_sve2_zpz_ool (s, a, fns[a->esz -1 ]); +}
Signature · 1 line
2.17.1
Quoted 18 lines · Stephen Long
Signed-off-by Stephen Long <[email protected]>---
I made the changes Richard requested. I took out the status field for the helper function.
include/fpu/softfloat.h | 5 +++ target/arm/helper-sve.h | 4 +++ target/arm/sve.decode | 4 +++ target/arm/sve_helper.c | 63 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 9 ++++++ 5 files changed, 85 insertions(+)include/fpu/softfloat.h +0
-0
include/fpu/softfloat.h static inline int float16_is_zero_or_denormal(float16 a) · line 266
Quoted 7 lines
include/fpu/softfloat.h +4
-0@@ -260,6 +260,11 @@ static inline int float16_is_zero_or_denormal(float16 a)return (float16_val (a) &0x7c00 ) ==0 ; } +static inline bool float16_is_normal (float16 a) +{ +return (((float16_val (a) >>10 ) +1 ) &0x1f ) >=2 ; +}
I split this out to its own patch.
include/fpu/softfloat.h static inline int float16_is_zero_or_denormal(float16 a)
Quoted 10 lines
include/fpu/softfloat.h +10
-0+static int16_t do_float16_logb_as_int (float16 a) +{ +if (float16_is_normal (a)) { +return extract16 (a,10 ,5 ) -15 ; + }else if (float16_is_infinity (a)) { +return INT16_MAX ; + }else if (float16_is_any_nan (a) ||float16_is_zero (a)) { +return INT16_MIN ; + } +// denormal
CODING_STYLE prohibits c++ comments. Fixed.
include/fpu/softfloat.h
Quoted 7 lines
include/fpu/softfloat.h +7
-0+static bool trans_FLOGB (DisasContext *s,arg_rpr_esz *a) +{ +static gen_helper_gvec_3 *const fns[] = { +NULL , gen_helper_flogb_h, + gen_helper_flogb_s, gen_helper_flogb_d + }; +return do_sve2_zpz_ool (s, a, fns[a->esz -1 ]);
Incorrect subtract in the indexing. Fixed.
Queued with the above changes.
r~