From nobody Sun May 19 16:27:56 2024 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=1691463877; cv=none; d=zohomail.com; s=zohoarc; b=Lopgzjee4KcDEw7pcCLlrjaAUNcLkekkLJ+ddT4QcT8ATarc1EcKBCa/pdrkE13tVJANsaFSXoqefPi0lErYI4uqfgnfo3U4JWVCwx6ua8ZZANDBxNjBjim7RbYKFWjaH3j3FJrsEcg5j/Wd1zVQ/gxSrAagvMNodDQvmyRH6uE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691463877; 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=PZZSZu8M5U/PcU0xDddsAwmIrS1Z0aEmfJuCGCmTsdA=; b=Sxqhs/OqkBLxgfcmAnVCon1NHwiziytj5z67crGcj6DaQtpIJkvDCkcl0U9rofJlEIOyGIF4lQxBVhAf1iq9L1DqzqjqLukMXEeNRx2BItrSbhkuCRo0bkGoRneu+Ns87tyd3T1ENqxfeeet1OfJIyHvniWAcG2dLCVExtnGXOg= 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 1691463877161808.4723918079013; Mon, 7 Aug 2023 20:04:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCzp-0001MG-C7; Mon, 07 Aug 2023 23:02:57 -0400 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 1qTCzo-0001L8-DA for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzm-0006ZF-2a for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-686ed1d2594so5014291b3a.2 for ; Mon, 07 Aug 2023 20:02:53 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463773; x=1692068573; 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=PZZSZu8M5U/PcU0xDddsAwmIrS1Z0aEmfJuCGCmTsdA=; b=e/iAIBHMt2hlcB+cbx3S0zWJb/t1SpU0uIhpuHer38hgyGb4Tw5n7jWQRI8O2Ubkj0 G7D3G512RTkvaBuDRfCD1o1scDAJrX3RHGqMzo3Z236rbNcSLA1PprowBWVwAZn9Eut1 lI4U6ocPfC7UNHizaRL0rutKvv/hutlTfuUx3tB9PVGCs0sreKIYyM7OYDoThn0puzPO bLVMxZU8k+h9Ux1A0EdnS0lesZ0NhIDS4O1SEhWeCTE+LJzmMYQN5gBEMIs6Xc/AeRTW jDsRG+Vife4zoi1KIDVqPM7EYBT/SzHNiFlS8aVxAoFfg7zH4pUgGER6jlWOz8QGYIIY lWqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463773; x=1692068573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PZZSZu8M5U/PcU0xDddsAwmIrS1Z0aEmfJuCGCmTsdA=; b=ErfLbbT70OxcvLG/1AUC6SyKt5jI2cDTKEqmXT6udp3EltGSeZfW4g2OG762OKhqRT dSuTvm0cUSoJ8PGE/qsCGsqwU7F4hOGooLpKp7sbLj8n+MwAdLGU6geE2RauXsT5kE4U tR5cGiu+8mf+xoen7VlFPVVyHauTijgg3Jb2s7+NZksTUzwhiFzSmQfREHUfC83kxgkc ANb6PZX1ueEAspWdW/NGrZC2lYqPbe1uQEjFYaVrxI/YCQ8ogCo8P6E/Wqra3Y/gIRBS k+4UFW2FeanbbK/sKIiAjW/2fcT59gmWqYIX36KDuoCWKnVkzNHemvBb3wcZcc/mW8V6 6rNg== X-Gm-Message-State: AOJu0YyOr3IWGIeWVLwn4h7HwQoM+8mhJwzVOCD71NDzbwx1ZLbmn7L5 3T8jvLq/pfbggJ3NvyAORhE/2as3IWtdjiHetDY= X-Google-Smtp-Source: AGHT+IFjN8pZuzvj/6ciS65xyG3Ab1XUGi7Hlo3zPRGeD1HctgPudjYnKjl8M+fuKw7shHP9R7Yykg== X-Received: by 2002:a05:6a20:3d94:b0:140:a6ec:b55f with SMTP id s20-20020a056a203d9400b00140a6ecb55fmr8968954pzi.16.1691463772836; Mon, 07 Aug 2023 20:02:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 1/7] tcg/ppc: Untabify tcg-target.c.inc Date: Mon, 7 Aug 2023 20:02:44 -0700 Message-Id: <20230808030250.50602-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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: 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: 1691463878839100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Acked-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 511e14b180..642d0fd128 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -221,7 +221,7 @@ static inline bool in_range_b(tcg_target_long target) } =20 static uint32_t reloc_pc24_val(const tcg_insn_unit *pc, - const tcg_insn_unit *target) + const tcg_insn_unit *target) { ptrdiff_t disp =3D tcg_ptr_byte_diff(target, pc); tcg_debug_assert(in_range_b(disp)); @@ -241,7 +241,7 @@ static bool reloc_pc24(tcg_insn_unit *src_rw, const tcg= _insn_unit *target) } =20 static uint16_t reloc_pc14_val(const tcg_insn_unit *pc, - const tcg_insn_unit *target) + const tcg_insn_unit *target) { ptrdiff_t disp =3D tcg_ptr_byte_diff(target, pc); tcg_debug_assert(disp =3D=3D (int16_t) disp); @@ -3587,7 +3587,7 @@ static void expand_vec_mul(TCGType type, unsigned vec= e, TCGv_vec v0, tcgv_vec_arg(t1), tcgv_vec_arg(t2)); vec_gen_3(INDEX_op_ppc_pkum_vec, type, vece, tcgv_vec_arg(v0), tcgv_vec_arg(v0), tcgv_vec_arg(t1)); - break; + break; =20 case MO_32: tcg_debug_assert(!have_isa_2_07); --=20 2.34.1 From nobody Sun May 19 16:27:56 2024 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=1691463899; cv=none; d=zohomail.com; s=zohoarc; b=BPloujGDOdrXryiyIwCfKTmd3Rts4wrKP4+0oyQaWYLw6dyYDnq3Wf2c6x5loJlu2gbB9/EKTzQHrtjmNv+S6aV8PJ/XrkkPCU2pEtnblTcmp1mmBptBZy+mErz4Qfsf6RumvlyVA+0XZdYUtruRulnsoyQ8cSF0NKiZTqdkym8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691463899; 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=hbxSTVv8l+gK8qmeoMZlY1+rXFa4fHFVXKxIo6ZA74I=; b=hAStCBvieQ+G3+wrPk9zniQiWoeyD+h1UIVrB+ZTb+w6akylH1pCzu6TXw2CjLJU4w0Klvn6ZZLZvhXWFNZJtdrwplb7IOZaGQ1kxwi8oGnknzZ3r37d+R3qKKbSSZBKS1ZZ75bcMKQYvNnm2JQ8fMueKmxS+qrypzucRC3UcFo= 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 1691463899402482.20225433814517; Mon, 7 Aug 2023 20:04:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCzr-0001NX-5M; Mon, 07 Aug 2023 23:02:59 -0400 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 1qTCzo-0001LL-Jj for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzn-0006ZT-2h for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-686d8c8fc65so3555775b3a.0 for ; Mon, 07 Aug 2023 20:02:54 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463773; x=1692068573; 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=hbxSTVv8l+gK8qmeoMZlY1+rXFa4fHFVXKxIo6ZA74I=; b=nsETV6ytu9ktK/rPexpZSlZwA9rWUWMKq8YcnH8si+UJIZqh48peQ/WtLS89k1PIfU RebwJCR2ykljNZiin8H483drqzOOQ01ntHO9le/7K5auRjS6CFtBhjlLqAAT3EdyX/N8 uJ/Yh5P5dopwT2nr9ZdATEDLEBBZ6as8kpxpvFU+IupzmBwEbTcllhvndW18ICgyOLSI n91+8bPBdSbRuEB72qhgeNOkrnWu458sL2HYPnFHgSMlvAvPuGgyY/XkJehRWERV0MyD gBJWQY30JvBG5Z6T9p/CJAc7mRiUFstrml3/LW0JrOqMS125Y6wHnN/fcWwkQyw2qzia Ay2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463773; x=1692068573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hbxSTVv8l+gK8qmeoMZlY1+rXFa4fHFVXKxIo6ZA74I=; b=VgFfoKEDF98U7tSSJhnpUTPH/ZotXqtcFJBbds7U7+V6QWK5G22HeFYM22xQVC8N8F RwrZXbgYRFcQdf2lCN2ttmb2q6zyt7w3CDh0oHHwacXWMSb1Ql3VK6izZLIHYBqtZ3eJ JP+Au+odt6HwRKs6Ti8Tw4p28JUAqou78u/p2V6HnXFcFRA1MKZVOpoerQCK0yih07uR zb2RInZ1+4qvHZJS2dTcKxfcezqJaNKZrWscKwwSfh5hEeBlNHfMu88vMWMBADiCjONU 96xmS/R7gLsEO0u+C1/2m2SDclhNYjiGcCOKsNRT9tw3JEf1+BwcOpZkpSbbKXbGA5aY YKGw== X-Gm-Message-State: AOJu0YwSsOfN5MEehDKry7uk6/n0awlgB6SQCJ+9ZNbIOKNZ0zunJ0IY T3hXHOSNI9vMGzEnPZJlyPzkfZvvwYaVOwmUBUE= X-Google-Smtp-Source: AGHT+IF+/8GH9jPIzgPP7sKLIb5GL+foKTi/6Ynso99DQ0nZTIxthyvpUdflN1YEBFOjsTmVzZSjaQ== X-Received: by 2002:a05:6a20:8e28:b0:13c:b1a7:7b1 with SMTP id y40-20020a056a208e2800b0013cb1a707b1mr11328219pzj.25.1691463773626; Mon, 07 Aug 2023 20:02:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 2/7] tcg/ppc: Use PADDI in tcg_out_movi Date: Mon, 7 Aug 2023 20:02:45 -0700 Message-Id: <20230808030250.50602-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1691463900496100001 Content-Type: text/plain; charset="utf-8" PADDI can load 34-bit immediates and 34-bit pc-relative addresses. Reviewed-by: Jordan Niethe Signed-off-by: Richard Henderson Reviewed-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 642d0fd128..2141c0bc78 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -707,6 +707,38 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int t= ype, return true; } =20 +/* Ensure that the prefixed instruction does not cross a 64-byte boundary.= */ +static bool tcg_out_need_prefix_align(TCGContext *s) +{ + return ((uintptr_t)s->code_ptr & 0x3f) =3D=3D 0x3c; +} + +static void tcg_out_prefix_align(TCGContext *s) +{ + if (tcg_out_need_prefix_align(s)) { + tcg_out32(s, NOP); + } +} + +static ptrdiff_t tcg_pcrel_diff_for_prefix(TCGContext *s, const void *targ= et) +{ + return tcg_pcrel_diff(s, target) - (tcg_out_need_prefix_align(s) ? 4 := 0); +} + +/* Output Type 10 Prefix - Modified Load/Store Form (MLS:D) */ +static void tcg_out_mls_d(TCGContext *s, tcg_insn_unit opc, unsigned rt, + unsigned ra, tcg_target_long imm, bool r) +{ + tcg_insn_unit p, i; + + p =3D OPCD(1) | (2 << 24) | (r << 20) | ((imm >> 16) & 0x3ffff); + i =3D opc | TAI(rt, ra, imm); + + tcg_out_prefix_align(s); + tcg_out32(s, p); + tcg_out32(s, i); +} + static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, TCGReg base, tcg_target_long offset); =20 @@ -992,6 +1024,25 @@ static void tcg_out_movi_int(TCGContext *s, TCGType t= ype, TCGReg ret, return; } =20 + /* + * Load values up to 34 bits, and pc-relative addresses, + * with one prefixed insn. + */ + if (have_isa_3_10) { + if (arg =3D=3D sextract64(arg, 0, 34)) { + /* pli ret,value =3D paddi ret,0,value,0 */ + tcg_out_mls_d(s, ADDI, ret, 0, arg, 0); + return; + } + + tmp =3D tcg_pcrel_diff_for_prefix(s, (void *)arg); + if (tmp =3D=3D sextract64(tmp, 0, 34)) { + /* pla ret,value =3D paddi ret,0,value,1 */ + tcg_out_mls_d(s, ADDI, ret, 0, tmp, 1); + return; + } + } + /* Load 32-bit immediates with two insns. Note that we've already eliminated bare ADDIS, so we know both insns are required. */ if (TCG_TARGET_REG_BITS =3D=3D 32 || arg =3D=3D (int32_t)arg) { --=20 2.34.1 From nobody Sun May 19 16:27:56 2024 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=1691463836; cv=none; d=zohomail.com; s=zohoarc; b=Tmon3AUjCzsNkltmXwIO4HU8zXZcFda67W0OsMBkMmOz2rvuYIwzRNq962rAUc1IiimMo5WzDGiX1UAJR0f10ZaGYu4/pQ4QiRZzKGQ9AFBI+S6OjvWXK9trzzEov6e/o7bMxRfJ8QRgnysZb5HR4d6ej2fQiYZWSum4DeQg1Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691463836; 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=pHOVm1j3rxxzTzvqcEEGiLi8+wjs2ljwtbn2VN1LzVo=; b=N/KNZNsIfdctR5XG4O+CMRRaPeX574HL2zzSbfqi7eXHvH5S2qwRiFSsTeVVyx+o0OEJ+t+iDWQaAV0SfHLJLgM2Wqj0CJJiFu7iWgPStf2PEGEpleGnN7gJClEHia28ckiWFyW36qEzdHUU41w2RMimc1oOkiY9FZ8Q0Mt7rMw= 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 1691463836512171.39202643127578; Mon, 7 Aug 2023 20:03:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCzq-0001N3-CW; Mon, 07 Aug 2023 23:02:58 -0400 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 1qTCzp-0001Mi-Mw for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:57 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0: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 1qTCzn-0006ZZ-Nh for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:57 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-68783004143so3679403b3a.2 for ; Mon, 07 Aug 2023 20:02:55 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463774; x=1692068574; 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=pHOVm1j3rxxzTzvqcEEGiLi8+wjs2ljwtbn2VN1LzVo=; b=JTPG/2QSiPWd0gRNTL7Ng63wxMf7leHtb3axzW+MW2d4umyLPMuYlMYfZHi2SdDXuX V68s2HYJcs14Csr+Hm7k7lgNPC835EWNR+Khh9XogQOZaJk+Q/Pvg3SOROo11GmLZS/1 J2a2ITDpDZ1oezpTfzS1rlem4wvaMw37zKKnQqYJrQRY8mD+k4piPfGhEC7UJjN4UYff GLqeGp2gZOKR1VQ6RdssYMAElNKf0WxoC+CNuYIgTUiJTekofA8KaZJMHJwEWf26/n6Y kU3+3xNEIc357VRJKXfkFuQv56GzXllSZotQhhQVqppFm/tOpF67JIHB5osLhrIIcW57 h9vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463774; x=1692068574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pHOVm1j3rxxzTzvqcEEGiLi8+wjs2ljwtbn2VN1LzVo=; b=MLG/0Q8k7S0gscl1CpfntApf55h3+hPQva4GwPQnRwDvX2ceoyVGGReZILfF+LVduY uD3G5S8m8tStNQpbrHyX2q8dsp4wf2ZO5RD3Q5Gp/aijp/La1L+CsftwI9ThODXB7X0z YrVJbuLIo0hwySRbecj8TAjxtQZi3dWjbspddtBOFxohvRAbKlBIisa2PRCfaYmU7yHU qTL0D8JJAb4T1joVofowkZQR4f1+n+NIN4RkDlMQIkC+E1YvnHMTl9eS0voKIqnCxiiY wNqvIGk/V03yLGDlYRD9Ccr/CMPZSuq3i+wRVRkXjj8vr73z1sKJGAV45yRwrGPVWVT4 OLIw== X-Gm-Message-State: AOJu0YzwSqkF1l+CoypKBWZLfzrPeI3Rec01AaBc1NPQkIT8JtKuUP0a HjiD2yOymfZ/R0D18YQBhQN8IQ+rOYuiosWOOUE= X-Google-Smtp-Source: AGHT+IG8jmjxo98MiQwuyqZVGFro208GCSFQLSSsTMkf34wsE4NPJJOqMqTcp5dTrYodcADSgAmCwA== X-Received: by 2002:a05:6a00:2294:b0:67a:c810:3cb0 with SMTP id f20-20020a056a00229400b0067ac8103cb0mr10675440pfe.3.1691463774319; Mon, 07 Aug 2023 20:02:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 3/7] tcg/ppc: Use prefixed instructions in tcg_out_mem_long Date: Mon, 7 Aug 2023 20:02:46 -0700 Message-Id: <20230808030250.50602-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1691463838719100003 Content-Type: text/plain; charset="utf-8" When the offset is out of range of the non-prefixed insn, but fits the 34-bit immediate of the prefixed insn, use that. Reviewed-by: Jordan Niethe Signed-off-by: Richard Henderson Reviewed-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 2141c0bc78..61ae9d8ab7 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -323,6 +323,15 @@ static bool tcg_target_const_match(int64_t val, TCGTyp= e type, int ct) #define STDX XO31(149) #define STQ XO62( 2) =20 +#define PLWA OPCD( 41) +#define PLD OPCD( 57) +#define PLXSD OPCD( 42) +#define PLXV OPCD(25 * 2 + 1) /* force tx=3D1 */ + +#define PSTD OPCD( 61) +#define PSTXSD OPCD( 46) +#define PSTXV OPCD(27 * 2 + 1) /* force sx=3D1 */ + #define ADDIC OPCD( 12) #define ADDI OPCD( 14) #define ADDIS OPCD( 15) @@ -725,6 +734,20 @@ static ptrdiff_t tcg_pcrel_diff_for_prefix(TCGContext = *s, const void *target) return tcg_pcrel_diff(s, target) - (tcg_out_need_prefix_align(s) ? 4 := 0); } =20 +/* Output Type 00 Prefix - 8-Byte Load/Store Form (8LS:D) */ +static void tcg_out_8ls_d(TCGContext *s, tcg_insn_unit opc, unsigned rt, + unsigned ra, tcg_target_long imm, bool r) +{ + tcg_insn_unit p, i; + + p =3D OPCD(1) | (r << 20) | ((imm >> 16) & 0x3ffff); + i =3D opc | TAI(rt, ra, imm); + + tcg_out_prefix_align(s); + tcg_out32(s, p); + tcg_out32(s, i); +} + /* Output Type 10 Prefix - Modified Load/Store Form (MLS:D) */ static void tcg_out_mls_d(TCGContext *s, tcg_insn_unit opc, unsigned rt, unsigned ra, tcg_target_long imm, bool r) @@ -1368,6 +1391,49 @@ static void tcg_out_mem_long(TCGContext *s, int opi,= int opx, TCGReg rt, break; } =20 + /* For unaligned or large offsets, use the prefixed form. */ + if (have_isa_3_10 + && (offset !=3D (int16_t)offset || (offset & align)) + && offset =3D=3D sextract64(offset, 0, 34)) { + /* + * Note that the MLS:D insns retain their un-prefixed opcode, + * while the 8LS:D insns use a different opcode space. + */ + switch (opi) { + case LBZ: + case LHZ: + case LHA: + case LWZ: + case STB: + case STH: + case STW: + case ADDI: + tcg_out_mls_d(s, opi, rt, base, offset, 0); + return; + case LWA: + tcg_out_8ls_d(s, PLWA, rt, base, offset, 0); + return; + case LD: + tcg_out_8ls_d(s, PLD, rt, base, offset, 0); + return; + case STD: + tcg_out_8ls_d(s, PSTD, rt, base, offset, 0); + return; + case LXSD: + tcg_out_8ls_d(s, PLXSD, rt & 31, base, offset, 0); + return; + case STXSD: + tcg_out_8ls_d(s, PSTXSD, rt & 31, base, offset, 0); + return; + case LXV: + tcg_out_8ls_d(s, PLXV, rt & 31, base, offset, 0); + return; + case STXV: + tcg_out_8ls_d(s, PSTXV, rt & 31, base, offset, 0); + return; + } + } + /* For unaligned, or very large offsets, use the indexed form. */ if (offset & align || offset !=3D (int32_t)offset || opi =3D=3D 0) { if (rs =3D=3D base) { --=20 2.34.1 From nobody Sun May 19 16:27:56 2024 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=1691463848; cv=none; d=zohomail.com; s=zohoarc; b=LYQzzluhp5OVP035gxwNEVnCJNfJdhhEoB7u7/XTCApaWRiCPccZaHLf0MMpYxoMoJ1qle3WgbVpXFg0YsVs3gsrAs9pWs7ShMM9dRO8wqETKdrYD+zvkcd2X8RupFHNqe/NfY/2LbMnVP+pE9/qmn2UNKhOYiwOzV7lDauh8YE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691463848; 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=XokUtbe+DsLYWyevZrlewM8nCsy1TFXDfLF6baDQHOE=; b=f7/2kKBfxHVFaV2AK/cT1SIQiu3WLQydEGnZ93TpOWfXMxddrV/uwJLWIejiGbVOhVm5FbKovk383cgxujZvva4lMlZ7pMKGyJhSQxiY1Twmxv8hTDvyUVU7PMmdSv1kbnYufKCjIORFC659hXviLYdn29bGMGJpOyrmyb1zv/0= 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 1691463848624988.2179688656204; Mon, 7 Aug 2023 20:04:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCzq-0001NV-Um; Mon, 07 Aug 2023 23:02:58 -0400 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 1qTCzq-0001N1-8u for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:58 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzo-0006a4-O4 for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:58 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-686f8614ce5so5175119b3a.3 for ; Mon, 07 Aug 2023 20:02:56 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463775; x=1692068575; 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=XokUtbe+DsLYWyevZrlewM8nCsy1TFXDfLF6baDQHOE=; b=wPwKuh4WUGKaOcRqdeltxuwtQCALNgXPFt1NZHzkK2wYgCqOXYWdVqySlg5t+IAwyB av4RqWiaD6QTfQ1kuD7WS+6sOvXD15Qpf/diLzdfczPDtoJLre1K7mFwTWpDqUxJ/spg Ufclm8ZhPAmZLBfGFDamVeDy6lc1ggbBRU+XfDqMwtSIVH1yAJZVnTEDWuPuhy0mmxVi FvEX/xjnxDleeVg/1xZ0AE/hat0wefIkCGqHb/1nsU8LuYAGV4yk/I15UgdpK27+vVrj /mDCsZNR5Rd2wd7uRric4tU/A85NSWQGMJ6NX+XYp0kvPwPkcGZE3+yBuOMre6lGZ2qX ksOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463775; x=1692068575; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XokUtbe+DsLYWyevZrlewM8nCsy1TFXDfLF6baDQHOE=; b=Ih1XsjGiCwsXeLqApKubceIObfeuIJsfaANx9lHPg4L1y07rhZ0ziBV/clg7T46vL/ LjcNdBChG8DCw/P+vmc3oz17LhP00XCFfmX0dUemJ5xYlf4jMMIj7h9qM7sP1wYgZWLx p5L/PFy9IRyuPXb3Y9Oo5bASeXc9rrZbYOiHtkPqSaCsBoZ1u/DBGUhFQdYadsClHn3V 9JSvCr9ZiiZCpKlM42pVyHF2yvCBmkP82GrDJvV01Wv4+Hziriy60ZvtvzU4QsyHMb06 Zpr5VVfD2w6YdLCyVomdNOpJntZTyGn4GZnCVuqSnF7R8qmVB9d32ykNFjKMgbESmA/1 Nfew== X-Gm-Message-State: AOJu0YzLzW1bVhTprPEYl+nr5dDBko/3sEOtA/A4MddzYKOHKye+4fAT J8gRswHazkg2sOvAxip+DhHKGSMiiCWWvpPA93c= X-Google-Smtp-Source: AGHT+IGrPY8nAtbDZ0tm2bwvFTyWJmSpPlD8OS0LVHXx4T7lpC0K3xyWkBNMGJSPg3hV2X1Ox4laoQ== X-Received: by 2002:a05:6a00:1305:b0:666:e621:d83e with SMTP id j5-20020a056a00130500b00666e621d83emr13765296pfu.13.1691463775303; Mon, 07 Aug 2023 20:02:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 4/7] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Mon, 7 Aug 2023 20:02:47 -0700 Message-Id: <20230808030250.50602-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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: 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: 1691463850213100001 Content-Type: text/plain; charset="utf-8" The prefixed instruction has a pc-relative form to use here. Signed-off-by: Richard Henderson Reviewed-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 61ae9d8ab7..b3b2e9874d 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -101,6 +101,10 @@ #define ALL_GENERAL_REGS 0xffffffffu #define ALL_VECTOR_REGS 0xffffffff00000000ull =20 +#ifndef R_PPC64_PCREL34 +#define R_PPC64_PCREL34 132 +#endif + #define have_isel (cpuinfo & CPUINFO_ISEL) =20 #ifndef CONFIG_SOFTMMU @@ -260,6 +264,19 @@ static bool reloc_pc14(tcg_insn_unit *src_rw, const tc= g_insn_unit *target) return false; } =20 +static bool reloc_pc34(tcg_insn_unit *src_rw, const tcg_insn_unit *target) +{ + const tcg_insn_unit *src_rx =3D tcg_splitwx_to_rx(src_rw); + ptrdiff_t disp =3D tcg_ptr_byte_diff(target, src_rx); + + if (disp =3D=3D sextract64(disp, 0, 34)) { + src_rw[0] =3D (src_rw[0] & ~0x3ffff) | ((disp >> 16) & 0x3ffff); + src_rw[1] =3D (src_rw[1] & ~0xffff) | (disp & 0xffff); + return true; + } + return false; +} + /* test if a constant matches the constraint */ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { @@ -684,6 +701,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, return reloc_pc14(code_ptr, target); case R_PPC_REL24: return reloc_pc24(code_ptr, target); + case R_PPC64_PCREL34: + return reloc_pc34(code_ptr, target); case R_PPC_ADDR16: /* * We are (slightly) abusing this relocation type. In particular, @@ -1111,6 +1130,11 @@ static void tcg_out_movi_int(TCGContext *s, TCGType = type, TCGReg ret, } =20 /* Use the constant pool, if possible. */ + if (have_isa_3_10) { + tcg_out_8ls_d(s, PLD, ret, 0, 0, 1); + new_pool_label(s, arg, R_PPC64_PCREL34, s->code_ptr - 2, 0); + return; + } if (!in_prologue && USE_REG_TB) { new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr, tcg_tbrel_diff(s, NULL)); --=20 2.34.1 From nobody Sun May 19 16:27:56 2024 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=1691463894; cv=none; d=zohomail.com; s=zohoarc; b=VVF1HdjYKCW1872yoELwX3qGT8T7R9svVsjQcm3OFnhDTf1UuFRC06QukxRNyakby8QUSQmR+u1QFR5/4dbA4XY3tcd0ns1uNlUvUwdj/VKI00qOuGgrOJFXMpSsOojPIjlgJFg+fa1nYgjA04ISNyn6iZsjCGSj+tpeM2xpelk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691463894; 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=dfIP5tcDs8OviC0N81Mxzhk3p0beETYinc+feTbvQW0=; b=TXYA8GB408i2dykF4dhlVEHMIu2TAGbSdpYuNcqsTAIY0N1RG71oAkQ/DvqRgXYXIJU+HLjTQbxT7U8DqFzehdN/2JBesOAZ32HWWtUVDydJNdRiWYfLo4BaW3oQjDM7SFdUFRaZEPkCLPIjprlKv2q6kOJgStgL5NDxrYEFw2Y= 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 16914638942241018.4102223312408; Mon, 7 Aug 2023 20:04:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCzs-0001PX-QB; Mon, 07 Aug 2023 23:03:00 -0400 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 1qTCzr-0001NZ-4S for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:59 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzp-0006ac-KV for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:58 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-68730bafa6bso4098654b3a.1 for ; Mon, 07 Aug 2023 20:02:57 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463776; x=1692068576; 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=dfIP5tcDs8OviC0N81Mxzhk3p0beETYinc+feTbvQW0=; b=NBZq6U3WPaeS59sHrT8JZG+IX4ZN628sKtQweWvB/KVDPd8aECblcN6YfosewUxTdN hktUfcf29KyiURkrXTmffqB6LUMGNrvHZO6v2xKAdQOAnkBU2ESUZK3FW1mYd7WjK1Sx KtsrErlgHkQEvZvK2dUAC/plJiKXQQ9Iz4bp5oV9Ay92Fzza07//ob6B+J3fiPul3KMN qQN5fnPabEuqF2jE8NriIAZfTdRYCJBZJ/nFk/7zUiLRRZR+kLsqZ++8Gp/p/Yby+ASS 2KzivUdsHCNUk3s3xZqduxbzs+MSLZW087u7qoDANpGLtn0jP4d2TwEaJwcZqOuwc3dw qE0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463776; x=1692068576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dfIP5tcDs8OviC0N81Mxzhk3p0beETYinc+feTbvQW0=; b=ae8MY/kmvlH6DwZvo5FNuIF8yzx8rZAeDr5E0SxNbUOHloKALZpbVT2gzn/hQG7Sbp cPBeX/fGLUPre+8i7DqKNnReLcFGB6Pog0cicNGEUzbbBzljg8A5BroZKvWR11TIaFpE /H7tx/GhmhKPifsn+BfnuXtHae7984HEXDLJw0KrR3axFFaCzs34ZMtF30TFu99mMUKy 3ZFFPlbolePRpUyeAk8y65EBRxVSiQjHYp1o67ERMXB73GMhEM7ixMZFXm3mQYXxM01w f20OJQ6fMbmgmCO7qM4TGSLcyPxvON341VdZ21eFooVi/xjuaSX23EEU5fA1H/ViAL6i TJhw== X-Gm-Message-State: AOJu0Yz9g04MVbtEtCJ0BnrOYxZBcbHO0EDW+wRh6nP+Y4utYaCwGtW7 +BcGpWXUYnlc61hEPaBUQaKTg+guznLeKd9Wd5c= X-Google-Smtp-Source: AGHT+IGr0B9gM4DnKWE6hxq+HHOzJDUlsrru5BmGg6v0dDpPveymzEreRP+6ClZFoaJKSM+viW9PSA== X-Received: by 2002:a05:6a20:440a:b0:133:38cb:2b93 with SMTP id ce10-20020a056a20440a00b0013338cb2b93mr11346174pzb.9.1691463776330; Mon, 07 Aug 2023 20:02:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 5/7] tcg/ppc: Use prefixed instructions in tcg_out_dupi_vec Date: Mon, 7 Aug 2023 20:02:48 -0700 Message-Id: <20230808030250.50602-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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: 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: 1691463896436100001 Content-Type: text/plain; charset="utf-8" The prefixed instructions have a pc-relative form to use here. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index b3b2e9874d..01ca5c9f39 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1195,6 +1195,18 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType = type, unsigned vece, /* * Otherwise we must load the value from the constant pool. */ + + if (have_isa_3_10) { + if (type =3D=3D TCG_TYPE_V64) { + tcg_out_8ls_d(s, PLXSD, ret & 31, 0, 0, 1); + new_pool_label(s, val, R_PPC64_PCREL34, s->code_ptr - 2, 0); + } else { + tcg_out_8ls_d(s, PLXV, ret & 31, 0, 0, 1); + new_pool_l2(s, R_PPC64_PCREL34, s->code_ptr - 2, 0, val, val); + } + return; + } + if (USE_REG_TB) { rel =3D R_PPC_ADDR16; add =3D tcg_tbrel_diff(s, NULL); --=20 2.34.1 From nobody Sun May 19 16:27:56 2024 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=1691463898; cv=none; d=zohomail.com; s=zohoarc; b=jFMUKDdTm83YH6msPtGYfmKN5TsmkKPWbUb/sMNJ/C4b7OBwhhASaS8mPExFNvK28vHE8e7JTc5QPuZHcbVLdLEIyklyY8S3J4KlY8ftzuUNJv850D8P/Vz/yH0hfdGsPoQm8P49NZSAypWgru4edVilUCj1BtdRa9me/3/fvaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691463898; 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=6EwDdAjnwUPowWvaCh4C85jrngqIJ8regtvwyJyUpkk=; b=mMmK8l5DtsEYXmJZS86vGHXhvciY3BEY06CRVR0WiVpUGm7eMMll18WkBblP1JxMPrxKWaWSW0EhXBdGFsn227RhBQYAOcSype7smSzEiggPXPC3BOZ3i4R9eSsiBPl3+Di35AH+cMUXfo+6HB0fThdL7s07BOHJTIQ3O82Gydc= 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 1691463898739280.7053870382582; Mon, 7 Aug 2023 20:04:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCzt-0001QX-NW; Mon, 07 Aug 2023 23:03:01 -0400 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 1qTCzr-0001OK-VB for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:59 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzq-0006ay-Jr for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:59 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-686d8c8fc65so3555815b3a.0 for ; Mon, 07 Aug 2023 20:02:58 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463777; x=1692068577; 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=6EwDdAjnwUPowWvaCh4C85jrngqIJ8regtvwyJyUpkk=; b=cmyfsx4s5KsAd/fy6+fkyMra+OvBCKCWoGbGe1umVDx6AI7ehKmP/KB73+umRqtfzo /C7XqRy4EAPpLkm/mAcSGPZxM2t0HCvHokJjpZ0LNgPXhMabkdKuG+UUD0KGT/CvMRpc j+CJgQOnePiAE+uTjS3i8uEpqGijSD9wVxRlKZKe+EUJjgtLJ9cRYnh7ScI6ZN1gjC9z C2ze8kCdjEjhyQeXeYWpCq7Oup9ChxRNCh5FWHEPeM/L9urfbbZ6f92runuZfH+7+tPL PKb2BfI7PLP99P51JIS3qnQk4KX+jnmLDKOpEGpW67qLjnyBxC06kdcXl6rEhyOMmG57 1xfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463777; x=1692068577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6EwDdAjnwUPowWvaCh4C85jrngqIJ8regtvwyJyUpkk=; b=C9k1tX3eq0xQFODvVU77CspLew6aaGmoV2kEx+m8PjO8U9LpxomLPY6VwzvJhqtQyF R9TdIsKUYVe2m8BPN7hxDCk1LNglgHhecZ3JmkWn+1rH/0gFkx7zRzeyfiKg8eWR/499 7Y3iU6ekCLJDbz8MtaKgLxz5b8cPP909QlEnqjDFFyV5lvts2z9L2Y4WfbJzUd8mnslw VIuO9naLQMYV++ELsDg6Iaru9CTykm7Dv8KlaFKRnlpZWprR3g4p/Ln/61FU64NBEM2j IzD7xO6C0RB1S2z4Dmf4E2c0h6dWEeiRLV8xFsVQACDZWMjvVX1DjqDwUhDyo7ZESn6i rHUg== X-Gm-Message-State: AOJu0YzrJMN82kaheRDRnQTEQbqrQwuiqTracHCgUahmI4e+tU0mwgU+ yLcLzswug+VhLKJkM/Qg8c/wxWOmXIiisekKlPk= X-Google-Smtp-Source: AGHT+IHSS7BTUtqXqlWCSq1CmAV7VsW/fFL2K2R9UmXCpYTAAbUSzDJp3O+7uTM1j+lD5XB4b6qDzQ== X-Received: by 2002:a05:6a20:1612:b0:13e:14f9:294d with SMTP id l18-20020a056a20161200b0013e14f9294dmr11430325pzj.58.1691463777057; Mon, 07 Aug 2023 20:02:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 6/7] tcg/ppc: Disable USE_REG_TB for Power v3.1 Date: Mon, 7 Aug 2023 20:02:49 -0700 Message-Id: <20230808030250.50602-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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: 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: 1691463901155100007 Content-Type: text/plain; charset="utf-8" With Power v3.1, we have pc-relative addressing and so do not require a register holding the current TB. Signed-off-by: Richard Henderson Acked-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 01ca5c9f39..63fe4ef995 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -83,7 +83,7 @@ #define TCG_VEC_TMP2 TCG_REG_V1 =20 #define TCG_REG_TB TCG_REG_R31 -#define USE_REG_TB (TCG_TARGET_REG_BITS =3D=3D 64) +#define USE_REG_TB (TCG_TARGET_REG_BITS =3D=3D 64 && !have_isa_3_10) =20 /* Shorthand for size of a pointer. Avoid promotion to unsigned. */ #define SZP ((int)sizeof(void *)) --=20 2.34.1 From nobody Sun May 19 16:27:56 2024 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=1691463840; cv=none; d=zohomail.com; s=zohoarc; b=JGmIhn8nH+85iYTzNFRFaHX0hBI8IoexDf1TqkDnCtjlvb4tkMWwu4ejkfWczwgJlEoMUjf5WQDZWHI2jGrDuQq6xJJlUq/CvsSiYu5i/e1N9T7fevFv2xRqf1OT4Ljhev8AvuaX7xdCpFtrRBFwB7abxmWdqa/YGDiK1CgGwKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691463840; 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=V+PZ+MkLecLrqPhUWEMZ8qOCbS3Yrr8j9Pi4RnELYw4=; b=Mx4hj7CSHeD2Gj01Ip+u4nZnxTVg3dCcNeETRcegylpOkr8R+5v03pVXM5Uvin+P5qLGcnpsn+SdifleeqCCSrAMMPuojrvgZv9df76kFRTAyme3vn7u8ArlgjHPNeEoN36O/ZKKGwij5LRBBYYGW8sZfs3uzLRhbpchC+lo6DA= 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 1691463840736476.0323063363679; Mon, 7 Aug 2023 20:04:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCzu-0001RO-Ro; Mon, 07 Aug 2023 23:03:02 -0400 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 1qTCzs-0001Pc-Uf for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:03:01 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzr-0006bR-B6 for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:03:00 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686ed1d2594so5014317b3a.2 for ; Mon, 07 Aug 2023 20:02:58 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463778; x=1692068578; 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=V+PZ+MkLecLrqPhUWEMZ8qOCbS3Yrr8j9Pi4RnELYw4=; b=vXRjsnRXqv7Epg9Yr7JAj1qV17tS2XgboGE851OTloUZr0pD9l3+p+5dzLi9B9ArgV oUk9wBxCCiaeJyj3LsjjzHYEAeYRlY8qLVnghzNXIyqMzlx2zynbBE+9/oqAJ6J8Qxdi QiswrpJR+7Lii5O/JXc+Jc80XXarx9J1unYk3z0Ho9yEB1B2uQa5X1a5mBvzyAPpjaCB /2g1HHxWQn8MqeUrknZipX3l2pNrDhDIa6vZsYRO6DLCy9E30e5i9aT8pz/7jrsOFYSF v8yo0NAFB+8RR7TBbzRKzDPvV/GOltWKXfK2/eZky6Y6scG2ZKfmD1cB1SzSPz/+LvSK KFiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463778; x=1692068578; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V+PZ+MkLecLrqPhUWEMZ8qOCbS3Yrr8j9Pi4RnELYw4=; b=DEsT04vJ8ESyFAOZoEfgjmqJDnAaw9hmRCWvEZ5oT+FK1JLLyx9jCyXCSxpfFIU0hF X8hf8o16RVZbW0MrWVh/nKnJ3oGsUXD4/eYrCWvZnPy6x2VTlJSSktMZ18MJ9Bm0/RfU +WjCVHntlVfn8QRJ+EZB9tj90ul8LX58G6S8x6RNKBAEnZzfsY5yMP5zDxLXnyVK4zHW ZxysvKM25r4h6tLF7/TofNYX9FN5EeuvTkJ2xW0+D/rhSEf7x00+Ko06yVBa+YBfhHJ8 VLWq7+j0itgU1cdj79bzb9gb1AE7hW6swdvekg+kTttgfrTiDkWvmbhwWWfvZ52YoDWA 5dfQ== X-Gm-Message-State: AOJu0YyU8UfnjBB2qe83Ke0It+mbzbHHWGbIfMrMdr6ePYv0o8+1zkpR FUVG0+nW/3AIYOkndOuUZD5YlBaH+ifOF+7lNik= X-Google-Smtp-Source: AGHT+IG2SHkc3Z0P5QwoUodakZTex91zx3mEKUPJ11cZGLQhO/akn1A/2fy6Q4A0SgJRMeu+GlxS5Q== X-Received: by 2002:a05:6a00:1488:b0:687:6184:def4 with SMTP id v8-20020a056a00148800b006876184def4mr14000203pfu.21.1691463777951; Mon, 07 Aug 2023 20:02:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 7/7] tcg/ppc: Use prefixed instructions for tcg_out_goto_tb Date: Mon, 7 Aug 2023 20:02:50 -0700 Message-Id: <20230808030250.50602-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1691463842318100002 Content-Type: text/plain; charset="utf-8" When a direct branch is out of range, we can load the destination for the indirect branch using PLA (for 16GB worth of buffer) and PLD from the TranslationBlock for everything larger. This means the patch affects exactly one instruction: B (plus filler), PLA or PLD. Which means we can update and execute the patch atomically. Signed-off-by: Richard Henderson Reviewed-by: Jordan Niethe Reviewed-by: Nicholas Piggin Tested-by: Jordan Niethe --- tcg/ppc/tcg-target.c.inc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 63fe4ef995..b686a68247 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2646,31 +2646,38 @@ static void tcg_out_goto_tb(TCGContext *s, int whic= h) uintptr_t ptr =3D get_jmp_target_addr(s, which); =20 if (USE_REG_TB) { + /* + * With REG_TB, we must always use indirect branching, + * so that the branch destination and TCG_REG_TB match. + */ ptrdiff_t offset =3D tcg_tbrel_diff(s, (void *)ptr); tcg_out_mem_long(s, LD, LDX, TCG_REG_TB, TCG_REG_TB, offset); - =20 - /* TODO: Use direct branches when possible. */ - set_jmp_insn_offset(s, which); tcg_out32(s, MTSPR | RS(TCG_REG_TB) | CTR); - tcg_out32(s, BCCTR | BO_ALWAYS); =20 /* For the unlinked case, need to reset TCG_REG_TB. */ set_jmp_reset_offset(s, which); tcg_out_mem_long(s, ADDI, ADD, TCG_REG_TB, TCG_REG_TB, -tcg_current_code_size(s)); - } else { - /* Direct branch will be patched by tb_target_set_jmp_target. */ - set_jmp_insn_offset(s, which); - tcg_out32(s, NOP); + return; + } =20 - /* When branch is out of range, fall through to indirect. */ + /* Direct branch will be patched by tb_target_set_jmp_target. */ + set_jmp_insn_offset(s, which); + tcg_out32(s, NOP); + + /* When branch is out of range, fall through to indirect. */ + if (have_isa_3_10) { + ptrdiff_t offset =3D tcg_pcrel_diff_for_prefix(s, (void *)ptr); + tcg_out_8ls_d(s, PLD, TCG_REG_TMP1, 0, offset, 1); + } else { tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP1, ptr - (int16_t)ptr); tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, (int16_t)p= tr); - tcg_out32(s, MTSPR | RS(TCG_REG_TMP1) | CTR); - tcg_out32(s, BCCTR | BO_ALWAYS); - set_jmp_reset_offset(s, which); } + + tcg_out32(s, MTSPR | RS(TCG_REG_TMP1) | CTR); + tcg_out32(s, BCCTR | BO_ALWAYS); + set_jmp_reset_offset(s, which); } =20 void tb_target_set_jmp_target(const TranslationBlock *tb, int n, --=20 2.34.1