From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH 2/9] target/arm: Implement vector shifted FCVT for fp16
Date: Mon, 30 Apr 2018 16:55:23 +0100 [thread overview]
Message-ID: <87lgd44rkk.fsf@linaro.org> (raw)
In-Reply-To: <20180425012300.14698-3-richard.henderson@linaro.org>
Richard Henderson <richard.henderson@linaro.org> writes:
> While we have some of the scalar paths for FCVT for fp16,
> we failed to decode the fp16 version of these instructions.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++--------------
> 1 file changed, 46 insertions(+), 19 deletions(-)
>
> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
> index c92e052686..e2d11998bd 100644
> --- a/target/arm/translate-a64.c
> +++ b/target/arm/translate-a64.c
> @@ -7120,19 +7120,28 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar,
> bool is_q, bool is_u,
> int immh, int immb, int rn, int rd)
> {
> - bool is_double = extract32(immh, 3, 1);
> int immhb = immh << 3 | immb;
> - int fracbits = (is_double ? 128 : 64) - immhb;
> - int pass;
> + int pass, size, fracbits;
> TCGv_ptr tcg_fpstatus;
> TCGv_i32 tcg_rmode, tcg_shift;
>
> - if (!extract32(immh, 2, 2)) {
> - unallocated_encoding(s);
> - return;
> - }
> -
> - if (!is_scalar && !is_q && is_double) {
> + if (immh & 0x8) {
> + size = MO_64;
> + if (!is_scalar && !is_q) {
> + unallocated_encoding(s);
> + return;
> + }
> + } else if (immh & 0x4) {
> + size = MO_32;
> + } else if (immh & 0x2) {
> + size = MO_16;
> + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
> + unallocated_encoding(s);
> + return;
> + }
> + } else {
> + /* Should have split out AdvSIMD modified immediate earlier. */
> + assert(immh == 1);
> unallocated_encoding(s);
> return;
> }
> @@ -7144,11 +7153,12 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar,
> assert(!(is_scalar && is_q));
>
> tcg_rmode = tcg_const_i32(arm_rmode_to_sf(FPROUNDING_ZERO));
> - tcg_fpstatus = get_fpstatus_ptr(false);
> + tcg_fpstatus = get_fpstatus_ptr(size == MO_16);
> gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus);
> + fracbits = (16 << size) - immhb;
> tcg_shift = tcg_const_i32(fracbits);
>
> - if (is_double) {
> + if (size == 3) {
> int maxpass = is_scalar ? 1 : 2;
>
> for (pass = 0; pass < maxpass; pass++) {
> @@ -7165,20 +7175,37 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar,
> }
> clear_vec_high(s, is_q, rd);
> } else {
> - int maxpass = is_scalar ? 1 : is_q ? 4 : 2;
> + void (*fn)(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr);
> + int maxpass = is_scalar ? 1 : (8 << is_q >> size);
brackets
> +
> + switch (size) {
> + case MO_16:
> + if (is_u) {
> + fn = gen_helper_vfp_toulh;
> + } else {
> + fn = gen_helper_vfp_toslh;
> + }
> + break;
> + case MO_32:
> + if (is_u) {
> + fn = gen_helper_vfp_touls;
> + } else {
> + fn = gen_helper_vfp_tosls;
> + }
> + break;
> + default:
> + g_assert_not_reached();
> + }
> +
> for (pass = 0; pass < maxpass; pass++) {
> TCGv_i32 tcg_op = tcg_temp_new_i32();
>
> - read_vec_element_i32(s, tcg_op, rn, pass, MO_32);
> - if (is_u) {
> - gen_helper_vfp_touls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus);
> - } else {
> - gen_helper_vfp_tosls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus);
> - }
> + read_vec_element_i32(s, tcg_op, rn, pass, size);
> + fn(tcg_op, tcg_op, tcg_shift, tcg_fpstatus);
> if (is_scalar) {
> write_fp_sreg(s, rd, tcg_op);
> } else {
> - write_vec_element_i32(s, tcg_op, rd, pass, MO_32);
> + write_vec_element_i32(s, tcg_op, rd, pass, size);
> }
> tcg_temp_free_i32(tcg_op);
> }
--
Alex Bennée
next prev parent reply other threads:[~2018-04-30 15:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-25 1:22 [Qemu-devel] [PATCH 0/9] target/arm: Fixups for ARM_FEATURE_V8_FP16 Richard Henderson
2018-04-25 1:22 ` [Qemu-devel] [PATCH 1/9] target/arm: Implement vector shifted SCVF/UCVF for fp16 Richard Henderson
2018-04-27 16:04 ` Alex Bennée
2018-04-29 14:44 ` Richard Henderson
2018-04-29 15:27 ` Peter Maydell
2018-04-25 1:22 ` [Qemu-devel] [PATCH 2/9] target/arm: Implement vector shifted FCVT " Richard Henderson
2018-04-30 15:55 ` Alex Bennée [this message]
2018-04-25 1:22 ` [Qemu-devel] [PATCH 3/9] target/arm: Fix float16 to/from int16 Richard Henderson
2018-05-01 10:10 ` Alex Bennée
2018-04-25 1:22 ` [Qemu-devel] [PATCH 4/9] target/arm: Clear SVE high bits for FMOV Richard Henderson
2018-05-01 10:44 ` Alex Bennée
2018-04-25 1:22 ` [Qemu-devel] [PATCH 5/9] target/arm: Implement FMOV (general) for fp16 Richard Henderson
2018-04-25 1:31 ` Philippe Mathieu-Daudé
2018-04-25 8:40 ` Richard Henderson
2018-04-25 1:22 ` [Qemu-devel] [PATCH 6/9] target/arm: Implement FCVT (scalar, integer) " Richard Henderson
2018-05-01 10:55 ` Alex Bennée
2018-04-25 1:22 ` [Qemu-devel] [PATCH 7/9] target/arm: Implement FCVT (scalar, fixed-point) " Richard Henderson
2018-05-01 10:57 ` Alex Bennée
2018-04-25 1:22 ` [Qemu-devel] [PATCH 8/9] target/arm: Implement FP data-processing (2 source) " Richard Henderson
2018-05-01 11:13 ` Alex Bennée
2018-05-02 18:28 ` Richard Henderson
2018-05-02 18:47 ` Richard Henderson
2018-04-25 1:23 ` [Qemu-devel] [PATCH 9/9] target/arm: Implement FP data-processing (3 " Richard Henderson
2018-05-01 11:21 ` Alex Bennée
2018-05-02 18:49 ` Richard Henderson
2018-04-25 1:35 ` [Qemu-devel] [PATCH 0/9] target/arm: Fixups for ARM_FEATURE_V8_FP16 no-reply
2018-04-25 9:14 ` Alex Bennée
2018-04-27 17:22 ` Alex Bennée
2018-04-27 18:55 ` Alex Bennée
2018-04-27 19:50 ` Alex Bennée
2018-05-11 2:17 ` Richard Henderson
2018-05-11 21:13 ` Alex Bennée
2018-05-01 15:47 ` Alex Bennée
2018-05-01 18:35 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lgd44rkk.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.