From nobody Tue Feb 10 02:43:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770066515; cv=none; d=zohomail.com; s=zohoarc; b=AYU2FCr4qIp9Bqrh/z7glcD70jpnnla9wQK0RQzWToQOUTqNd2untYmDJJ7jvDRXRJs4AGfZOBsMFiChzGgV1DDxqxcQeASOj8Mw4r5k6VPHV8tw7B5gnTJHheDLECJFhRmM491PEr3BPBgz7seZx1M9Bo6IJhfdiuh2OanfqME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770066515; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TUBS5merpy0OaooqaAt7ei1cIBqyFwJU+awi87nIq2M=; b=gWkwwcnSaPCsNobrvYwJKYAOhcdCRXmdQ64f+n736DcuiA63ji4FnK3iQ7Hw9T6C5p1b7gploKWUDzATrBVhtzGdoLOmv5eS+LwerxQW4Ymo7KfwX5L6Ri+iS7FmkvWQIQSc1vDq0tSYhMJmJnMtuOoTiI3CbMStPeIeyPwaepk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770066515644281.10716653967097; Mon, 2 Feb 2026 13:08:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn14A-0004we-6C; Mon, 02 Feb 2026 16:02:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn13S-0002ai-Kx for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:01:55 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn13Q-0004W4-4h for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:01:54 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-435a517be33so2942236f8f.0 for ; Mon, 02 Feb 2026 13:01:51 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10e4824sm48579216f8f.1.2026.02.02.13.01.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770066110; x=1770670910; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TUBS5merpy0OaooqaAt7ei1cIBqyFwJU+awi87nIq2M=; b=CbJPkx2ard7nXrJsg0SS7DUVJUILOmlXVGHfbsaHJV1777GB4IHqfXtKsHyspAWGby DFXnM4+zRciHVrdZbeMAPVju3vWi3Jg87lGx4wCg0xY7BBgjn1pe5Zom4jmZyTIWmJ64 ZILGSq9woaWyan2FP5lp5iNfaOkGQZk3GlHjAKwYmgPdi0S2u2oWyVgB/V9VbCvvuNVN C8t7lCpAH52k32X2bVvBu+Q54WoMa79f/nj37vMDcSXtw2DFw5oitJZFscnuZiHKrzkr VSdMfaba/G2NSApetJb5UlwwmoIrxtUdTItoktuiTjIlWQpfdhWrOIGXiAqhVjMB8Av+ FUhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770066110; x=1770670910; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TUBS5merpy0OaooqaAt7ei1cIBqyFwJU+awi87nIq2M=; b=Zu4101Qs+vKyTWlV/JeW33xu8LVigHOo/8EG1zPLqgX4cqChchuHXNE1385YJ76Bet R0wOMCDqQOp09t9ao/SwIF3jNk17n9yyadmYG57vUOSqte7wZ8yKf6cz1WRo29g+As8E hyIcl45QjIOCNEHVy4kikSf9hhjSCdnjroOzsFo1ibyQQYlJdVtv0YDaLbzDC5F/9Ny3 9QBx+5ug+wQNNPXuFo/Wvq8CjJ0eKMHWKEFZxZV+Fk3h9itCe2kwNrELMkloR+WVRFc4 WPuDNJJOQz/DiECG5GaHomY0o4Vzmw7JkE908z/+jifgvB/VOTj7+jQ7MnH2iK5GDys4 wC7g== X-Gm-Message-State: AOJu0YzMpJz5gpvL353mD15a+ydfyeupHivXCv31yDsQqXoGw7C0vjP+ TDTWNDGTzngkQXn9/Ivmd47LEWUL+tjUb6RTB5a1jUaJMJdKd+YlvFkqo3BLEF5/6tnR2PGJCBn Euv/Rhh0= X-Gm-Gg: AZuq6aJgkIHmoJWEnus0tkXsmEoeodbE695vAYobOhV0lqfuaj45BEbrM6tAWVLMDd7 gtVra8KLZu824lGBqG88eSvQSYYvkqY9u2lOjdVvb90VWCF8pLp6rys08Fk00EhWh/nMwe4BkPA KAbx/W5JMjPyyI/TLlffUt2MeW2nzckB/EgoCtwUUd3kSOHwc52a2/vU19+oGarEJyCuuE2rkGI b9Hinvxll7junpFTobPiNpBhcNGEHP5T6iq2yoTWgiAebwRIMGqVNPJHGLz2zLoItwpLu7OdX70 KFQ6zqGCIxBVCgCGNLh6fbFnBKhK9/8qrUyavR/RH6oau8dRPpB+Ylyc+K0f/JNJD4gNcEdFph2 RBf6mnKRjY5H8EbEncNlC4eY+5IIsOPeWuqZjQg/bN0c2sxlUgIWJd33k9RPbejnyfOUK8oEYyk MUQtatcgGMHgqkLOI3tFW9sfMOVmu0ysbCnaMN2McUZHKhc609lba/XDCaqzq6 X-Received: by 2002:a05:6000:114e:b0:435:a647:a3b8 with SMTP id ffacd0b85a97d-435f3aa91eamr13134697f8f.36.1770066109982; Mon, 02 Feb 2026 13:01:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Nicholas Piggin , Richard Henderson , Pierrick Bouvier , Chinmay Rath , qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 06/11] target/ppc: Introduce ppc_code_endian_dc() helper Date: Mon, 2 Feb 2026 22:01:00 +0100 Message-ID: <20260202210106.93257-7-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202210106.93257-1-philmd@linaro.org> References: <20260202210106.93257-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770066518001154100 Introduce the ppc_code_endian_dc() helper which returns the MemOp endianness for the CODE path. Use it in need_byteswap(), removing one TARGET_BIG_ENDIAN. Note, the target MemOp endianness can be evaluated as (see commit 5c43a750b67 "accel/tcg: Implement translator_ld*_end"): MO_TE ^ (do_swap * MO_BSWAP) For PPC we use the DisasContext::le_mode field to swap the default (big-endian) order, so to get the PPC MemOp endianness we can directly use: MO_BE ^ (ctx->le_mode * MO_BSWAP) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Anton Johansson --- target/ppc/translate.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 17e6d07c8c2..e1753ce19ce 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -214,14 +214,21 @@ static inline bool is_ppe(const DisasContext *ctx) return !!(ctx->flags & POWERPC_FLAG_PPE42); } =20 +/** + * ppc_code_endian_dc: + * @dc: the disassembly context + * + * Return the MemOp endianness of the CODE path. + */ +static inline MemOp ppc_code_endian_dc(const DisasContext *ctx) +{ + return MO_BE ^ (ctx->le_mode * MO_BSWAP); +} + /* Return true iff byteswap is needed in a scalar memop */ static inline bool need_byteswap(const DisasContext *ctx) { -#if TARGET_BIG_ENDIAN - return ctx->le_mode; -#else - return !ctx->le_mode; -#endif + return ppc_code_endian_dc(ctx) !=3D MO_TE; } =20 /* True when active word size < size of target_long. */ --=20 2.52.0