target/arm: Implement SVE floating-point unary operations

Backports commit ec5b375bb5a0e35c0c21dc9dd1d82894269ce215 from qemu
This commit is contained in:
Richard Henderson 2018-07-03 04:11:10 -04:00 committed by Lioncash
parent 2c2c940ef8
commit 00d3671412
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
7 changed files with 70 additions and 0 deletions

View file

@ -3650,6 +3650,9 @@
#define helper_sve_fnmls_zpzzz_d helper_sve_fnmls_zpzzz_d_aarch64
#define helper_sve_fnmls_zpzzz_h helper_sve_fnmls_zpzzz_h_aarch64
#define helper_sve_fnmls_zpzzz_s helper_sve_fnmls_zpzzz_s_aarch64
#define helper_sve_frecpx_d helper_sve_frecpx_d_aarch64
#define helper_sve_frecpx_h helper_sve_frecpx_h_aarch64
#define helper_sve_frecpx_s helper_sve_frecpx_s_aarch64
#define helper_sve_frint_d helper_sve_frint_d_aarch64
#define helper_sve_frint_h helper_sve_frint_h_aarch64
#define helper_sve_frint_s helper_sve_frint_s_aarch64
@ -3659,6 +3662,9 @@
#define helper_sve_fscalbn_d helper_sve_fscalbn_d_aarch64
#define helper_sve_fscalbn_h helper_sve_fscalbn_h_aarch64
#define helper_sve_fscalbn_s helper_sve_fscalbn_s_aarch64
#define helper_sve_fsqrt_d helper_sve_fsqrt_d_aarch64
#define helper_sve_fsqrt_h helper_sve_fsqrt_h_aarch64
#define helper_sve_fsqrt_s helper_sve_fsqrt_s_aarch64
#define helper_sve_fsub_d helper_sve_fsub_d_aarch64
#define helper_sve_fsub_h helper_sve_fsub_h_aarch64
#define helper_sve_fsub_s helper_sve_fsub_s_aarch64

View file

@ -3650,6 +3650,9 @@
#define helper_sve_fnmls_zpzzz_d helper_sve_fnmls_zpzzz_d_aarch64eb
#define helper_sve_fnmls_zpzzz_h helper_sve_fnmls_zpzzz_h_aarch64eb
#define helper_sve_fnmls_zpzzz_s helper_sve_fnmls_zpzzz_s_aarch64eb
#define helper_sve_frecpx_d helper_sve_frecpx_d_aarch64eb
#define helper_sve_frecpx_h helper_sve_frecpx_h_aarch64eb
#define helper_sve_frecpx_s helper_sve_frecpx_s_aarch64eb
#define helper_sve_frint_d helper_sve_frint_d_aarch64eb
#define helper_sve_frint_h helper_sve_frint_h_aarch64eb
#define helper_sve_frint_s helper_sve_frint_s_aarch64eb
@ -3659,6 +3662,9 @@
#define helper_sve_fscalbn_d helper_sve_fscalbn_d_aarch64eb
#define helper_sve_fscalbn_h helper_sve_fscalbn_h_aarch64eb
#define helper_sve_fscalbn_s helper_sve_fscalbn_s_aarch64eb
#define helper_sve_fsqrt_d helper_sve_fsqrt_d_aarch64eb
#define helper_sve_fsqrt_h helper_sve_fsqrt_h_aarch64eb
#define helper_sve_fsqrt_s helper_sve_fsqrt_s_aarch64eb
#define helper_sve_fsub_d helper_sve_fsub_d_aarch64eb
#define helper_sve_fsub_h helper_sve_fsub_h_aarch64eb
#define helper_sve_fsub_s helper_sve_fsub_s_aarch64eb

View file

@ -3671,6 +3671,9 @@ aarch64_symbols = (
'helper_sve_fnmls_zpzzz_d',
'helper_sve_fnmls_zpzzz_h',
'helper_sve_fnmls_zpzzz_s',
'helper_sve_frecpx_d',
'helper_sve_frecpx_h',
'helper_sve_frecpx_s',
'helper_sve_frint_d',
'helper_sve_frint_h',
'helper_sve_frint_s',
@ -3680,6 +3683,9 @@ aarch64_symbols = (
'helper_sve_fscalbn_d',
'helper_sve_fscalbn_h',
'helper_sve_fscalbn_s',
'helper_sve_fsqrt_d',
'helper_sve_fsqrt_h',
'helper_sve_fsqrt_s',
'helper_sve_fsub_d',
'helper_sve_fsub_h',
'helper_sve_fsub_s',

View file

@ -999,6 +999,20 @@ DEF_HELPER_FLAGS_5(sve_frintx_s, TCG_CALL_NO_RWG,
DEF_HELPER_FLAGS_5(sve_frintx_d, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_frecpx_h, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_frecpx_s, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_frecpx_d, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_fsqrt_h, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_fsqrt_s, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_fsqrt_d, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_scvt_hh, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(sve_scvt_sh, TCG_CALL_NO_RWG,

View file

@ -854,6 +854,10 @@ FRINTA 01100101 .. 000 100 101 ... ..... ..... @rd_pg_rn
FRINTX 01100101 .. 000 110 101 ... ..... ..... @rd_pg_rn
FRINTI 01100101 .. 000 111 101 ... ..... ..... @rd_pg_rn
# SVE floating-point unary operations
FRECPX 01100101 .. 001 100 101 ... ..... ..... @rd_pg_rn
FSQRT 01100101 .. 001 101 101 ... ..... ..... @rd_pg_rn
# SVE integer convert to floating-point
SCVTF_hh 01100101 01 010 01 0 101 ... ..... ..... @rd_pg_rn_e0
SCVTF_sh 01100101 01 010 10 0 101 ... ..... ..... @rd_pg_rn_e0

View file

@ -4151,6 +4151,14 @@ DO_ZPZ_FP(sve_frintx_h, uint16_t, H1_2, float16_round_to_int)
DO_ZPZ_FP(sve_frintx_s, uint32_t, H1_4, float32_round_to_int)
DO_ZPZ_FP(sve_frintx_d, uint64_t, , float64_round_to_int)
DO_ZPZ_FP(sve_frecpx_h, uint16_t, H1_2, helper_frecpx_f16)
DO_ZPZ_FP(sve_frecpx_s, uint32_t, H1_4, helper_frecpx_f32)
DO_ZPZ_FP(sve_frecpx_d, uint64_t, , helper_frecpx_f64)
DO_ZPZ_FP(sve_fsqrt_h, uint16_t, H1_2, float16_sqrt)
DO_ZPZ_FP(sve_fsqrt_s, uint32_t, H1_4, float32_sqrt)
DO_ZPZ_FP(sve_fsqrt_d, uint64_t, , float64_sqrt)
DO_ZPZ_FP(sve_scvt_hh, uint16_t, H1_2, int16_to_float16)
DO_ZPZ_FP(sve_scvt_sh, uint32_t, H1_4, int32_to_float16)
DO_ZPZ_FP(sve_scvt_ss, uint32_t, H1_4, int32_to_float32)

View file

@ -4275,6 +4275,32 @@ static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
return do_frint_mode(s, a, float_round_ties_away);
}
static bool trans_FRECPX(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
{
static gen_helper_gvec_3_ptr * const fns[3] = {
gen_helper_sve_frecpx_h,
gen_helper_sve_frecpx_s,
gen_helper_sve_frecpx_d
};
if (a->esz == 0) {
return false;
}
return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]);
}
static bool trans_FSQRT(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
{
static gen_helper_gvec_3_ptr * const fns[3] = {
gen_helper_sve_fsqrt_h,
gen_helper_sve_fsqrt_s,
gen_helper_sve_fsqrt_d
};
if (a->esz == 0) {
return false;
}
return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]);
}
static bool trans_SCVTF_hh(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
{
return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_hh);