From patchwork Mon Aug 24 14:29:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 248210 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp2606233ils; Mon, 24 Aug 2020 07:32:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOs0KkJ9UMYCoKVqsSokeOKWQT7Ok+HElkxvPEAlNQd51KaiWAZOKJmqmZYzLWeN/ppIuu X-Received: by 2002:a5b:2cb:: with SMTP id h11mr7485163ybp.116.1598279559305; Mon, 24 Aug 2020 07:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598279559; cv=none; d=google.com; s=arc-20160816; b=BSSyNpmGBul1/sq6NSVfCr42+RgY8p0rjhRNRr2r5UB81lQtqX/Gn9HxSAkfLCwKfT YJ1ztCIzgEUZ/2qKFeQK2wY/GlSJ7SWo2CuB/nde/o+ZDe3aDJtNFw7yVmE2uLg5htCv iwW0NdOkW40OWjcA+YI64Pt4Yeu0V9XeFVDeLgPIXh7bFh9Xw7MeiSY15tqX3TDrgWqf J4jp3I7KdM00YUT87W6AxoUbFNmtuuMs30QQCVOYx9XiSSc8VJaDHpUDtz4tNZBmzDD6 dzoPcbbNtMJlQOZRPwQwRC9k7/VKaMF5Vne0ct4vnjqei0TZheJqTFkeSWqvuD+5tMg/ CqPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ns18dr1TbvMInuyF6XsP9cAv2g8MfPEdo1sa6I2VYXQ=; b=YRyVsi5u1wJPekENM8Q4cDWEnozoDA+W/BFxthD7MT1GDMxAdIdDhDLQr10EFlcqKT 3EBTj5ecAinQjjdJkN3uHjIsc9a9zZzoGh8FONIS2rGZFtq6UuAqVkOMqLp/1z36Xeun D+YFBfPAt4fVU327GinHKroAV6NOwsXYIXNPRRfGQVyRV6EYtJ9bnFqA5UH1jcmDQS1M jQvqeVngb/n8nWQt+LQAjW2MaD40FFk3/cEQsDBIOHioijUcE6YSuXyYovVxdBaW4Si4 VTGwbtXDUwmhXz6Q+Kd+v+Agzbyb3hMZvAauO+kgV9yxbqfJUjk84ZZd10FbSW1HaVsE HeLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DAhDzBaA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a2si10937463ybi.478.2020.08.24.07.32.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Aug 2020 07:32:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DAhDzBaA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kADWY-0004A0-JK for patch@linaro.org; Mon, 24 Aug 2020 10:32:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kADTs-0008Sj-T1 for qemu-devel@nongnu.org; Mon, 24 Aug 2020 10:29:52 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kADTq-0002iY-Tr for qemu-devel@nongnu.org; Mon, 24 Aug 2020 10:29:52 -0400 Received: by mail-wm1-x342.google.com with SMTP id s20so3511520wmj.1 for ; Mon, 24 Aug 2020 07:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Ns18dr1TbvMInuyF6XsP9cAv2g8MfPEdo1sa6I2VYXQ=; b=DAhDzBaAB97/DphOstN0z5yRydSyUtL0benuls/OFabBeKPbpca5FTRYz3o+gXOyKa RrRsqOt2X2oTECiqnzE3g4qDGfGV2RK/M33reOWu097XTGcIsno3zJTM89T+IaRCk5Va amBWF5+OqkzEkkqxMI/xaVBpePnUXCqTG9wiUTTqbvzH7imaBGahM6vLBaKnBWbhW344 JdEMxolO/QeY+1GtBU+kSrZCVlxXqWP7ggZMyBgJHoo64TSTPOjX8e2ew5YAH/lsdl+e ZSTDSDk4hb8ckgaXi8qWQ/l0ULSqhW+PTbT5lbFEjeY2SzakbVadrgjf2dr/hVJJHohg vhnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ns18dr1TbvMInuyF6XsP9cAv2g8MfPEdo1sa6I2VYXQ=; b=uK8cT53NsJQBcbHJ+fqN2pYM9ZfhIQkxR87aU7/PezybeoAG+qOpen1K/aZd2HTZQd 0CEimBaakg7gD6xWraRYI+qYyVEkL0q4/knaThdNOFTxmJ516BBWG1TAXYGGf2OBLJq0 iyKT4Fn/4alNfrgvRrz01aau2DVwct17g+llyGs+u4G0wLVtEgJdkDQHTkySPl/YboGY qQXUp1wrt5g/ZFNPc+cbYKC4u7qXRPTXUgql1QM9DIfsWpjzYPpNvzUe7Ou1+PZndj0u PfNzlr+OtPpST8cwdysZb49Pg2otsZfCyI0drcVuabflyEcyzHoPIY40IT5W8kUd2g9r bRrA== X-Gm-Message-State: AOAM530IU+vNlpSI36J5j5exnDS/dAPVkgrBJP855VvThspcuq3nMOCG tSQMHLKVgQA2jh4bBIPtXuvCsQ== X-Received: by 2002:a1c:740e:: with SMTP id p14mr5786304wmc.179.1598279389443; Mon, 24 Aug 2020 07:29:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id b14sm24499091wrj.93.2020.08.24.07.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2020 07:29:48 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 12/22] target/arm: Implement VFP fp16 VCVT between float and integer Date: Mon, 24 Aug 2020 15:29:24 +0100 Message-Id: <20200824142934.20850-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200824142934.20850-1-peter.maydell@linaro.org> References: <20200824142934.20850-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the fp16 versions of the VFP VCVT instruction forms which convert between floating point and integer. Signed-off-by: Peter Maydell --- target/arm/vfp.decode | 4 +++ target/arm/translate-vfp.c.inc | 65 ++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 37f96e2d261..642ec039e3c 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -210,6 +210,8 @@ VCVT_sp ---- 1110 1.11 0111 .... 1010 11.0 .... @vfp_dm_ds VCVT_dp ---- 1110 1.11 0111 .... 1011 11.0 .... @vfp_dm_sd # VCVT from integer to floating point: Vm always single; Vd depends on size +VCVT_int_hp ---- 1110 1.11 1000 .... 1001 s:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp VCVT_int_sp ---- 1110 1.11 1000 .... 1010 s:1 1.0 .... \ vd=%vd_sp vm=%vm_sp VCVT_int_dp ---- 1110 1.11 1000 .... 1011 s:1 1.0 .... \ @@ -229,6 +231,8 @@ VCVT_fix_dp ---- 1110 1.11 1.1. .... 1011 .1.0 .... \ vd=%vd_dp imm=%vm_sp opc=%vcvt_fix_op # VCVT float to integer (VCVT and VCVTR): Vd always single; Vd depends on size +VCVT_hp_int ---- 1110 1.11 110 s:1 .... 1001 rz:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp VCVT_sp_int ---- 1110 1.11 110 s:1 .... 1010 rz:1 1.0 .... \ vd=%vd_sp vm=%vm_sp VCVT_dp_int ---- 1110 1.11 110 s:1 .... 1011 rz:1 1.0 .... \ diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc index 59ef4d4fbc3..0140822d183 100644 --- a/target/arm/translate-vfp.c.inc +++ b/target/arm/translate-vfp.c.inc @@ -2845,6 +2845,35 @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) return true; } +static bool trans_VCVT_int_hp(DisasContext *s, arg_VCVT_int_sp *a) +{ + TCGv_i32 vm; + TCGv_ptr fpst; + + if (!dc_isar_feature(aa32_fp16_arith, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vm = tcg_temp_new_i32(); + neon_load_reg32(vm, a->vm); + fpst = fpstatus_ptr(FPST_FPCR_F16); + if (a->s) { + /* i32 -> f16 */ + gen_helper_vfp_sitoh(vm, vm, fpst); + } else { + /* u32 -> f16 */ + gen_helper_vfp_uitoh(vm, vm, fpst); + } + neon_store_reg32(vm, a->vd); + tcg_temp_free_i32(vm); + tcg_temp_free_ptr(fpst); + return true; +} + static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a) { TCGv_i32 vm; @@ -3067,6 +3096,42 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) return true; } +static bool trans_VCVT_hp_int(DisasContext *s, arg_VCVT_sp_int *a) +{ + TCGv_i32 vm; + TCGv_ptr fpst; + + if (!dc_isar_feature(aa32_fp16_arith, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + fpst = fpstatus_ptr(FPST_FPCR_F16); + vm = tcg_temp_new_i32(); + neon_load_reg32(vm, a->vm); + + if (a->s) { + if (a->rz) { + gen_helper_vfp_tosizh(vm, vm, fpst); + } else { + gen_helper_vfp_tosih(vm, vm, fpst); + } + } else { + if (a->rz) { + gen_helper_vfp_touizh(vm, vm, fpst); + } else { + gen_helper_vfp_touih(vm, vm, fpst); + } + } + neon_store_reg32(vm, a->vd); + tcg_temp_free_i32(vm); + tcg_temp_free_ptr(fpst); + return true; +} + static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a) { TCGv_i32 vm;