From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMfNx-0004JC-8Z for qemu-devel@nongnu.org; Sun, 09 Mar 2014 11:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMfNv-0004zP-Sg for qemu-devel@nongnu.org; Sun, 09 Mar 2014 11:11:29 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:46487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMfNv-0004x2-LS for qemu-devel@nongnu.org; Sun, 09 Mar 2014 11:11:27 -0400 From: Peter Maydell Date: Sun, 9 Mar 2014 15:11:01 +0000 Message-Id: <1394377867-7115-11-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1394377867-7115-1-git-send-email-peter.maydell@linaro.org> References: <1394377867-7115-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 10/16] target-arm: A64: Implement FCVTN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Crosthwaite , patches@linaro.org, Michael Matz , Alexander Graf , Will Newton , Dirk Mueller , Laurent Desnogues , =?UTF-8?q?Alex=20Benn=C3=A9e?= , kvmarm@lists.cs.columbia.edu, Christoffer Dall , Richard Henderson Implement FCVTN (narrowing fp-to-fp conversions) from the SIMD 2-reg-misc category. Signed-off-by: Peter Maydell --- target-arm/translate-a64.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index d0df8d2..a958aa6 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -8450,13 +8450,30 @@ static void handle_2misc_narrow(DisasContext *s, int opcode, bool u, bool is_q, genenvfn = fns[size][u]; break; } + case 0x16: /* FCVTN, FCVTN2 */ + /* 32 bit to 16 bit or 64 bit to 32 bit float conversion */ + if (size == 3) { + gen_helper_vfp_fcvtsd(tcg_res[pass], tcg_op, cpu_env); + } else { + TCGv_i32 tcg_lo = tcg_temp_new_i32(); + TCGv_i32 tcg_hi = tcg_temp_new_i32(); + tcg_gen_trunc_i64_i32(tcg_lo, tcg_op); + gen_helper_vfp_fcvt_f32_to_f16(tcg_lo, tcg_lo, cpu_env); + tcg_gen_shri_i64(tcg_op, tcg_op, 32); + tcg_gen_trunc_i64_i32(tcg_hi, tcg_op); + gen_helper_vfp_fcvt_f32_to_f16(tcg_hi, tcg_hi, cpu_env); + tcg_gen_deposit_i32(tcg_res[pass], tcg_lo, tcg_hi, 16, 16); + tcg_temp_free_i32(tcg_lo); + tcg_temp_free_i32(tcg_hi); + } + break; default: g_assert_not_reached(); } if (genfn) { genfn(tcg_res[pass], tcg_op); - } else { + } else if (genenvfn) { genenvfn(tcg_res[pass], cpu_env, tcg_op); } @@ -8807,6 +8824,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } break; case 0x16: /* FCVTN, FCVTN2 */ + handle_2misc_narrow(s, opcode, 0, is_q, size, rn, rd); + return; case 0x17: /* FCVTL, FCVTL2 */ case 0x18: /* FRINTN */ case 0x19: /* FRINTM */ -- 1.9.0