From nobody Tue Oct 14 10:40:26 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1588828370; cv=none; d=zohomail.com; s=zohoarc; b=D47Wph5Ln8ml9rq6hmL0Ccs1VnJrxlE5mtugqiG0hKpszZcCZRQ32PZAoxZkx3arYufcY2xBlX3pK8p1HIFFdHnvhZJo5S8B33hCQeebK4jKOpKpS5cmHDAeRjvLqrFFtsLY/wnCQoi3r8oSPwS4sXTYi3X+A+iiMGti6r3w5hk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588828370; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zxEiEjxqKHNVgdaZVx5IUWlw8Z3dbTJoRLppcRT1bok=; b=INN8O0BHBXM/lgnroa3D38A9Wgc3zRsuo1oHb3PcwihxREouYZ4LhhtluKLOV8JdQGklqjIhc9/RVTiuWZOPCNPIlDgprtwvvjhOajnQig/LYK0vcGje12tGd5+onavUjxqBOMLUJ7MwxNya2P3E7zvlqbyHUCgpX8+lije4HY4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1588828370891636.1665631513094; Wed, 6 May 2020 22:12:50 -0700 (PDT) Received: from localhost ([::1]:48846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWYq1-0007ZP-MA for importer@patchew.org; Thu, 07 May 2020 01:12:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWYiM-0008LA-2R; Thu, 07 May 2020 01:04:54 -0400 Received: from ozlabs.org ([203.11.71.1]:42685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWYiK-0007wd-HM; Thu, 07 May 2020 01:04:53 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49HhFr0vWdz9sTZ; Thu, 7 May 2020 15:04:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1588827856; bh=0Defog9BMQ96zbUpzXIYlfo59cZ5ZBvaXqV8R8t0Wck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LdaYpvqN/2hfttT9c/lrVEYTCruQIlglIALce3z8FiNYWVwhjNFFXWGD/1Pbq5R60 VHNNtZa4u6qktRJsSZW5gjs7uKMjJ7x6641eSGbHp1LvLSULRqez1imu4Q5U59JMoJ g2E4/EdWDm5RdkqgKCM51nCiGMPPEysA++PHD7W0= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 18/18] target-ppc: fix rlwimi, rlwinm, rlwnm for Clang-9 Date: Thu, 7 May 2020 15:02:28 +1000 Message-Id: <20200507050228.802395-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200507050228.802395-1-david@gibson.dropbear.id.au> References: <20200507050228.802395-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 01:04:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aik@ozlabs.ru, qemu-devel@nongnu.org, npiggin@gmail.com, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, Daniele Buono , 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: Daniele Buono Starting with Clang v9, -Wtype-limits is implemented and triggers a few "result of comparison is always true" errors when compiling PPC32 targets. The comparisons seem to be necessary only on PPC64, since the else branch in PPC32 only has a "g_assert_not_reached();" in all cases. This patch restructures the code so that the actual if/else is done on a local flag variable, that is set accordingly for PPC64, and always true for PPC32. Signed-off-by: Daniele Buono Message-Id: <20200505183818.32688-2-dbuono@linux.vnet.ibm.com> Signed-off-by: David Gibson --- target/ppc/translate.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 807d14faaa..338529879f 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1882,6 +1882,7 @@ static void gen_rlwimi(DisasContext *ctx) tcg_gen_deposit_tl(t_ra, t_ra, t_rs, sh, me - mb + 1); } else { target_ulong mask; + bool mask_in_32b =3D true; TCGv t1; =20 #if defined(TARGET_PPC64) @@ -1890,8 +1891,13 @@ static void gen_rlwimi(DisasContext *ctx) #endif mask =3D MASK(mb, me); =20 +#if defined(TARGET_PPC64) + if (mask > 0xffffffffu) { + mask_in_32b =3D false; + } +#endif t1 =3D tcg_temp_new(); - if (mask <=3D 0xffffffffu) { + if (mask_in_32b) { TCGv_i32 t0 =3D tcg_temp_new_i32(); tcg_gen_trunc_tl_i32(t0, t_rs); tcg_gen_rotli_i32(t0, t0, sh); @@ -1933,12 +1939,18 @@ static void gen_rlwinm(DisasContext *ctx) tcg_gen_extract_tl(t_ra, t_rs, rsh, len); } else { target_ulong mask; + bool mask_in_32b =3D true; #if defined(TARGET_PPC64) mb +=3D 32; me +=3D 32; #endif mask =3D MASK(mb, me); - if (mask <=3D 0xffffffffu) { +#if defined(TARGET_PPC64) + if (mask > 0xffffffffu) { + mask_in_32b =3D false; + } +#endif + if (mask_in_32b) { if (sh =3D=3D 0) { tcg_gen_andi_tl(t_ra, t_rs, mask); } else { @@ -1973,6 +1985,7 @@ static void gen_rlwnm(DisasContext *ctx) uint32_t mb =3D MB(ctx->opcode); uint32_t me =3D ME(ctx->opcode); target_ulong mask; + bool mask_in_32b =3D true; =20 #if defined(TARGET_PPC64) mb +=3D 32; @@ -1980,7 +1993,12 @@ static void gen_rlwnm(DisasContext *ctx) #endif mask =3D MASK(mb, me); =20 - if (mask <=3D 0xffffffffu) { +#if defined(TARGET_PPC64) + if (mask > 0xffffffffu) { + mask_in_32b =3D false; + } +#endif + if (mask_in_32b) { TCGv_i32 t0 =3D tcg_temp_new_i32(); TCGv_i32 t1 =3D tcg_temp_new_i32(); tcg_gen_trunc_tl_i32(t0, t_rb); --=20 2.26.2