From nobody Sun May 19 16:31:43 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=1691184954; cv=none; d=zohomail.com; s=zohoarc; b=Qk+CN3+YgsvNLWyvEgZZUyNuQA/YR2X8ZMug/1lZD807A6JeD4gxM2JDMn5VclbeH2L4apxhViqN4XyEBndcrgf3PKBk5CsWa0Zlz2ZRnZKKWoHqdbnjL8uZIixZf0gCPcB3t+TGDumde4qgvCeMWZ3+EctXFqbUuWpv/fkHqqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691184954; 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=cPM11W6QBlqJ55JkdMUtTvagHljXGxdk5XV53OLdjw1xj1gWcmTE6eOk5gNDM1MiyaTxKV+X8OzloDeN7IU1Pc5RSkqedSVk9sbanzXGG9xN0caWwSSAtTOOOPlDZrHXMtHaoTDCTVCXVT2LUYDiNJpII432LDZiyGz0atUlcT8= 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 1691184954395626.0787377217707; Fri, 4 Aug 2023 14:35:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2Qw-00068z-9Z; Fri, 04 Aug 2023 17:34:06 -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 1qS2Qu-00068D-6n for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:04 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2Qq-0001rA-Ad for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:03 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bb119be881so22238665ad.3 for ; Fri, 04 Aug 2023 14:33:59 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001ae0152d280sm2188662plg.193.2023.08.04.14.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691184838; x=1691789638; 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=Xk3vgCLxyyUSDKLK+SFS3WHOokYeVYFmqTtdbFoki9x27es/e8OWBXqlYQAH3xENZn 4+N0wIyNDDRekgSPZlHHLDJfm5PNEeuGoV7gWs6F6XMd5Et4aBdfUQayBiZG4sBa/QIC kkE8FdXqlpEIcuCKpboSVPnHLpIQiebESLtM0+Tfc2IbI7p0Q7odksyMnKXiM1jRQypa BuP0KM+lnsZrG6cfQL2fFn/23mfYNMMkQAK0eVafttEiA6G7Ya6p8c5rHuMXll7K5sFt /kIy9Sn+xrmqliGBcWUQUijnyIF4izJXmx1OIgCuIpATDL3j27aBAhY8QG0lZnaOBz32 mplQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691184838; x=1691789638; 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=EZYU+5Gsbx7llYLe9nrBOVYbFnEO9Pe6aJApbq/xeaQDaXibdoR9Rutd7XA4Q7QPU3 2cXRoequ03ucoZpowUCllxB9Ky/glBTx7SNj1eIXFT13gbpNFTzsgSv3luNjxqYxaOnG nRHEZ8F8cxxSqscjay/R+YtxYlIrUATiNT2TrRWnzw39tyC5N0TGBU+viXKSZEA43/By cF451QgTO1Fu1Br/z/AvLWrXmCvNXggz2cVaA2pg84339CG5xbmEjFfdBSGHk6dDCP+E o1d5kB2WrKMmqlPHspCetZ7AU+PIu5Q7VONVjcM1rY7pVSmpP7VeddE/SQfKgMUMYgxo uing== X-Gm-Message-State: AOJu0YxvoWJFxBeBqDXRa3slpjGLHI/CgnAVdVN4u+rDhBVH4Vu8poyo S/uNyO9U21kSttsY8j/bx1g7NIDGQ3bi3bW1aK0= X-Google-Smtp-Source: AGHT+IEu77czyk5M8btGorPaNgW5PkirhYyTpSLYYoAZBn2IfRFpkZtvs1LWbQPp2Ed/plsziYIRHw== X-Received: by 2002:a17:902:d4c3:b0:1b8:b285:ec96 with SMTP id o3-20020a170902d4c300b001b8b285ec96mr3510005plg.23.1691184837762; Fri, 04 Aug 2023 14:33:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com, qemu-ppc@nongnu.org, bgray@linux.ibm.com Subject: [PATCH 1/7] tcg/ppc: Untabify tcg-target.c.inc Date: Fri, 4 Aug 2023 14:33:49 -0700 Message-Id: <20230804213355.294443-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804213355.294443-1-richard.henderson@linaro.org> References: <20230804213355.294443-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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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: 1691184955795100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Tested-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:31:43 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=1691184958; cv=none; d=zohomail.com; s=zohoarc; b=BlgJbXZgqC9k3vLiP49AZEXVPNyYNyhGA//q0/HFylhQS1u6reKPhOzV/+2TBNe0AdbpHsmHKwxz0xAc3xElHL58l0STbGwcwIDEBKn0eETDnjGQZyK3ohWEe3wYvOJz8upvJ/Fr3ECbuQ+nN7JuUX2ahCNL6Jq9sRLX7LSwB1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691184958; 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=QXhvB8XyLuww2xCl1ZkNwGIY8SDIYkhxbiAR1SsdBhg=; b=Fik5tCa8pl3PXwz1k5vPaC+cyhopqLElNNNqhsatujRaU46+//JUbSrcEHz9qJK6u/P4nsreRzUEXrMdmzKJtuAI4QzJimZRcWw4m9pE6ZXeyL/5PtmUM/+rveRJxBL5FF1d8NZmBDTvKq4qxJpMi2JK+ESbqxqOsO2KVZj5tkQ= 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 1691184958861440.6075472775681; Fri, 4 Aug 2023 14:35:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2Qx-0006Bc-15; Fri, 04 Aug 2023 17:34:07 -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 1qS2Qu-00068H-AU for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:04 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2Qq-0001rY-0x for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:04 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bbc64f9a91so22144275ad.0 for ; Fri, 04 Aug 2023 14:33:59 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001ae0152d280sm2188662plg.193.2023.08.04.14.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691184838; x=1691789638; 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=QXhvB8XyLuww2xCl1ZkNwGIY8SDIYkhxbiAR1SsdBhg=; b=foEKWYdGQy9sG+uwY/RobA2UVQi5vCEGTjS7lv8c5zCmAOGEpzkpcOerd8p7RvE0js 0LWKyvejVLX6l0UigevP5e/he372Ar3NQ8ZS47bmiFhb63qtJhrYTHvvEVA2LMkt0Yvc MHG0zlikqIP2Uw4g8dM6BTGq3FI+D9815cLLO6fuz7yqzhN0QAVIzhn82z5RAAiBlkfG JzFBrw8HrRPrc7ijuwmmv5isBuJo8HAJ4i9oNP+EuMYZ0EyP2coVvj8jQTk/sg/4T1c6 nETnGjAbQ2D6AgJd+N20TgEYwgxzJWchgouyE8fxAfTXxZjzOWoP3trrJhKHQDh4j3tK dJUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691184838; x=1691789638; 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=QXhvB8XyLuww2xCl1ZkNwGIY8SDIYkhxbiAR1SsdBhg=; b=UH76S+MOn/MN2F8iVfA9DCjBrn6lQoGAWKmzYxVYdiy93pQKcAu60w5FSbAop++ULm RY36SsYcIyZtqSegqtq3vZvyGgBh+YdyBnQXvdNR9mQtk/5+lr4KcYhJLZ4AXFzxzOaf QFGppJZKSnQW/bWPZ1s4ueIaqLHwymAHJwsohQkEsOkOav1qVKnt2zGq4Rdl36Vv3oIz iyNy0l1CSS9mvWa/+Qs5ZPeEoHt0SM6e7ZlrGfbvLlZktWZxP/+EWhoWSHbYH7/w/kwO cbG5oqiE6GoaQuuMkpsYowP44gC5sbA9TweE4NVZP9ZhHYi9ywmGKkXKbVcoHT5VlB8F UuGw== X-Gm-Message-State: AOJu0Yxse6+qz093AF9KsOi2QSLWeGYn9P5JpuWASupATNmAE3aWCvgJ 8nFTPl4Z3uIU+O0I27Bl056Hlv/PjqE/rPy+gHs= X-Google-Smtp-Source: AGHT+IHEZeMkXMclEsP7Ok4otOfYOwJgD+kGPRncQsLxqgf673mnnyRjQxsFkgKVKeqdSpMbMHSNNg== X-Received: by 2002:a17:902:d2cb:b0:1b8:a65f:b49d with SMTP id n11-20020a170902d2cb00b001b8a65fb49dmr4092212plc.12.1691184838573; Fri, 04 Aug 2023 14:33:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com, qemu-ppc@nongnu.org, bgray@linux.ibm.com Subject: [PATCH 2/7] tcg/ppc: Use PADDI in tcg_out_movi Date: Fri, 4 Aug 2023 14:33:50 -0700 Message-Id: <20230804213355.294443-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804213355.294443-1-richard.henderson@linaro.org> References: <20230804213355.294443-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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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: 1691184960614100002 Content-Type: text/plain; charset="utf-8" PADDI can load 34-bit immediates and 34-bit pc-relative addresses. Signed-off-by: Richard Henderson Reviewed-by: Jordan Niethe Tested-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 642d0fd128..7fa2a2500b 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -707,6 +707,33 @@ 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); + } +} + +/* 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 +1019,26 @@ 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_out_need_prefix_align(s) * 4; + tmp =3D tcg_pcrel_diff(s, (void *)arg) - tmp; + 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:31:43 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=1691184957; cv=none; d=zohomail.com; s=zohoarc; b=e/wzVFMJW+2MjgxMIQlWD9jZwOG5MC6A2r70rcPHiT/ggEAfPKW+kH9XWVmHm2qVajvwSYdNdP0k9+5Ok2DJC7UO8e5E0UjXKZEMriBOzhhLnKmoZG6zN+krEHIS6Qzjp9prNKJlmZbRaIBcueOdspBy2jJHGTFtPiaUJ7JYMDU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691184957; 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=y9+EpIdtYkIJvK6T0vT+EMuiDbj1ltMIRQcPyROrXSQ=; b=LhjAEDr4eGVJzSePWWCKPAtBJtTYG/KB8xDK1nN0D+yYFQu/THV6kBnRswb9s3sGZrJRTKOl5pSI0L1T365JLbKnZVLZdVm1YPuLbgbT2ahueJ70cKXhmwmVUe1YaGrAtNpyoNF6RGtBbc7yKlU8KWWnC5yGf9ttMJiA68ttVlI= 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 1691184957582653.0191933045811; Fri, 4 Aug 2023 14:35:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2Qx-0006Ca-DH; Fri, 04 Aug 2023 17:34:07 -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 1qS2Qw-000690-7D for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:06 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2Qs-0001tL-6T for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:05 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1b8ad8383faso22437905ad.0 for ; Fri, 04 Aug 2023 14:34:00 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001ae0152d280sm2188662plg.193.2023.08.04.14.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691184839; x=1691789639; 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=y9+EpIdtYkIJvK6T0vT+EMuiDbj1ltMIRQcPyROrXSQ=; b=KwIZiEVcDhev+eWBVVpPuLKPID1xjkkteDl9TPi5id34tgPWpXOo54y5VVqoc+ZJR7 XOE1qWOC+dWRO8DmaBWKJcPWjO43WvRzjfrwB/8QqBmaNlbY18GffHjrnoeKFqs54Ol1 jZS0xowzIYkpXSGH6tnLWU//zrwFzsjPeepx4aaKHUjMd4vfqmKZb+6JxqJcoD6UNL5e I6Le5cRV2VWr0ijyISesaXCtKAcMDlxVkzIpr7JWANZBhhWrygyUA3+bKUhu7p6EKze1 Oh++s5mJ9E59eCZp+lQqJuNh0QVtBAlpufVWcGA7KG8FfGxLyk5HlrIEJNjcFDCyYDQk J5nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691184839; x=1691789639; 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=y9+EpIdtYkIJvK6T0vT+EMuiDbj1ltMIRQcPyROrXSQ=; b=JgIKzON19qr6uz2EV9qA2rEXJgO59V1Sip1ZcLUudC5YoV+R+yITCibN/OVBMr7oRc 0rqK2E9i+6/LJlPNQRnS+/cm3ZdbdSM+xskuB/nHxGKf4+H82lzutOrAx8xmuIMrgSyN fjBAWRL/+/Vu+wWZEnDtcNK860Lc919AVenYb82Va01i/vy5qlbqqt1JjKaTnRPg1Q/h xok6F0WGXYJx3YKFZfUq+IoIfejvAmMYn+tLjW9GS7QeqOyTdpEUf8vlmM+Ot+01tVBJ VZeSgGs7vhJszLdL39g8npwS/ViG3v60R+HZWBIZ0/h5IfGU/eMlVdR9qJEMbr4qSoye /oiw== X-Gm-Message-State: AOJu0YwCSC+vI5uP3sKktiARUkF8LQpGCrRxoFeoF1oPWnke45/qyzMH YNgmsCpjFDY9bRFnO5/FqPj9XTM48Nx/UXr9cOQ= X-Google-Smtp-Source: AGHT+IG83ipNP+6aiRDO9JMTxDxNcGHYeQTaOGIvBOXDuoEA/fd470IHeBW2uisJ3PDJBjLGPKgWLQ== X-Received: by 2002:a17:903:2351:b0:1bb:c69b:6f6b with SMTP id c17-20020a170903235100b001bbc69b6f6bmr3799389plh.6.1691184839459; Fri, 04 Aug 2023 14:33:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com, qemu-ppc@nongnu.org, bgray@linux.ibm.com Subject: [PATCH 3/7] tcg/ppc: Use prefixed instructions in tcg_out_mem_long Date: Fri, 4 Aug 2023 14:33:51 -0700 Message-Id: <20230804213355.294443-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804213355.294443-1-richard.henderson@linaro.org> References: <20230804213355.294443-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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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: 1691184957845100005 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. Signed-off-by: Richard Henderson Reviewed-by: Jordan Niethe Tested-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 7fa2a2500b..d41c499b7d 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 tx=3D1 */ + #define ADDIC OPCD( 12) #define ADDI OPCD( 14) #define ADDIS OPCD( 15) @@ -720,6 +729,20 @@ static void tcg_out_prefix_align(TCGContext *s) } } =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) @@ -1364,6 +1387,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:31:43 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=1691184940; cv=none; d=zohomail.com; s=zohoarc; b=GfDuqyZV0g8ohB3VzG/blr+xDSAJNZOWHUYbdnFeBNXwkj/psdKWp/iSnKsOuSWPiIF0TV7B3TDwqegAVKgulCQWC42ueR5OmZSP6R/p/QKGRxI+0UKXPop1YfT5btV0XGp0wXjkZTNbSMga6dZxzSYqtS5yznARz6gMiKoxUSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691184940; 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=XSfXUkEbJi6XSSeczzkehSgMMZNGjw0txB1UvXtXqsU=; b=ByL4SNEAB67u2RONoFVlAtwqPz+YCvJa5CX1+adKIaWhBFHdw+Th71LwAJHoyawsskAQKMDxY56VySlgCRrOZnTx9RMgt1elXPtwRlwJcy7HpUmB0G7eL/oZkb7W3gNurGqYMxVbqKt/99q4H1qJwhAOe2dh4gSQgA2ye/PCA4k= 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 1691184940603618.988690520663; Fri, 4 Aug 2023 14:35:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2Qz-0006Dt-67; Fri, 04 Aug 2023 17:34:09 -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 1qS2Qw-00068y-6y for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:06 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2Qs-0001tQ-6T for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:05 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1bbf0f36ce4so18515105ad.0 for ; Fri, 04 Aug 2023 14:34:01 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001ae0152d280sm2188662plg.193.2023.08.04.14.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691184840; x=1691789640; 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=XSfXUkEbJi6XSSeczzkehSgMMZNGjw0txB1UvXtXqsU=; b=e46yjR1QGQgC3aQQU5JqDJhotcAD2xGjqiPOQeo/qbXypkWLdO9quaFZFY1vzzA65T pqAA5ibS/c+iMvCw3FPZLvPZ4XxOUXNYYhgBMbX+gJi7D3CRbzCLnQVOQu/VcLn1JC8V 7UiuzUtub0Zh4cKNufAQMmdZTtcuxWiTuFcXQRphj7xnkeXWd3WW8jny5cKbeMvcATCn L+fQDw+/v0584qdGPYaKXtOIu8TbUa4AcoKquiKhGAsH7OFtK7u7PI3PBlDX5QN2Euwn yx5Mj+hwplUKSNUg7ymK21AFT785c1I8jc0Pb/+SF6xkz7Aq9+b4fZoCSwmYIQ/jz/v8 TEcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691184840; x=1691789640; 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=XSfXUkEbJi6XSSeczzkehSgMMZNGjw0txB1UvXtXqsU=; b=HByoDvHLtx5TJhTIiABb5wct5QVEHO3/n1LBTJSeHO7RiWid9qLCTyxQTPS35TVZf4 I56K/MQpcNnBeOQgaGczDvVIpAfiTeE6mo+bZxFmkBDgI2evT+XYIhJUxQt2uw8+pKel xAx9NGdndOYmwJTZUg626imLzaE8WgeLmfS9L9iYuDk7XX6Fssyxo0xoWhAnxdUmm1W/ ZdUwcptpzdITjbRfataejdiV4BcdCv8ulpb45nMaCz3Xffg53XEyBKMq+3xtgsVdrXzh uB7i1I2/x/VXdyOZPjjAqNplotydZ2W62KzSEiotVSZlP9KOT6PxNxfcEe0WYN7hLc7/ 7IzA== X-Gm-Message-State: AOJu0YyY6ZafKlaGs21tZsrAbCYE/mhlewTH4PXs+UlhZCBlFE/DpcHk uKEmnplezOsVLxCbiavEFlclhgKAcMlIS8J0H2Q= X-Google-Smtp-Source: AGHT+IHWatTGraHggSiSypFaVcTBX9DkrquaG5XZB14a5TePne2gO5ELwzCij36mb852vDSPbDbNSg== X-Received: by 2002:a17:902:6a85:b0:1bb:7a73:6b59 with SMTP id n5-20020a1709026a8500b001bb7a736b59mr2433016plk.32.1691184840155; Fri, 04 Aug 2023 14:34:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com, qemu-ppc@nongnu.org, bgray@linux.ibm.com Subject: [PATCH 4/7] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Fri, 4 Aug 2023 14:33:52 -0700 Message-Id: <20230804213355.294443-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804213355.294443-1-richard.henderson@linaro.org> References: <20230804213355.294443-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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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: 1691184941373100002 Content-Type: text/plain; charset="utf-8" The prefixed instruction has a pc-relative form to use here. Signed-off-by: Richard Henderson Tested-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 d41c499b7d..a9e48a51c8 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, @@ -1107,6 +1126,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:31:43 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=1691184940; cv=none; d=zohomail.com; s=zohoarc; b=YDs12bSC+hPGCCdFAHlRS1lD4V/j1ujXWnt46XavGcSU2H0i0jcvjPRxxjIm9it6kalDmkC3RmszdnbDxXLGL/9/riOniVs1dDW2w044MQ37DOIXOz6z+5sqYn3VFZMgTB9uBI9/l39jqQ5mvUzhd++zEmcMuZlQGj2oYxjXAmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691184940; 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=7Fc9S/4//cSOxgnGncfnlKz99u+sNj+6+KTbB1MnhPw=; b=H/FcJZJvhcblLj3/mQcNG/gnqF9f9+gzFjCPpaIu9AWJM3Yq796lGPGjvO4bugn0ZAOXRn/YEVw3QLps9qDbzjGkFdKNzcGL0b2XiyjU+YkgTPNgWc8JOqu1I7IoUbRbfSPf3b/WINAomUpYDCYkdJL53NhaD6AjthfjppybEDI= 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 1691184940323327.3235774792046; Fri, 4 Aug 2023 14:35:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2Qy-0006D8-0Z; Fri, 04 Aug 2023 17:34:08 -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 1qS2Qw-00068v-6E for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:06 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2Qs-0001tc-Bi for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:05 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1b8ad907ba4so18837775ad.0 for ; Fri, 04 Aug 2023 14:34:01 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001ae0152d280sm2188662plg.193.2023.08.04.14.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691184841; x=1691789641; 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=7Fc9S/4//cSOxgnGncfnlKz99u+sNj+6+KTbB1MnhPw=; b=oUaIpjejqdzmuP86aDHlYPIHgrWZMee6PPPn/Ysd7pmrSF52MtItcdD99Rl+nhK1Ol NafmdX7KW9ntMJ2u+Q2kcA7JDdcdc14z8FGEuFpN2NLei6hOUyYk/dgCrRowD5kOuFPY T2fAce3PmE48cJh8yAofIOgfGepT5DJGdbUgEVohwJsrVw5Dp14WD5E4HTUncwXTX8Is le03ss8WxuBOCGIbG1EEasaNjZ4hMSlIavrd0uGenSBn5JqxHC9ZBAAFIr3Xr2ktg9UP cHEIUOngYRa0YAyibqtPUqTkjmQvJhRYgDDhqCyAPj2WMWFylV4EIJ7HgQH18CkwO+wF lIJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691184841; x=1691789641; 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=7Fc9S/4//cSOxgnGncfnlKz99u+sNj+6+KTbB1MnhPw=; b=ECIgux1tpMAGqL6uzqtWyTAmWd/z/IPDJDNbOJfGnhj86xVRvEstmxhgTFfjISrEEX 3aAdbVM5T7To7XVFrSN62hK/+fo2RsaV5fyymVOWO0jGHUrcDQbiUdc3ZI2OdH6ngFl5 j/MeTE7Z5Od2VcBNrFee6CY6JYORfcWixoGSTrcHhUr16Vw6DSOzNr1yZkcA1pQQu/Aj JBCvL2N//5KLRvk/EmODI06JTByeFBOr8bL2pq0PcTf3NHjndNwVFlCyyZg1y8yFdcAn lrd0bLBEaAVpPL1bsqI+1WndCzaK/xknrjHkUhVfIRUvsGrNFlrEeXNy7VoY+WhsUyA6 se4Q== X-Gm-Message-State: AOJu0YxY6lNJzGb3ccqKer32WsNkLfUyru5+noct+7cjU0FxdpYAzdyT 0VMVGPTQHOrDKO0eCgXmqyH8OYagLfzrjN+gNos= X-Google-Smtp-Source: AGHT+IGIMBqq+Yai/eaHupCc3Rt1bDka2dKclE2uws8O5+2Xa7VHXDx1oG95yfzoKSXRMLaEY4h2FA== X-Received: by 2002:a17:902:ef8d:b0:1bb:7927:c1ab with SMTP id iz13-20020a170902ef8d00b001bb7927c1abmr2533889plb.48.1691184840883; Fri, 04 Aug 2023 14:34:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com, qemu-ppc@nongnu.org, bgray@linux.ibm.com Subject: [PATCH 5/7] tcg/ppc: Use prefixed instructions in tcg_out_dupi_vec Date: Fri, 4 Aug 2023 14:33:53 -0700 Message-Id: <20230804213355.294443-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804213355.294443-1-richard.henderson@linaro.org> References: <20230804213355.294443-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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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: 1691184942477100014 Content-Type: text/plain; charset="utf-8" The prefixed instructions have a pc-relative form to use here. Signed-off-by: Richard Henderson Tested-by: Nicholas Piggin --- 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 a9e48a51c8..e8eced7cf3 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1191,6 +1191,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:31:43 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=1691184940; cv=none; d=zohomail.com; s=zohoarc; b=TsyQEUluLZno891Qo7W7ge8MKZm3ydLLC/bN9w1GS7GcWJsou7m99a3ExoyeRPhjHhr9lUqk4hWTEqfgMbpZM+B2EZ4kM065C4OOrIjPM+5ttFFfFnmmHeKZDIc8l+gcge3vE+yLW+Vj80C+7YDkcoq1+zSy/jG+Fv4e9uHDQ78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691184940; 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=O5oE4+VawxP53rOCLWmxeNePvIcIJOdD/vpw31mMUWo=; b=WFHnPQG//rnrwi1RKX67qE7WknC1AgmG7b130Lyk36rTegGGH5eesaEXu8xPVjUCkTZNb5oqD8cKGOScZ4skntzg0wWMh193p+MBFGy4oCu6vjVYTl0/gkMu/aqd/gFp6a5mti294UZ6MlqHWeSzceGN/exvggm3Ir0rWo4i07Q= 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 1691184940327437.18415898881665; Fri, 4 Aug 2023 14:35:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2R0-0006Ex-2n; Fri, 04 Aug 2023 17:34:10 -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 1qS2Qw-0006BU-VV for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:06 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2Qt-0001u2-Tu for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:06 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1bba48b0bd2so18423395ad.3 for ; Fri, 04 Aug 2023 14:34:02 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001ae0152d280sm2188662plg.193.2023.08.04.14.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691184841; x=1691789641; 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=O5oE4+VawxP53rOCLWmxeNePvIcIJOdD/vpw31mMUWo=; b=UPoCeymMzGnTBs7rPD2U40pVUXs+pHUREb+urVevkjKv0vF8ykW7dQliPFvXp0wHSB 5WWouf2GCycui5PtlMcuHbjIUr5z+hThtlkGOMxGAMwPyw8jhDKAa3FxxfIWIrLnG6Le eWgKa5dWyxeqOw5xD5yfdVMqVCIpPzM9dzLf1sox377zTVr9pPb7SMj1/KWDo3HY0lP8 6xYoO+5tsFavuU62AU9VPK+2mD9GMJKjwBi1kmvNx63N0GRG321v7xGxJSM23xecHldO EzbzHa3rCnUC2uOhepDxjvmH749SToTT0ERQWAP4PoAw5fY/QlNVIsxeDGZuHrRrXP0d 4HIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691184841; x=1691789641; 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=O5oE4+VawxP53rOCLWmxeNePvIcIJOdD/vpw31mMUWo=; b=iHy/b0dY2J/QFBJVO8NnGtsDs1AATU+qjIvZTtjVUjIcgeTJ22UldtUCsXUrTo2zhr LcPtnPXaLd0kqLyLHnY7qvvlhLNXuU2BtoGWzXetjExcJ+CM3YwlhCuDh3MKqO6QZd4N yCkhoIjkTFPjmHFVvFX1vuixyDPcO4+xmDyCCtnWx0jE0MqsNyR6pGnSNps8l5f5WV6k MT2eZvxvpZlmGCBUvB/TIB+OekANVT8zS1VPOptZdJnUCXKPGd2RBKC1fNC8eq8Ww4ni OooaO3Q/JE9MvbvF5vv4GLug8QgiuqZArEN5diQM8nPNGIZaZoB0DimFzz9W61D2q+hd NPXA== X-Gm-Message-State: AOJu0YwK0VHAZPykBw2Y+OvuRw6CShy2yBj8XlLZUeoXWe4x3hfFa4fg eipObKC5Rq4f8EXpHKSeQ/LBzoIRTAaHaQD+vjo= X-Google-Smtp-Source: AGHT+IGaffblbGk6Yc23781WvRSH1IEHMTNtFd/CMErOhUrN4mhAtxMCaZFvdfSYFOLgFsPRQgVuVg== X-Received: by 2002:a17:902:dad2:b0:1b3:fafd:11c5 with SMTP id q18-20020a170902dad200b001b3fafd11c5mr2594356plx.44.1691184841626; Fri, 04 Aug 2023 14:34:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com, qemu-ppc@nongnu.org, bgray@linux.ibm.com Subject: [PATCH 6/7] tcg/ppc: Disable USE_REG_TB for Power v3.1 Date: Fri, 4 Aug 2023 14:33:54 -0700 Message-Id: <20230804213355.294443-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804213355.294443-1-richard.henderson@linaro.org> References: <20230804213355.294443-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::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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: 1691184941859100006 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 Tested-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 e8eced7cf3..5b243b2353 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:31:43 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=1691184940; cv=none; d=zohomail.com; s=zohoarc; b=kFc9tihLLsqsKJ+XUJB2Z93LysP37Zb4q0CP8av+YObExV6V88nDDo97hiCurGDxDLX04602rqJ+QJTNOi9Au/pxtKKbX+n1O7ZDv5sGB8Mc/2M7y14IZKYMT+9bO1zB2dmytFl8jj7T+b2k+NSIqAquZlBkWPw2UOGkqgSUTf0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691184940; 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=THGkRlj9Mp3BqTpP1dcC3/tdLawIOsnAx3v2Co9ZmqU=; b=MXDbtzJ7lk/AWgC8b7/spOKKTwMMdNy4or720kFDGVHmLMucT/3t+c2Om50BLN+FF4CZHYRDuMRC+/SPDw47BqiRrYN2KMU+REHDMD1vaoqqYl9Krl1cRZAyPwIY3+Uc7tfkzU/rLfjzMM/4lN6EePpjbW74IqKt3tIPFMaSWvM= 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 1691184940403321.5050161897575; Fri, 4 Aug 2023 14:35:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2Qy-0006Dn-HE; Fri, 04 Aug 2023 17:34:08 -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 1qS2Qx-0006C1-27 for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:07 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2Qt-0001uO-Tp for qemu-devel@nongnu.org; Fri, 04 Aug 2023 17:34:06 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1bbdc05a93bso18866455ad.0 for ; Fri, 04 Aug 2023 14:34:03 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001ae0152d280sm2188662plg.193.2023.08.04.14.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 14:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691184842; x=1691789642; 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=THGkRlj9Mp3BqTpP1dcC3/tdLawIOsnAx3v2Co9ZmqU=; b=nsPGu4ZOh5Ua0nxvLT22wFjQfOg4q5tjjzAAne0XUxscwiGBOAvPBiEpofL1f0A/91 DRb1vs+2deml3w0NwUtm4GJ3udXzvR3qYOVbJKMs0U6/AfcX829RRsaeA32VwiAcf0e+ dRnY+/QWLkkZDCGOfewIssXbSCRb4EX6iCl3kO9I0ITaXk58sdVlaOtRb7IY79zeCWFI TACB1RIFi9hxkHCFrv4K10GbiCjY6XxBSE6M/wdexOmk0299bP3XZyiWkErI9uooxYQw J3v1kVlxhMOPMAvdN9ZdClPKwAfZyRMMV45Bp4EpN+cvxOjtvkBbCAqSoxvhiKZuaDOq FhoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691184842; x=1691789642; 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=THGkRlj9Mp3BqTpP1dcC3/tdLawIOsnAx3v2Co9ZmqU=; b=aWrt6xmDwuHgDWZ9hNUPUS+lH7MoiIIN84EE7OnyNhSKGr7qMr17gZfKVAAeLeoHLP FYRCDlCOVBVsLAZN91r8kAqzaQhNbjnkmT0tqzH+G1A+68y0eselJtBxDIMMk+ClMvIi 6T0t3GXTdDZJAxviZ/jrQJR1VJv0fpI/coSJgMh4r3eu5sENOfbFfNgh6WqQIn6NQyej kx0SaKeGHBxJmXAqmbz4chznaedxUhpNbglOioEcVNHUyY27+rYgdvxra5u52s8RSq39 VQ9tZt88SZ0q/JczdTjVgfyG81IJcYnU7lqGjJA/tySBOZ+e3d5t/CBs8jjxv4/pNwCk Y4dw== X-Gm-Message-State: AOJu0YxE33DgcRgPWKH69XfrUo+mLO4u7qJeLHZPGX4rKjs/7y0r4JIg 5LdezZwq2IAfg4YWoI6gSdBcX2dEsM67CgABxK4= X-Google-Smtp-Source: AGHT+IH4lADEJHvpG4PkQ4bv9mJlJ1n/jWUbIDilBMk5ARuB0k/D9JuKa7BXe/7kUkGwttABpve/MQ== X-Received: by 2002:a17:902:d2c4:b0:1b8:9b5e:a218 with SMTP id n4-20020a170902d2c400b001b89b5ea218mr3244397plc.42.1691184842429; Fri, 04 Aug 2023 14:34:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com, qemu-ppc@nongnu.org, bgray@linux.ibm.com Subject: [PATCH 7/7] tcg/ppc: Use prefixed instructions for tcg_out_goto_tb Date: Fri, 4 Aug 2023 14:33:55 -0700 Message-Id: <20230804213355.294443-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804213355.294443-1-richard.henderson@linaro.org> References: <20230804213355.294443-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::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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: 1691184941926100008 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 Tested-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 76 ++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 5b243b2353..47c71bb5f2 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2642,31 +2642,41 @@ 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)); + return; + } + + if (have_isa_3_10) { + /* Align, so that we can patch 8 bytes atomically. */ + if ((uintptr_t)s->code_ptr & 7) { + tcg_out32(s, NOP); + } + set_jmp_insn_offset(s, which); + /* Direct branch will be patched by tb_target_set_jmp_target. */ + tcg_out_mls_d(s, ADDI, TCG_REG_TMP1, 0, 0, 1); } else { /* Direct branch will be patched by tb_target_set_jmp_target. */ - set_jmp_insn_offset(s, which); - tcg_out32(s, NOP); - + tcg_out32(s, B); /* When branch is out of range, fall through to indirect. */ 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, @@ -2674,20 +2684,50 @@ void tb_target_set_jmp_target(const TranslationBloc= k *tb, int n, { uintptr_t addr =3D tb->jmp_target_addr[n]; intptr_t diff =3D addr - jmp_rx; - tcg_insn_unit insn; =20 if (USE_REG_TB) { return; } =20 - if (in_range_b(diff)) { - insn =3D B | (diff & 0x3fffffc); - } else { - insn =3D NOP; - } + if (have_isa_3_10) { + tcg_insn_unit insn1, insn2; + uint64_t pair; =20 - qatomic_set((uint32_t *)jmp_rw, insn); - flush_idcache_range(jmp_rx, jmp_rw, 4); + if (in_range_b(diff)) { + insn1 =3D B | (diff & 0x3fffffc); + insn2 =3D NOP; + } else if (diff =3D=3D sextract64(diff, 0, 34)) { + /* PLA tmp1, diff */ + insn1 =3D OPCD(1) | (2 << 24) | (1 << 20) | ((diff >> 16) & 0x= 3ffff); + insn2 =3D ADDI | TAI(TCG_REG_TMP1, 0, diff); + } else { + addr =3D (uintptr_t)&tb->jmp_target_addr[n]; + diff =3D addr - jmp_rx; + tcg_debug_assert(diff =3D=3D sextract64(diff, 0, 34)); + /* PLD tmp1, diff */ + insn1 =3D OPCD(1) | (1 << 20) | ((diff >> 16) & 0x3ffff); + insn2 =3D PLD | TAI(TCG_REG_TMP1, 0, diff); + } + + if (HOST_BIG_ENDIAN) { + pair =3D ((uint64_t)insn1) << 32 | insn2; + } else { + pair =3D ((uint64_t)insn2) << 32 | insn1; + } + + qatomic_set((uint64_t *)jmp_rw, pair); + flush_idcache_range(jmp_rx, jmp_rw, 8); + } else { + tcg_insn_unit insn; + + if (in_range_b(diff)) { + insn =3D B | (diff & 0x3fffffc); + } else { + insn =3D NOP; + } + qatomic_set((uint32_t *)jmp_rw, insn); + flush_idcache_range(jmp_rx, jmp_rw, 4); + } } =20 static void tcg_out_op(TCGContext *s, TCGOpcode opc, --=20 2.34.1