From patchwork Wed Feb 6 05:28:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157572 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6012959jaa; Tue, 5 Feb 2019 21:31:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IaHcsp2UnLEg6G0AgpMRiN++ebeGQP6ExTl8b0+ZC9HHoBqu8Zw8fkoN3R1Nwap8JefvZZL X-Received: by 2002:a5b:903:: with SMTP id a3mr7161525ybq.445.1549431084317; Tue, 05 Feb 2019 21:31:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549431084; cv=none; d=google.com; s=arc-20160816; b=ldN/SdU8kbG1UG2wbFdlvy7AuM9884vi8n4/fNkb9NY46c8n6ZbRuhAPokPB8XHYr0 obX/KVUx9P5czW9YIvcbrx8dAL7jMqDIvFuQ8Ecq8I2pHGjyHRIj2N9/gX249ypkPJb7 IBurG9yrqqWJivattHmOIxOqk1Ey5hngeOJa+jUd/JrE71Z+C4ZxEkA7mVphV+ExD67V 54pPtonyW8rzT19tlXJOX6zwAAhMfwYHhxktFSPeIvlb/KfB9BDE8h7Ds6gQBD/uV2Qm lVPvX6lktdZa9YhiXX3b/5ZYLgGB8I1Mjid8wyK8KxUz1RSgcUNVgDpJIAMrqJQnyjPC pRrg== 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=ij+VvMOypxEBP+HLSOzfpJHmuZw6B9qxZK/GJcNhZMk=; b=drukR3qCZkypNW1I3FwN5wrk8LZqXzVVpxB/dujoi0KKQqcuoMFPWPSMTaVG7h+9aP uF8TkyVgOk7CeDQVWYMOoA6sFWFoCLWCpSfVxSGoqKaquiNJmtnKiydhndoc0H6dafB9 b2FiJhKZZopaJ9OymRQft3tyVLlZovXxJEQYPWLVFhnOVZzFEHzYJCAfXxwdv85Aa+L7 aNiHA3lyNxFDnM+L0LGio6+zYl57+t0G0Vw6JCRuIHxJ6UIEvFRrXF5gLqwpPuCDQin3 0J4so2q4qjjt3E7HJspCBOjcnROfy2CKLJyuiBslse+4FowTCe8mZ7ufIQNzEjEft2LI IPfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zSHijy0R; 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 h95si3299912ybi.407.2019.02.05.21.31.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 05 Feb 2019 21:31:24 -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=zSHijy0R; 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]:45398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grFnv-0004fn-RZ for patch@linaro.org; Wed, 06 Feb 2019 00:31:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grFli-0003l5-6S for qemu-devel@nongnu.org; Wed, 06 Feb 2019 00:29:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grFlh-00069f-CB for qemu-devel@nongnu.org; Wed, 06 Feb 2019 00:29:06 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:34488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1grFlh-00069H-6V for qemu-devel@nongnu.org; Wed, 06 Feb 2019 00:29:05 -0500 Received: by mail-wr1-x442.google.com with SMTP id z15so4070691wrn.1 for ; Tue, 05 Feb 2019 21:29:05 -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=ij+VvMOypxEBP+HLSOzfpJHmuZw6B9qxZK/GJcNhZMk=; b=zSHijy0RaiEkH/c5D8wZGHAoyFO8mGp0wudcYehNjE9TbanP6wAFjoFC4RCflF0QK+ eQ3TDKN1vF5o/HICl9ZJFsYwe/6zaKg/MZzrIRxpm8ZjvcXdkDDIiZjrdwqDpJZ78KxF ePvAYeALjcVtGon73RjDvgqayTOj59GBRUGHI0oXEB2esqOaYP9E7MPKXg6K7vJdnjNA GV9e4hVLhZfTYxdaayRuowa34j8aNJ9va/ZAapP3LKbt6w9YxvBDbDV2F/PZGWxyNWGu bvs4DRQ56M3rSolEK/dhTp1UsspHt5WJTLeRFDfWQ1M0KWFGJnQPSCfBzSo88ANI/7RK znFQ== 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=ij+VvMOypxEBP+HLSOzfpJHmuZw6B9qxZK/GJcNhZMk=; b=ZUz0QFMkgFpyMQQjhjoOZcqPBwV1WIKTIvls7Mz9+5yHE8QbPTatsjoEYq03/HjqO+ 4XMZxFtO4T0N0VcPKPLRXORpLCw9bQtCPPR92ld3Pod3E4+DCcMY77eK0FiY6yBbkKFP mAdz5SjztDBuvXnMyaqoUvKWm/NUyYfmAYqNqOC/mGl3mET4KR6STiGYXzoXJlfBKTKZ R8jVqzRndfJBH9Jaqa85dEgJILaPefuCcVTNQbs9EouAbx/ALmdusH7OPWvHveaQIDYS K59APUWhhVFxVTGo9QeYNRv1E76ypLqAiDAKdq3IYzHrOxS4hvjEEcZqNICgFbcDsC2U +bXw== X-Gm-Message-State: AHQUAuZ3yfVTyc0BjxG9sNOL4oN6s5R+b0McSw2oo6cJlrwSmkeGmojm jdeOeRCZiGZJwKia8DMThbXZKIL+eppG0g== X-Received: by 2002:a5d:4486:: with SMTP id j6mr5988027wrq.41.1549430943889; Tue, 05 Feb 2019 21:29:03 -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 g9sm19057394wmg.44.2019.02.05.21.29.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Feb 2019 21:29:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 6 Feb 2019 05:28:56 +0000 Message-Id: <20190206052857.5077-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190206052857.5077-1-richard.henderson@linaro.org> References: <20190206052857.5077-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::442 Subject: [Qemu-devel] [PATCH v2 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 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 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index e002251ac6..2f849a6951 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -6541,68 +6541,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 << 7 | 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; } }