From nobody Tue Oct 28 12:14:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515566204693931.8657699243815; Tue, 9 Jan 2018 22:36:44 -0800 (PST) Received: from localhost ([::1]:48443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZA0C-0002hh-0i for importer@patchew.org; Wed, 10 Jan 2018 01:36:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZ9xJ-0000ph-QY for qemu-devel@nongnu.org; Wed, 10 Jan 2018 01:33:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZ9xF-0007L7-WE for qemu-devel@nongnu.org; Wed, 10 Jan 2018 01:33:45 -0500 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:40665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eZ9xF-0007Kq-QR for qemu-devel@nongnu.org; Wed, 10 Jan 2018 01:33:41 -0500 Received: by mail-pl0-x241.google.com with SMTP id 62so6728388pld.7 for ; Tue, 09 Jan 2018 22:33:41 -0800 (PST) Received: from pike.twiddle.net (97-113-183-164.tukw.qwest.net. [97.113.183.164]) by smtp.gmail.com with ESMTPSA id y1sm29172963pgc.52.2018.01.09.22.33.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jan 2018 22:33:39 -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=UFqJDWvUw1rDGkRcgOYidWu2Y9N8QkkSi1gxjUW7cl4=; b=hFQ7tTiXKY2D1a3QKhBdAzAig5mBb7VGvaZ6WgaZWojWXLIBxzassI8KB64DVEJb9b oIXqtl/5wEmIrW1EYmNHZeGbsJ64vnpNW/Emruh3s83Uau76MUaxeV4GdOyX9DIINYFW LwpIlK3aIUlgvFJfc9Wi8BTJfEpbU/zLJtnQ0= 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=UFqJDWvUw1rDGkRcgOYidWu2Y9N8QkkSi1gxjUW7cl4=; b=mcCX5ef6XFYNvJYMXRPgr3MaP0gtAARIY6886wZCbXH/UFQ7OLacYdJ+NlDTHmZWy7 21MFc0fnLbnk/vgNR974caMVWqA4OWFsigMDD81jXK91mDnEoPbOPWPUKhZwCwJVTYxe sl3Ql0Vcpb8Hnbuy/0E5LacsKQN/JdSME8J53/VQ8oJTZG3Ejdu1M+HZ9xXm0flTz0bN VNrTA4hRLq90KBXIIZrpL1/mghICLormxgeiBFaExHpND4GEthBIFssmCXvYWAZX0Znc nBxyV7JJU9N93mO6uZ7QAD/krblGGd3sYW1hE9FzFKV0Un9xpnOI9gxBkdLPD1Zh56N5 cuoA== X-Gm-Message-State: AKGB3mKBlYdi57EHyAOjHwTVAPc56IktA58P+8zxPyMJSvSoqz2po12j qqz0+SyzL0pr98ffgNGKYqrfNSDj19g= X-Google-Smtp-Source: ACJfBotm8GLNE3Mh+eY/CUAQ3ddfOPST1eWVUAiW4+eTqypXLUkG2aP/K2XUecbta/x+WyZ1pSurcw== X-Received: by 10.84.247.141 with SMTP id o13mr17767075pll.285.1515566020484; Tue, 09 Jan 2018 22:33:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 9 Jan 2018 22:33:36 -0800 Message-Id: <20180110063337.21538-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180110063337.21538-1-richard.henderson@linaro.org> References: <20180110063337.21538-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [PATCH 1/2] target/arm: Split out vfp_expand_imm 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 44 ++++++++++++++++++++++++++++--------------= -- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index ecb72e4d9c..e03cd3801a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5014,6 +5014,33 @@ static void disas_fp_3src(DisasContext *s, uint32_t = insn) } } =20 +/* The imm8 encodes the sign bit, enough bits to represent an exponent in + * the range 01....1xx to 10....0xx, and the most significant 4 bits of + * the mantissa; see VFPExpandImm() in the v8 ARM ARM. + */ +static uint64_t vfp_expand_imm(int size, uint8_t imm8) +{ + uint64_t imm; + + switch (size) { + case MO_64: + imm =3D (extract32(imm8, 7, 1) ? 0x8000 : 0) | + (extract32(imm8, 6, 1) ? 0x3fc0 : 0x4000) | + extract32(imm8, 0, 6); + imm <<=3D 48; + break; + case MO_32: + imm =3D (extract32(imm8, 7, 1) ? 0x8000 : 0) | + (extract32(imm8, 6, 1) ? 0x3e00 : 0x4000) | + (extract32(imm8, 0, 6) << 3); + imm <<=3D 16; + break; + default: + g_assert_not_reached(); + } + return imm; +} + /* Floating point immediate * 31 30 29 28 24 23 22 21 20 13 12 10 9 5 4 0 * +---+---+---+-----------+------+---+------------+-------+------+------+ @@ -5037,22 +5064,7 @@ static void disas_fp_imm(DisasContext *s, uint32_t i= nsn) return; } =20 - /* The imm8 encodes the sign bit, enough bits to represent - * an exponent in the range 01....1xx to 10....0xx, - * and the most significant 4 bits of the mantissa; see - * VFPExpandImm() in the v8 ARM ARM. - */ - if (is_double) { - imm =3D (extract32(imm8, 7, 1) ? 0x8000 : 0) | - (extract32(imm8, 6, 1) ? 0x3fc0 : 0x4000) | - extract32(imm8, 0, 6); - imm <<=3D 48; - } else { - imm =3D (extract32(imm8, 7, 1) ? 0x8000 : 0) | - (extract32(imm8, 6, 1) ? 0x3e00 : 0x4000) | - (extract32(imm8, 0, 6) << 3); - imm <<=3D 16; - } + imm =3D vfp_expand_imm(MO_32 + is_double, imm8); =20 tcg_res =3D tcg_const_i64(imm); write_fp_dreg(s, rd, tcg_res); --=20 2.13.6