From nobody Thu Dec 18 19:37:53 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1546989279958695.0183250707648; Tue, 8 Jan 2019 15:14:39 -0800 (PST) Received: from localhost ([127.0.0.1]:50687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gh0Zy-0000YY-Rd for importer@patchew.org; Tue, 08 Jan 2019 18:14:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gh09H-0006QD-Q5 for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:47:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gh09H-00074e-1n for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:47:03 -0500 Received: from ozlabs.org ([203.11.71.1]:51933) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gh09G-00072q-M8; Tue, 08 Jan 2019 17:47:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 43Z6n03YS6z9sPZ; Wed, 9 Jan 2019 09:46:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1546987572; bh=8mjjAlXmkDbCulg/KITQVusgCKcGUSnZMuTTt/LrlEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTECbANWslXoBctSxcEbF6aIpbiKTmWJF+jV2mkUm0cE56NUG1pot3JWMVWYcPDjT AhzM0z5P1sAow2oHoU5ZuaC5OwGpcnIBWuiwPZN0cpSoG99SQFnCxrFWKy5YBTvHyu PcZQLUG4Q6p+ZyDO/DqEFLuJazoU8h5yqq9hn9x4= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 9 Jan 2019 09:45:37 +1100 Message-Id: <20190108224600.23125-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190108224600.23125-1-david@gibson.dropbear.id.au> References: <20190108224600.23125-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 06/29] target/ppc: switch EXTRACT_HELPER macros over to use sextract32/extract32 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: Richard Henderson , Mark Cave-Ayland , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson 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: Mark Cave-Ayland These ensure that we consistently handle signed and unsigned extensions cor= rectly when decoding immediates from instruction opcodes. Signed-off-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/internal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 8b35863549..5d460247e2 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -52,20 +52,20 @@ FUNC_MASK(mask_u64, uint64_t, 64, UINT64_MAX); #define EXTRACT_HELPER(name, shift, nb) = \ static inline uint32_t name(uint32_t opcode) = \ { = \ - return (opcode >> (shift)) & ((1 << (nb)) - 1); = \ + return extract32(opcode, shift, nb); = \ } =20 #define EXTRACT_SHELPER(name, shift, nb) = \ static inline int32_t name(uint32_t opcode) = \ { = \ - return (int16_t)((opcode >> (shift)) & ((1 << (nb)) - 1)); = \ + return sextract32(opcode, shift, nb); = \ } =20 #define EXTRACT_HELPER_SPLIT(name, shift1, nb1, shift2, nb2) = \ static inline uint32_t name(uint32_t opcode) = \ { = \ - return (((opcode >> (shift1)) & ((1 << (nb1)) - 1)) << nb2) | = \ - ((opcode >> (shift2)) & ((1 << (nb2)) - 1)); = \ + return extract32(opcode, shift1, nb1) << nb2 | = \ + extract32(opcode, shift2, nb2); = \ } =20 #define EXTRACT_HELPER_SPLIT_3(name, = \ --=20 2.20.1