From patchwork Tue Jun 11 10:53:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166429 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2259002ilk; Tue, 11 Jun 2019 04:57:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvOFwPqWZmLLqRZihS6Uv0wA7BhYhUt+JchAYqy5tJIQmknX+Mtq4yJtG9kO51Ja+98spb X-Received: by 2002:ac8:2bdc:: with SMTP id n28mr25824601qtn.197.1560254224284; Tue, 11 Jun 2019 04:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560254224; cv=none; d=google.com; s=arc-20160816; b=ThTZ6d2yaXF4FKlmVW/O1NsXxvzBTmPAJdPGHl2sKSVGsc4BPSiO+8WHbR6g0chXb3 fllqWzJF+zvQF7zZw8oI1CEqQhobgegHwaQjyp7SVS3EWAxxzZPjDzuDclY9WNVINrn9 er+FZVPAKusr5/ygxrd574Slt0v2vyhyX3suGtpqWxUOTN5ILmsM8WttvNJGVeE52dH8 ooVAWkaN9gH61Nl5Ikdmd0pXqzENujH6bX26cJIq7nsgIs8IJSytG7x3+r6M0NCEjtDd pFcyRVGloGhbACJ5A4/dCFTcVsxIABr4VALgohePN0eUGEcB4LeORNtUWI7k2NYbQKca pvIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=1Cb4GG/N0hQlMvIMpbgSnw6lrsX++V30qcwL0TcatYU=; b=ZEa75vB+I6TyEr3S56hKIyv/nACEHrSBoLaVpRRHGtDOp8QyTDEzZliQ3oj/oBNlIE Sb4so4Z1JLNrp9sMfkVYRNaoOg0EwWMAn5fKh3FsdgTjAEy1lIX4BGwlfJ3C/qLqcYj7 Sjf9ZdQ3H6MBRoaiQnKyrERZAQshLwPgjt14ib7FygYj8ZfYl+qhQi9Xkz2H3Gmz/buN 6uj2xLv2/+wDAAQqXkehQuy1zOkgcmuMvJe2VqqSUJBysacth9Jbc50m48VJcKrLhj26 n1SFlhQAXeQfLosWw2YbRtj0277ESJKW2Mz2oCXZ6mKutgnBmfvkLxF4m+o1gWMBhCfO +nbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MjuxaPYw; 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=fail (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 o56si1783129qvc.130.2019.06.11.04.57.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:57:04 -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=fail header.i=@linaro.org header.s=google header.b=MjuxaPYw; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafOg-0005wu-T6 for patch@linaro.org; Tue, 11 Jun 2019 07:57:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39932) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQb-0007sf-OV for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQV-00083M-Lh for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:57 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:35563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQV-0007i3-48 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:51 -0400 Received: by mail-wm1-x342.google.com with SMTP id c6so2405353wml.0 for ; Tue, 11 Jun 2019 03:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1Cb4GG/N0hQlMvIMpbgSnw6lrsX++V30qcwL0TcatYU=; b=MjuxaPYw8gZ0fEudszZMotW98mjs6hyxWmS/Wv4nepPT77OE3T3LfZoT5BOkfimoSQ 82psXIrCmPcZdzBQGvJLCQrA7XGiuiaOGzh73QEUmRYEG083Y5OnhbEm2vRUOhLPcNKl uNWBmQuXAF+NEs7d7fOD8z0mm8JFiNNaWTdw7cDMQWfOvnUsg80bjsJqzW3sFh1zPud/ ihZ0TcueJTGCxUulY6dBJdSii+2PEAWm4ny/mCzMjxu3IXyuz+oBBocp8k4KkemmULdm /loozQfDy/Sm9Pcd4CNeXRMMs3GWGVOOK23tEf+SeNTMkv8DliuMZ8EtARds7UDhVP3x +RrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1Cb4GG/N0hQlMvIMpbgSnw6lrsX++V30qcwL0TcatYU=; b=A5uyOWhaZTGVS1l+mw2mXm6eqsoqq/qW7433IYzZfvimSNngnUTJoxFNSn6f/aRNfc 2ad8RiU3NyIE0dh6EG1CTvQzUPVZGZwJvqyLY241YR1JJz7S8EXE71FMkMbXF39VUfT+ +HX+b7iRmQJNLnVtNImYxs0NHQzFfM/xVqVX2IOn6cK3v2AMhYc3q0j99UpjHjnfB6fG EA7U+gBACCHV3Jh7AytBZJ5mQspVkhuGrEywXaIpiFwwNYUbd9UKetBCRrf3goFpJbS0 4nqqkQoJzGdt3uv9aZIZhL6yXnrRsrDenVrXQ0aLXujp72wcLrQv7cLPac6DSejvh0J1 Zk7g== X-Gm-Message-State: APjAAAUKtBg1LLYtFKv7oViVukTb9qX9G8NFmYt8kEjISi373RF1vslP Fe7I92PrKNXfSkASZ9dwEkBI/g== X-Received: by 2002:a05:600c:389:: with SMTP id w9mr16505061wmd.139.1560250469238; Tue, 11 Jun 2019 03:54:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:28 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:42 +0100 Message-Id: <20190611105351.9871-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 33/42] target/arm: Convert VFP comparison insns to decodetree 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: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP comparison instructions to decodetree. Note that comparison instructions should not honour the VFP short-vector length and stride information: they are scalar-only operations. This applies to all the 2-operand instructions except for VMOV, VABS, VNEG and VSQRT. (In the old decoder this is implemented via the "if (op == 15 && rn > 3) { veclen = 0; }" check.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 75 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 51 +---------------------- target/arm/vfp.decode | 5 +++ 3 files changed, 81 insertions(+), 50 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index a7e4ae31985..ebde86210a6 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1938,3 +1938,78 @@ static bool trans_VSQRT_dp(DisasContext *s, arg_VSQRT_dp *a) { return do_vfp_2op_dp(s, gen_VSQRT_dp, a->vd, a->vm); } + +static bool trans_VCMP_sp(DisasContext *s, arg_VCMP_sp *a) +{ + TCGv_i32 vd, vm; + + /* Vm/M bits must be zero for the Z variant */ + if (a->z && a->vm != 0) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vd = tcg_temp_new_i32(); + vm = tcg_temp_new_i32(); + + neon_load_reg32(vd, a->vd); + if (a->z) { + tcg_gen_movi_i32(vm, 0); + } else { + neon_load_reg32(vm, a->vm); + } + + if (a->e) { + gen_helper_vfp_cmpes(vd, vm, cpu_env); + } else { + gen_helper_vfp_cmps(vd, vm, cpu_env); + } + + tcg_temp_free_i32(vd); + tcg_temp_free_i32(vm); + + return true; +} + +static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a) +{ + TCGv_i64 vd, vm; + + /* Vm/M bits must be zero for the Z variant */ + if (a->z && a->vm != 0) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((a->vd | a->vm) & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vd = tcg_temp_new_i64(); + vm = tcg_temp_new_i64(); + + neon_load_reg64(vd, a->vd); + if (a->z) { + tcg_gen_movi_i64(vm, 0); + } else { + neon_load_reg64(vm, a->vm); + } + + if (a->e) { + gen_helper_vfp_cmped(vd, vm, cpu_env); + } else { + gen_helper_vfp_cmpd(vd, vm, cpu_env); + } + + tcg_temp_free_i64(vd); + tcg_temp_free_i64(vm); + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index ad723466b18..761e8347fa0 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1390,30 +1390,6 @@ static inline void gen_vfp_neg(int dp) gen_helper_vfp_negs(cpu_F0s, cpu_F0s); } -static inline void gen_vfp_cmp(int dp) -{ - if (dp) - gen_helper_vfp_cmpd(cpu_F0d, cpu_F1d, cpu_env); - else - gen_helper_vfp_cmps(cpu_F0s, cpu_F1s, cpu_env); -} - -static inline void gen_vfp_cmpe(int dp) -{ - if (dp) - gen_helper_vfp_cmped(cpu_F0d, cpu_F1d, cpu_env); - else - gen_helper_vfp_cmpes(cpu_F0s, cpu_F1s, cpu_env); -} - -static inline void gen_vfp_F1_ld0(int dp) -{ - if (dp) - tcg_gen_movi_i64(cpu_F1d, 0); - else - tcg_gen_movi_i32(cpu_F1s, 0); -} - #define VFP_GEN_ITOF(name) \ static inline void gen_vfp_##name(int dp, int neon) \ { \ @@ -3091,6 +3067,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 15: switch (rn) { case 0 ... 3: + case 8 ... 11: /* Already handled by decodetree */ return 1; default: @@ -3135,11 +3112,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rd_is_dp = false; break; - case 0x08: case 0x0a: /* vcmp, vcmpz */ - case 0x09: case 0x0b: /* vcmpe, vcmpez */ - no_output = true; - break; - case 0x0c: /* vrintr */ case 0x0d: /* vrintz */ case 0x0e: /* vrintx */ @@ -3240,14 +3212,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) /* Load the initial operands. */ if (op == 15) { switch (rn) { - case 0x08: case 0x09: /* Compare */ - gen_mov_F0_vreg(dp, rd); - gen_mov_F1_vreg(dp, rm); - break; - case 0x0a: case 0x0b: /* Compare with zero */ - gen_mov_F0_vreg(dp, rd); - gen_vfp_F1_ld0(dp); - break; case 0x14: /* vcvt fp <-> fixed */ case 0x15: case 0x16: @@ -3357,19 +3321,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) gen_vfp_msr(tmp); break; } - case 8: /* cmp */ - gen_vfp_cmp(dp); - break; - case 9: /* cmpe */ - gen_vfp_cmpe(dp); - break; - case 10: /* cmpz */ - gen_vfp_cmp(dp); - break; - case 11: /* cmpez */ - gen_vfp_F1_ld0(dp); - gen_vfp_cmpe(dp); - break; case 12: /* vrintr */ { TCGv_ptr fpst = get_fpstatus_ptr(0); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index b72ab8b8067..9db7aa7021a 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -176,3 +176,8 @@ VSQRT_sp ---- 1110 1.11 0001 .... 1010 11.0 .... \ vd=%vd_sp vm=%vm_sp VSQRT_dp ---- 1110 1.11 0001 .... 1011 11.0 .... \ vd=%vd_dp vm=%vm_dp + +VCMP_sp ---- 1110 1.11 010 z:1 .... 1010 e:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp +VCMP_dp ---- 1110 1.11 010 z:1 .... 1011 e:1 1.0 .... \ + vd=%vd_dp vm=%vm_dp