From nobody Wed Apr 16 15:36:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550776302195255.8494337680304; Thu, 21 Feb 2019 11:11:42 -0800 (PST) Received: from localhost ([127.0.0.1]:37064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwtkv-0003QN-3I for importer@patchew.org; Thu, 21 Feb 2019 14:11:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwtXn-0008QI-18 for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwtXl-0007PW-54 for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:02 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:44724) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gwtXj-0007He-7r for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:01 -0500 Received: by mail-wr1-x42e.google.com with SMTP id w2so17186777wrt.11 for ; Thu, 21 Feb 2019 10:57:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c18sm29065085wre.32.2019.02.21.10.57.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 10:57:45 -0800 (PST) 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=fcFwP6kgL8uSzXhgIr8LZ9mznClXvotYfvlQAXBxjlQ=; b=s/09hg3Av/MzhQX2mxLEKLaj6JNCNsNc/i6sob4havVL+IVeaQYTSFZlGaEgtuwSAt onQcA8O5F5vqoIZPuiNrkZbDAh0HLHYB1ATP3Zmt/3XxN7NSEwb4tH5wgjnkT7oWb0nA uNIvbgmzcjbqZPSZFerv1xqGlDxN/DgUWmXMHilQ1KZec6a6AN7Mku+aq++L+3kV0UdY UvxxoGht1wVlbMa4Sc0qckn5FDthjSdSflJGU2tIeNjRWM2Vbx10Xg8pi7QnrQ4Srme8 /yg5KGiJkFqe9Sr3/0VRhd47qAOyqldlKw0sUWfe/Qd1HeOi6JIsXneniVifhep9MdXT zHQg== 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=fcFwP6kgL8uSzXhgIr8LZ9mznClXvotYfvlQAXBxjlQ=; b=tXMFKqPQD+831PTn7fOEBEOQiMw2eqFPtMti0FCv6er4YeqGul89+RvW8gO3/lC1zN FPzTO8wRB0tdTtHuTjooiXJwpOhrwGEk54Xqq0R6V3kJkpW4WCiSHi0bcuDg0bcLjoAR 4AGUdJGRa7U32GldZ4sBP6fpoyY+MtIpRvSkmIbbyL6oL2Y4uJdZHBkskq/9ab4bwxGh eLDfo9DInZ1d9FjdEUt3eyclNLH8g4dhVSF6q9StsfsMu52sTqasSskrg1D5Y65Tdj9n 8wqDs/6j6s/YZP2RRmRg6iEG0CChQSetyCeaaETxHOz2Rh2YxNBp3F2MvPd8TEcCMv5v Itaw== X-Gm-Message-State: AHQUAuYx4fye2MYIz3Xt/jY0+oFMHn8KDwEvmS0/SF2ScC0DVwZxuZUA 2v8Hg0YjqGqUPZ0+fhLH3VmYRHPTzWo= X-Google-Smtp-Source: AHgI3IYXR4+X40DD05Pd92NOKNToWob3SfJBJl9l/rsZ/ah90b7JN2mq7WZIjYw8DgD9G+4u/8Inng== X-Received: by 2002:a5d:4841:: with SMTP id n1mr28569313wrs.85.1550775466577; Thu, 21 Feb 2019 10:57:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2019 18:57:22 +0000 Message-Id: <20190221185739.25362-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221185739.25362-1-peter.maydell@linaro.org> References: <20190221185739.25362-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e Subject: [Qemu-devel] [PULL 04/21] 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Richard Henderson 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 Message-id: 20190215192302.27855-2-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-a64.c | 94 ++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index af8e4fd4be1..dbce24fe32c 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, uint= 32_t insn) int type =3D extract32(insn, 22, 2); bool sbit =3D extract32(insn, 29, 1); bool sf =3D extract32(insn, 31, 1); + bool itof =3D false; =20 if (sbit) { - unallocated_encoding(s); - return; + goto do_unallocated; } =20 - if (opcode > 5) { - /* FMOV */ - bool itof =3D opcode & 1; - - if (rmode >=3D 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 =3D extract32(opcode, 1, 1); - - if (rmode !=3D 0 && opcode > 1) { - unallocated_encoding(s); - return; + switch (opcode) { + case 2: /* SCVTF */ + case 3: /* UCVTF */ + itof =3D true; + /* fallthru */ + case 4: /* FCVTAS */ + case 5: /* FCVTAU */ + if (rmode !=3D 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 =3D opcode & 1; + handle_fmov(s, rd, rn, type, itof); + break; + + default: + do_unallocated: + unallocated_encoding(s); + return; + } + break; } } =20 --=20 2.20.1