From patchwork Mon Feb 4 05:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157378 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3518741jaa; Sun, 3 Feb 2019 21:42:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN7o3VJLOZtimui68rzzERqq1GtXP+7rfhPZWdtJ9hoRC1aVHXAoub+zkpnzh00HRKvavBxc X-Received: by 2002:a0d:c182:: with SMTP id c124mr46392799ywd.190.1549258935683; Sun, 03 Feb 2019 21:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549258935; cv=none; d=google.com; s=arc-20160816; b=pXIyhmfroEZn9M0wsXx+Xy1sShWBkm1LWgqZFqKw9CVovQcbMu9LQME/g3SbUlDebJ 6JQxWHnblYAfItfYKgDN0yyJEbysCjc9WqhB20uTbp6X5WV2Vj8aESfwm5pmOCVTWt8M 4+ZaXayMNLLcPO4gXTDZAcaQAwU+i/spDLu+RGjIq2zAMlLV0dNNJunwTSlfbHnMkj8B hsFt9GngkXsWxNXswwqw7i5ijizw893XsPH+CF7hxKk1TD3BMMDMlWR00TbodrYFBpCO Yo1ct2sJ01gEFabzEb6odkudNEpNdeDoiNr+8UNCuKCqagdxUVnQaqcdRQC1WIAUphZ7 KM1Q== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=8I5T5uoh7QBC/Ztx5KMfr0VjyqXfDsNWAzBv0p6cEpg=; b=Ach+tAw4HT+HcaBxrP8ZPBqoVUKOXtNCmc/nrvNDUktxF1EnU/+T1/SVMrhGYEl5b2 Wq8qquOn3tk/iGLE0mr2UFvuF9f4m+xTVvKplixktIZqUvksWNoAKWLh5ql9/7o4x5aM /PLbSDN58Xoznw0CLkIzrPJTc3FK5qY1KCmUPrhKaftMNw4yx4BPmIW41AvinAeFz1zp J70CKM7XtATK8v6bEzwI9bSearZEVArRCXi7rGYTMZc+ThzfobXUWlIaTzkb7AgNLMmL zUnpMGTHqOEMrrGlZ+LddXrDl3IpUzu7U9uzSsfqg4pNJpQwXztPrJofVVdqQY3oVY4u s+lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G5gqzyle; 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 t127si1860922ywc.428.2019.02.03.21.42.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 03 Feb 2019 21:42:15 -0800 (PST) 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=G5gqzyle; 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 ([127.0.0.1]:36314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqX1L-00045e-6F for patch@linaro.org; Mon, 04 Feb 2019 00:42:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqWwc-00017m-2v for qemu-devel@nongnu.org; Mon, 04 Feb 2019 00:37:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gqWn2-0002gp-4O for qemu-devel@nongnu.org; Mon, 04 Feb 2019 00:27:29 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:55555) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gqWmy-0002a6-1Y for qemu-devel@nongnu.org; Mon, 04 Feb 2019 00:27:26 -0500 Received: by mail-wm1-x342.google.com with SMTP id y139so11686098wmc.5 for ; Sun, 03 Feb 2019 21:27:20 -0800 (PST) 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; bh=8I5T5uoh7QBC/Ztx5KMfr0VjyqXfDsNWAzBv0p6cEpg=; b=G5gqzylejOk2bTmXCBzbZwS6RS7xuzniPzYg1CAi/+GNyzt1mmsJaDCcZydPQnZKKp hKD7IOqd9KXmHrUwEyK+z0EhvltKyp2EP0eq3eemlbqm1exAqEZWBjA6CQp6Z+fwWZVR ePoEkxUOAgdEtBDK8DenNPvfLz1vhDvSFpcxY= 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; bh=8I5T5uoh7QBC/Ztx5KMfr0VjyqXfDsNWAzBv0p6cEpg=; b=eqibdOa3WOIR0Se6128u/23v3M7XVbxHxfqxwnuX5F2jQmKZ4JIDMRZKndKtPcDGRf c4ZrBnYTUfDAW5dD856ZPu5cak4Fj8WG4FiZWLxbYY0PPkoppqIlH2rh8fa6cjOFthzn GwXF5MQcL6NJ71obAkdZx6DPJVsGNr0MthLy2DCESn9hXaP39yJKhj5Pb6CpHV6BFM2a 3kqd/2BagjcdXUg28xhGzlg1yvfiWCD5sSgUW/udl48sXMnBJ8cKIXupLq9F+tKvpYmf Q5Wn2PAxB8x/tLaBbD721bVG2+NZfwUI0V0ikprBjh6vWzt/m04AV+VICnE9ExJ1zSUV ozNQ== X-Gm-Message-State: AHQUAuZVelukrzST6fTS41w4xOLtxHb2pBqPB/8cy+ZB9Kdcduu9O9Ds ALqz1a+GH0JTMVyhU8QovgDxpKBwh5ux2A== X-Received: by 2002:a1c:414:: with SMTP id 20mr11851817wme.67.1549258039459; Sun, 03 Feb 2019 21:27:19 -0800 (PST) Received: from cloudburst.twiddle.net (host81-133-38-158.in-addr.btopenworld.com. [81.133.38.158]) by smtp.gmail.com with ESMTPSA id r9sm25149962wmb.27.2019.02.03.21.27.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Feb 2019 21:27:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 4 Feb 2019 05:27:11 +0000 Message-Id: <20190204052712.30833-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190204052712.30833-1-richard.henderson@linaro.org> References: <20190204052712.30833-1-richard.henderson@linaro.org> 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 2/3] target/arm: Restructure disas_fp_int_conv X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For opcodes 0-5, move some if conditions into the structure of a switch statement. For opcodes 6 & 7, decode everything at once with a second switch. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 94 ++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 45 deletions(-) -- 2.17.2 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a1997e3ae2..90298ac562 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -6473,68 +6473,72 @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn) int type = extract32(insn, 22, 2); bool sbit = extract32(insn, 29, 1); bool sf = extract32(insn, 31, 1); + bool itof = false; if (sbit) { - unallocated_encoding(s); - return; + goto do_unallocated; } - if (opcode > 5) { - /* FMOV */ - bool itof = opcode & 1; - - if (rmode >= 2) { - unallocated_encoding(s); - return; - } - - switch (sf << 3 | type << 1 | rmode) { - case 0x0: /* 32 bit */ - case 0xa: /* 64 bit */ - case 0xd: /* 64 bit to top half of quad */ - break; - case 0x6: /* 16-bit float, 32-bit int */ - case 0xe: /* 16-bit float, 64-bit int */ - if (dc_isar_feature(aa64_fp16, s)) { - break; - } - /* fallthru */ - default: - /* all other sf/type/rmode combinations are invalid */ - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - handle_fmov(s, rd, rn, type, itof); - } else { - /* actual FP conversions */ - bool itof = extract32(opcode, 1, 1); - - if (rmode != 0 && opcode > 1) { - unallocated_encoding(s); - return; + switch (opcode) { + case 2: /* SCVTF */ + case 3: /* UCVTF */ + itof = true; + /* fallthru */ + case 4: /* FCVTAS */ + case 5: /* FCVTAU */ + if (rmode != 0) { + goto do_unallocated; } + /* fallthru */ + case 0: /* FCVT[NPMZ]S */ + case 1: /* FCVT[NPMZ]U */ switch (type) { case 0: /* float32 */ case 1: /* float64 */ break; case 3: /* float16 */ - if (dc_isar_feature(aa64_fp16, s)) { - break; + if (!dc_isar_feature(aa64_fp16, s)) { + goto do_unallocated; } - /* fallthru */ + break; default: - unallocated_encoding(s); - return; + goto do_unallocated; } - if (!fp_access_check(s)) { return; } handle_fpfpcvt(s, rd, rn, opcode, itof, rmode, 64, sf, type); + break; + + default: + switch (sf << 6 | type << 5 | rmode << 3 | opcode) { + case 0b01100110: /* FMOV half <-> 32-bit int */ + case 0b01100111: + case 0b11100110: /* FMOV half <-> 64-bit int */ + case 0b11100111: + if (!dc_isar_feature(aa64_fp16, s)) { + goto do_unallocated; + } + /* fallthru */ + case 0b00000110: /* FMOV 32-bit */ + case 0b00000111: + case 0b10100110: /* FMOV 64-bit */ + case 0b10100111: + case 0b11001110: /* FMOV top half of 128-bit */ + case 0b11001111: + if (!fp_access_check(s)) { + return; + } + itof = opcode & 1; + handle_fmov(s, rd, rn, type, itof); + break; + + default: + do_unallocated: + unallocated_encoding(s); + return; + } + break; } }