From nobody Fri Nov 7 23:12:23 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; 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548789827417906.833065378937; Tue, 29 Jan 2019 11:23:47 -0800 (PST) Received: from localhost ([127.0.0.1]:54376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goYyz-0001Ql-9S for importer@patchew.org; Tue, 29 Jan 2019 14:23:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goYtd-0005uu-Uf for qemu-devel@nongnu.org; Tue, 29 Jan 2019 14:18:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goYtc-00084N-W5 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 14:18:09 -0500 Received: from chuckie.co.uk ([82.165.15.123]:41877 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goYtc-000841-P5; Tue, 29 Jan 2019 14:18:08 -0500 Received: from host86-138-240-60.range86-138.btcentralplus.com ([86.138.240.60] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1goYtq-0006Zl-2R; Tue, 29 Jan 2019 19:18:23 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, richard.henderson@linaro.org, david@gibson.dropbear.id.au Date: Tue, 29 Jan 2019 19:17:40 +0000 Message-Id: <20190129191746.14868-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190129191746.14868-1-mark.cave-ayland@ilande.co.uk> References: <20190129191746.14868-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.138.240.60 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH v4 2/8] target/ppc: rework vmrg{l, h}{b, h, w} instructions to use Vsr* macros 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The current implementations make use of the endian-specific macros MRGLO/MR= GHI and also reference HI_IDX and LO_IDX directly to calculate array offsets. Rework the implementation to use the Vsr* macros so that these per-endian references can be removed. Signed-off-by: Mark Cave-Ayland --- target/ppc/int_helper.c | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 598731d47a..59324b2d13 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -976,43 +976,27 @@ void helper_vmladduhm(ppc_avr_t *r, ppc_avr_t *a, ppc= _avr_t *b, ppc_avr_t *c) } } =20 -#define VMRG_DO(name, element, highp) \ +#define VMRG_DO(name, element, access, ofs) \ void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ { \ ppc_avr_t result; \ int i; \ - size_t n_elems =3D ARRAY_SIZE(r->element); \ \ - for (i =3D 0; i < n_elems / 2; i++) { \ - if (highp) { \ - result.element[i*2+HI_IDX] =3D a->element[i]; \ - result.element[i*2+LO_IDX] =3D b->element[i]; \ - } else { \ - result.element[n_elems - i * 2 - (1 + HI_IDX)] =3D \ - b->element[n_elems - i - 1]; \ - result.element[n_elems - i * 2 - (1 + LO_IDX)] =3D \ - a->element[n_elems - i - 1]; \ - } \ + for (i =3D 0; i < ARRAY_SIZE(r->element) / 2; i++) { \ + result.access(i * 2 + 0) =3D a->access(i + ofs); \ + result.access(i * 2 + 1) =3D b->access(i + ofs); \ } \ *r =3D result; \ } -#if defined(HOST_WORDS_BIGENDIAN) -#define MRGHI 0 -#define MRGLO 1 -#else -#define MRGHI 1 -#define MRGLO 0 -#endif -#define VMRG(suffix, element) \ - VMRG_DO(mrgl##suffix, element, MRGHI) \ - VMRG_DO(mrgh##suffix, element, MRGLO) -VMRG(b, u8) -VMRG(h, u16) -VMRG(w, u32) + +#define VMRG(suffix, element, access, half) \ + VMRG_DO(mrgl##suffix, element, access, half) \ + VMRG_DO(mrgh##suffix, element, access, 0) +VMRG(b, u8, VsrB, 8) +VMRG(h, u16, VsrH, 4) +VMRG(w, u32, VsrW, 2) #undef VMRG_DO #undef VMRG -#undef MRGHI -#undef MRGLO =20 void helper_vmsummbm(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) --=20 2.11.0