From patchwork Fri Oct 13 17:10:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733249 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580816wrv; Fri, 13 Oct 2023 10:11:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXwflBEyHl4xSJInKkN2ypkt9iNAJTAokio55OaSd/EXCrAmrLGxcWA9FHAqkfJC9tCRVU X-Received: by 2002:a0c:fe82:0:b0:65b:d2f:9148 with SMTP id d2-20020a0cfe82000000b0065b0d2f9148mr27403859qvs.32.1697217119293; Fri, 13 Oct 2023 10:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217119; cv=none; d=google.com; s=arc-20160816; b=L6Qa3dI493GOJ4lLNeTnVVdDPWyE7UPQ1bROG6RhKBqQjWzS6IOlaQ8msRGFyOQA3y fWs2iBTEBlAzsPYNiWl/h2V7As6/7MEUEYZZF3ffMtXL91TvZnvcyzJ1HmdqDb4Lao09 mvS4ZIoA2Mam9SLDoylAZCMe6YRljG2h+tJ90ovbsMq54oC9iXKFR8aB4cnWQiWugvWL IlJ1MevdyR+nli9tuNScS/M37IhzpXx+YkTg1QU3asbNCDmQ+goPSsy8/AblWe3sQ0tl fUe8PwQDBOLQUcwlBqDjAmeNseSExfnubKouNVvk+7qbCFoIbhXHeu9eZnAMX73lCKuY WGHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AA7L0NLzkIrOUcDjlwriga27ooiuuZ7zo9pLt3rHark=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=EhWzlVOrPlOpbAOhKJASTrb3I8sedon6bWyi/2Fzo6wAWVrqm+neFDLhcZAB9J+kTi LxDf31hEH58NXaQBOsjDt6eBt33h+v3Bo3R52j+Jyftb6pIt5+ln1WTAyI0xXF9bx0kJ DFpNSsWf/axQHbLb8FcxWax5fcITdFGRJQZgfvP3601IemZjT8mja7NSc1VsQa/iN6CM cQQ9jcrEaEqxCPOW++D4QPWJbOLhaPz4AjHEpHL8f6U/qTeaLc1vyPKPxBwXVZKmH8cl Xy0gJGK9tPGEIQNA3ciYP30v2+K+UFKcjtV8MQCtguXebXnCHgtqXqiHGc5U6I3sVGqO Kk7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zAr7HhnW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ef14-20020a0562140a6e00b006498a534c79si1459208qvb.57.2023.10.13.10.11.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zAr7HhnW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLg3-0000zw-GG; Fri, 13 Oct 2023 13:10:19 -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 1qrLg1-0000zd-Lx for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:17 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg0-0005UN-6X for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:17 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-69101022969so2071375b3a.3 for ; Fri, 13 Oct 2023 10:10:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217015; x=1697821815; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AA7L0NLzkIrOUcDjlwriga27ooiuuZ7zo9pLt3rHark=; b=zAr7HhnWv1a2AnY3Wg6qIaR+VpmihKb2yYlsbfvrtVZJ7ot1VAJ2TCSPEZeI2tBT48 uD+YRfBbq0bCOEAiR8YwLfk5LTaQtqXY0/ksavJgrnz+eseNcka82Ob/l+gxZIpmLKBK hv9XckACF52/a3/SwYblPckwiJrCRCh43RrKTLDMIMFhfsOgBJq9PeOJsd8mTDjv5r5M X0+PuBX++5VVf2C1h63hUV2Ih/924i7EuNI/pfgvM6O3cSLd4M2OflAI9fQ3NUTacgUt RqSFOCcFFMKG0maG42+Ufo0UtMuixz66lqRyNPod/CcqEcn6pGZ9sV6117zvWXGdwKLQ uycg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217015; x=1697821815; 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=AA7L0NLzkIrOUcDjlwriga27ooiuuZ7zo9pLt3rHark=; b=QfV8rVLrW8DQzdz7ZjmsKEqf0EwGczIxPCDPCAid44F4m8HJr8HijvcTe+JQJA3Y4n tGLWSiMRWLMr2IFnAAxUaUqBXGGO61sT2Sx1oD/eP0I5NHRJ5icGhNOG23QVtTf32y1T fbXN2UjyaHGQMhaPTy31EuV7K0xbeENnx6SA6cQlZrO1EeL2dfT3KabMDnhD2SA63TyF 82TYoKPk+7pzq8jT49WTYi9l/lBEmi9vEcTWZX/DrzS1qCNeIVjWcTvmbfRm/Cb5mXNE GzJfnDc20CXRiYTvk3I73uKyR/YjiMjwmx76UssU0GQhjrW9lnpa0sw9B7+rMj0+qRlJ fUKQ== X-Gm-Message-State: AOJu0Yy1Dt5BpCTfpH041BtiXLeltpZOjrD2BAxtHtyPQPB5KsKnqP0n 0tg9iPjuu/rY/K47uPNnJGUkExUeGBbkURSeSao= X-Received: by 2002:a05:6a00:1494:b0:693:3870:edf5 with SMTP id v20-20020a056a00149400b006933870edf5mr33258537pfu.22.1697217014847; Fri, 13 Oct 2023 10:10:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 01/13] tcg/ppc: Untabify tcg-target.c.inc Date: Fri, 13 Oct 2023 10:10:00 -0700 Message-Id: <20231013171012.122980-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- 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 5c873b2161..5cecc6ed95 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) } static uint32_t reloc_pc24_val(const tcg_insn_unit *pc, - const tcg_insn_unit *target) + const tcg_insn_unit *target) { ptrdiff_t disp = 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) } static uint16_t reloc_pc14_val(const tcg_insn_unit *pc, - const tcg_insn_unit *target) + const tcg_insn_unit *target) { ptrdiff_t disp = tcg_ptr_byte_diff(target, pc); tcg_debug_assert(disp == (int16_t) disp); @@ -3645,7 +3645,7 @@ static void expand_vec_mul(TCGType type, unsigned vece, 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; case MO_32: tcg_debug_assert(!have_isa_2_07); From patchwork Fri Oct 13 17:10:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733243 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580290wrv; Fri, 13 Oct 2023 10:10:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1+O66VlUg5zliD5cRHwElzhdjLvEqrW+lNmxnXrzYdx8BFp8g4RMGmrfxpwu4U6IqYp/J X-Received: by 2002:a05:620a:1711:b0:774:30b7:ed93 with SMTP id az17-20020a05620a171100b0077430b7ed93mr32825385qkb.29.1697217057700; Fri, 13 Oct 2023 10:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217057; cv=none; d=google.com; s=arc-20160816; b=ZIergAyiCB7spsrXXIId/BYSAw7l5kPeLhZwFwOEY9KJu8Pginb0VHJ6WQZ6xM35kn LeoP8eNxGreCic3OaEEykxnrNHspm1I6GZI91UN2eMeK5ecqkEC+A4uMD6kB1MHSXLhX xlPbdEORwgouOtFa3/eFE9DzQaWL9QLKA+vP1Wj+x2w8qvJSFpX3I3HMl3AVvnkY6RbN LdpTwh7hjD4vwGtLujDcGCcvMa4u/W8P4GmkLmqu11MW5P1RYvmcTWQcq2t98BERFtlb iYmEsMQHazV8X7Fqaurk1aAMzSyerjwN2cGOJXzmED74fvqqjIWw69BWiJ095QO2CIOJ ZD1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kPve6f7zLeYUZnfvyB8rknIVGRQNk3b6m8Mg7HCCt/Y=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=mp6iv0UG+gRd/vQyQg4wp3eAqYkUYvgz/rCGUGZaMzSA4RrY/iXMy1TVYB7Iv2iyHU KU0QOtZK/1QvIeJ+K34IQYomKYjn89wj3La+ebMxo2MeN0aw59TyG+4y7O2JmVzJsird RszsGGinW6UiCeftrtt8iSw3bvCoXVARUD3rf8bkHOo4ORo+f7IdJuqs7yywF08VZBl4 LKtYzTMDe5gbQvGOD+zmDmci4fHTOxBhIKnr5YpmBc16XpzSW9++kJnSbWFgLHMpyd8t oJXa1rMBIHI07idNhD8XWJAqX3foPP5KhKyjdSy5LTno2iOHr7kUZlbVq19rQly/mDE+ gFRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Msl+ZWCw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w28-20020a05620a0e9c00b007772e76ffbesi1526621qkm.730.2023.10.13.10.10.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:10:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Msl+ZWCw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLg4-00010f-7J; Fri, 13 Oct 2023 13:10:20 -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 1qrLg3-0000zu-CA for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:19 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg1-0005UZ-Ng for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:19 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-57bb6a2481fso1235278eaf.1 for ; Fri, 13 Oct 2023 10:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217016; x=1697821816; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kPve6f7zLeYUZnfvyB8rknIVGRQNk3b6m8Mg7HCCt/Y=; b=Msl+ZWCw9E/diUA61MA/XWkW8wsBPWy/v6ueOOhlZoENWJn1bV0d9/vqJO1lA81ULf +JQ6NMh4d15N1H4wphJVSMdW7mL7Jz8fBSad1OWOQjP3HFkHCvNPsuuuHqhsnH5+evRT p+1uh0GiX4kHUj4RTxLTGyIu9BfslmQ1E2h9hylC6HZEcEeFqfiyYTo42+YXcl996Xp1 UN4jvKwE1Ct+Vb1M5lfximThX6Q3i1Bn4hgYCV3eLT4fc3V/NszpKHW+2T77IjnOqtR9 LRT0CVdGwRvVWdph/XLQXS0JGV4GW+lzObV6r61EtM+3w1K7Zebso6mZiluWpZiO1kIQ /M4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217016; x=1697821816; 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=kPve6f7zLeYUZnfvyB8rknIVGRQNk3b6m8Mg7HCCt/Y=; b=i0u0DgapUwi1xDcpAAxxr3+7X4doxyW5uDoKm6QtDF5GmXpilwXhg0chYLbBNEzurT Pd2liG/LQK5GOoL35Ok6Gq/eJiesNBryDO10n1AyBZbR4RZidJGibqo5dr+YJ5cIso7M t4dDrfXuchMWto+jy857VrgS/H+2a3NrP57r3Z3a7P1mzWABjI1emQRtzv38cuW3y1wh 1Zpb9t0TGR4TkMACv7XO7dLv2j7fHjzoIE4z3GqW/u7qve0b9hUNHe30zrtMus+a0j+O 7jbJNXlSnbHzmRi37z4SAaHcIFfDM7ulpPgT0UsIlqsZAO8GfXxxbreMCI/cVwDjDa3k 06Qw== X-Gm-Message-State: AOJu0YxbyG9YnQTmS8WWo/4cJKIvmNWJp2khZ31JN+G2xvqH/8yyeq/O wjJDYWFtNV3HrV8a5CP39Mov7czlePB81almhig= X-Received: by 2002:a05:6358:5e12:b0:143:9b25:c021 with SMTP id q18-20020a0563585e1200b001439b25c021mr16672897rwn.1.1697217015841; Fri, 13 Oct 2023 10:10:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 02/13] tcg/ppc: Enable direct branching tcg_out_goto_tb with TCG_REG_TB Date: Fri, 13 Oct 2023 10:10:01 -0700 Message-Id: <20231013171012.122980-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Jordan Niethe Direct branch patching was disabled when using TCG_REG_TB in commit 736a1588c1 ("tcg/ppc: Fix race in goto_tb implementation"). The issue with direct branch patching with TCG_REG_TB is the lack of synchronization between the new TCG_REG_TB being established and the direct branch being patched in. If each translation block is responsible for establishing its own TCG_REG_TB then there can be no synchronization issue. Make each translation block begin by setting up its own TCG_REG_TB. Use the preferred 'bcl 20,31,$+4' sequence. Signed-off-by: Jordan Niethe [rth: Split out tcg_out_tb_start, power9 addpcis] Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 48 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 5cecc6ed95..9197cfd6c6 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2509,9 +2509,6 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); tcg_out32(s, MTSPR | RS(tcg_target_call_iarg_regs[1]) | CTR); - if (USE_REG_TB) { - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, tcg_target_call_iarg_regs[1]); - } tcg_out32(s, BCCTR | BO_ALWAYS); /* Epilogue */ @@ -2529,7 +2526,13 @@ static void tcg_target_qemu_prologue(TCGContext *s) static void tcg_out_tb_start(TCGContext *s) { - /* nothing to do */ + /* Load TCG_REG_TB. */ + if (USE_REG_TB) { + /* bcl 20,31,$+4 (preferred form for getting nia) */ + tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); + tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); + tcg_out32(s, ADDI | TAI(TCG_REG_TB, TCG_REG_TB, -4)); + } } static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg) @@ -2542,32 +2545,22 @@ static void tcg_out_goto_tb(TCGContext *s, int which) { uintptr_t ptr = get_jmp_target_addr(s, which); + /* 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 (USE_REG_TB) { ptrdiff_t offset = tcg_tbrel_diff(s, (void *)ptr); - tcg_out_mem_long(s, LD, LDX, TCG_REG_TB, TCG_REG_TB, offset); - - /* 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); - - /* 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)); + tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); } else { - /* 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. */ 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)ptr); - 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); } void tb_target_set_jmp_target(const TranslationBlock *tb, int n, @@ -2577,10 +2570,6 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, intptr_t diff = addr - jmp_rx; tcg_insn_unit insn; - if (USE_REG_TB) { - return; - } - if (in_range_b(diff)) { insn = B | (diff & 0x3fffffc); } else { @@ -2600,9 +2589,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_goto_ptr: tcg_out32(s, MTSPR | RS(args[0]) | CTR); - if (USE_REG_TB) { - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, args[0]); - } tcg_out32(s, ADDI | TAI(TCG_REG_R3, 0, 0)); tcg_out32(s, BCCTR | BO_ALWAYS); break; From patchwork Fri Oct 13 17:10:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733247 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580472wrv; Fri, 13 Oct 2023 10:11:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7kHzRwpOyZw0NHZ6CyBf1WEkh+gANVATNc2AMnHTcDVFRvMjZ54wAo6/D0XOJDV73cy1B X-Received: by 2002:a25:401:0:b0:d9a:634e:5ad3 with SMTP id 1-20020a250401000000b00d9a634e5ad3mr9727678ybe.13.1697217077532; Fri, 13 Oct 2023 10:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217077; cv=none; d=google.com; s=arc-20160816; b=Y6Su07pC1Knt0Jr+4RV98weMoMS/biXSnl5t/uxWIrNU8tjk0rac0HsNjtNxPmv97z PtsBjXhTiHjnZH93oAiP1mHFEDjTPkJ1dCMJ1vRQDu9loseI5FHtQGX11+X7zuRK8qPB xwCma+ZFslZoKxLD42X5upRfjaI8M6p8FIjUVIC+ZQx56FfyAFXEGrrEuN05rEuWlJQ1 DxsHlU+f+ZNLlNGSfoqOPRcgjZO1TkcmWtiOu39Q4NdB3xR+h6bLaqpGXCIfxH6zkk2s +GYFachsVG2fYfshYXUtP05fOlRuakx5IHEgwF2hnYrHXT2aN0J6dRIPVkqTv4vM4c49 njEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3KCQIgln5kN/33Jyz8B+r1A500q3A4Jm4TEcmcp8vS8=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=KiL/o6FwI14m68QX+Z1pvwfPyUbrSzhsM6e1lDBEK9UI+2lGGZF2AbmRHl3JX7aKjg su+CyTYvSkVqFg7MJXX/Eun8fzPbrWAlpTG+1fX6Z+ARwFpnMWRUKcwcgBhLIVFxaHHL PDIS26uaAC+uYfzUj3wNsFGX4qxAgnS9oTpxma8b3GmjaHp4t7Bg8y9cZMzSqWCiBipd Kc7A7+PHDOCxyF9bc6bLUfzDy6hr2hyhEDDdMI0OPhfas8SS4eryVvgi45GmcRS62pnW lO7CrWpUmQBSS9vI23Yib7IiO0lbAY7KeGsEK+a7JDQKkuJ2mms2ec6ekYKEn5DJ8o0G OcCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mSF6ukjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dp4-20020a05621409c400b0065b182a39e9si1511247qvb.26.2023.10.13.10.11.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mSF6ukjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLg6-00011V-2C; Fri, 13 Oct 2023 13:10:22 -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 1qrLg4-00010y-LA for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:20 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg2-0005Uq-7l for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:20 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-57bca5b9b0aso1247018eaf.3 for ; Fri, 13 Oct 2023 10:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217017; x=1697821817; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3KCQIgln5kN/33Jyz8B+r1A500q3A4Jm4TEcmcp8vS8=; b=mSF6ukjJSoI/rQE2HH8nvfZtF3hRdPp8vUVL0pjnYpt/lGz+lkCfFfviRxQlE92U6D R14i+F71Fh1jB7Ct7vbl1exkVhkhrJfnaaRE0K7XRzCn7hD9bYJxbH/MP4plfSJGi/PV rICu0W6duTowOgOvBCmNVTMUdZYakkEKnvrHiwinJoOA2ftBmIzeQHSlBwxV37o/Hxyq drOO/rKpJ4iZaMW1Pn8BqhmA6DZ1WCdOYGCxrNOH9ZIgT9YxIKZkef5dp+YOmbMpDVdb U8b1+gGTKCqaSIZ9sLem6+PX2BA7mIS0B6xqgfmoPhTYfpu+Fv/D69iXxSAAJL6D9Mqu 8R6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217017; x=1697821817; 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=3KCQIgln5kN/33Jyz8B+r1A500q3A4Jm4TEcmcp8vS8=; b=pANTRh6j4iBMde/kZgh/Q1Ko5O2hzPz1g7tLnPBIYzUlV4Png1/a+S/8wPPwbc3Z4t T5xa1qhbDTCYlCiEsjlDwa9ZDXZ9ckz6/5XQrCnGltaHsskc8Zw+kOMJwpVOAf4oTdP1 QA7oz+7HvEurK9vxSqfgFPimiLXMsucIxujlmd6yIO6w3Ro8qIkATpraJrcBZs6ZezDA YTADLmXsUkREFqez70BE2jc0N9kLn23reVfIfuEMlM3bYpzkj/rHtwYlPIoMls0v+9zu NiERLj3rGSROf7usojJ+o8JRAsZVhafsNSUw5EtPPVc916c1VSU5A8x/lg53tZaBJWz9 Pkzw== X-Gm-Message-State: AOJu0Yz/8+gOqFIfJJ0idJ2k4/nzHXG+LlHVDE+hBWEbaRQJYLuS5NKa kGnna0/THmlCCmUiBHfFAk+Z86RqOaBDZ8bDXMs= X-Received: by 2002:a05:6358:63a7:b0:14b:d9de:3008 with SMTP id k39-20020a05635863a700b0014bd9de3008mr33549136rwh.5.1697217016841; Fri, 13 Oct 2023 10:10:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 03/13] tcg/ppc: Reinterpret tb-relative to TB+4 Date: Fri, 13 Oct 2023 10:10:02 -0700 Message-Id: <20231013171012.122980-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc34.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org It saves one insn to load the address of TB+4 instead of TB. Adjust all of the indexing to match. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 9197cfd6c6..aafbf2db4e 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -215,6 +215,12 @@ static const int tcg_target_callee_save_regs[] = { TCG_REG_R31 }; +/* For PPC, we use TB+4 instead of TB as the base. */ +static inline ptrdiff_t ppc_tbrel_diff(TCGContext *s, const void *target) +{ + return tcg_tbrel_diff(s, target) - 4; +} + static inline bool in_range_b(tcg_target_long target) { return target == sextract64(target, 0, 26); @@ -991,7 +997,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } /* Load addresses within the TB with one insn. */ - tb_diff = tcg_tbrel_diff(s, (void *)arg); + tb_diff = ppc_tbrel_diff(s, (void *)arg); if (!in_prologue && USE_REG_TB && tb_diff == (int16_t)tb_diff) { tcg_out32(s, ADDI | TAI(ret, TCG_REG_TB, tb_diff)); return; @@ -1044,7 +1050,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, /* Use the constant pool, if possible. */ if (!in_prologue && USE_REG_TB) { new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr, - tcg_tbrel_diff(s, NULL)); + ppc_tbrel_diff(s, NULL)); tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0)); return; } @@ -1104,7 +1110,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, */ if (USE_REG_TB) { rel = R_PPC_ADDR16; - add = tcg_tbrel_diff(s, NULL); + add = ppc_tbrel_diff(s, NULL); } else { rel = R_PPC_ADDR32; add = 0; @@ -2531,7 +2537,6 @@ static void tcg_out_tb_start(TCGContext *s) /* bcl 20,31,$+4 (preferred form for getting nia) */ tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); - tcg_out32(s, ADDI | TAI(TCG_REG_TB, TCG_REG_TB, -4)); } } @@ -2551,7 +2556,7 @@ static void tcg_out_goto_tb(TCGContext *s, int which) /* When branch is out of range, fall through to indirect. */ if (USE_REG_TB) { - ptrdiff_t offset = tcg_tbrel_diff(s, (void *)ptr); + ptrdiff_t offset = ppc_tbrel_diff(s, (void *)ptr); tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); } else { tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP1, ptr - (int16_t)ptr); From patchwork Fri Oct 13 17:10:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733248 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580615wrv; Fri, 13 Oct 2023 10:11:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHliM2xGUfOeEjaIDiiY/12B/dBvg59c784uLrwPqrJJkbbK02P72tmIyDXujhlxfuMq95d X-Received: by 2002:a05:622a:509:b0:419:7623:ef6c with SMTP id l9-20020a05622a050900b004197623ef6cmr33671642qtx.60.1697217093725; Fri, 13 Oct 2023 10:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217093; cv=none; d=google.com; s=arc-20160816; b=GOJ9d2wCAN29yr0GKVyeVnqrtAMEERs/+wv/5FfiyjJoggBGH4qN04tE0zlWwoa0CQ myp36g2NeyJZoEhQzKbJ6K2zl8ge5YLIAQSTx3nz4lJe9mlkQEjDfTay7kQelUvehtqU CzlpfNfiuvIS/buJYHIxCeD3MF2Fap0NzZx+ooQ9xj+ASEIhN97gE01pr/R5sIex2ftF 3T++9IomCkHlE3wxAThTRjw6dmNVDcoc+hF8RK1/cwmTt9oGbtzG/TEnn3Q5177rVM0V WeKimq4WW4RMPQU/Oz44BAHvliG6QnG49I/LuBdIEhO2PxhaRfWusha8RupLK+wA/6uY gEYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=wZcmnT7u6DHe3m4z52Q4vFvn6W5GfbM6IeM1Rl1CMksEZwXpSvrZP8QBOxcUxpYZL/ s8g1Jcv3mRGrLqB4ranBzEk66iMR8JSxe9tm7B0skLvv3Ln0Yt6ALQyP3YWYpseKBKLA kMd5sf7lYRpeSIyIjPRckhfU2f4V5PtDzXqCRFRNMWOm3UA0fU7xsdpAC5W4/OhGpi/s xY7/Kqa2sRCn52cF/XltOkzNr+tGfXd4YKpkRuwOmiV8ZXYB/TdDGEsOVbGTozawJSlT 1IZLAMEH6ip3nNNHReKM/pGEgJ/+TVzNErClm7467QS4mCRGDp7I8wIuOJi+l2GJH0o5 NtIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kLQarSCA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f17-20020a05622a105100b00417b8f534a5si1564072qte.365.2023.10.13.10.11.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:11:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kLQarSCA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLg6-00011e-Ny; Fri, 13 Oct 2023 13:10:22 -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 1qrLg5-00011A-0U for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:21 -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 1qrLg3-0005Vg-58 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:20 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-694ed847889so1976285b3a.2 for ; Fri, 13 Oct 2023 10:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217018; x=1697821818; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; b=kLQarSCAeMa9WTVKBTIjLIAec4jASN83fW3CIlzIqLifl5KA9P1jH5PFBKLO1KOR9p sAisUZlqxPsXAJSgQOZN8KvNUWw/W9zOLxWO7Qxt9O3kHm1gEASwj/0F1R0nQrO8f8J9 lfqoGX6+Q80x93NZZ80ZRq+AFaavdLdmM2c/OvAdfFmpVLxt93FkSqERpEM/E3djkHjj /djVQuY4CZMdh31TeO+nKRh5ca5v6c4btCd2diXZ8tw8rwEn4CRH0DWf5bTN0C43a918 7lcqz5E6mV6VZ7x3FeRa51oWxzWkC6z23A6zRbQRaJaJYSfvNzYoPeucJC1/IFqO53Pb rckA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217018; x=1697821818; 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=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; b=GfZ4bj243HPW9GEKZswwtj7pUg8QjqBejtnDpqM7wmYp7W4blEP8NunnVwGcUzHP3Q ViHTXMiQ9ehmXweDX32Pmc8kqR3KTbWKGscspmaYc2hwHR5/341/IajG3ZKaylIg4u/P 4Y1R3uEdRhp1gf2ftdTlKx1GnuCo7bcn6VzgcUCV5UiEzHiyV8Ay07HIM5nDjDRFJL8T R2k5c7qKJsAxwFxafctCV5vpb8S3VwmRyAl5BcuYXRwNonXOsCrXcsr1qutF4gIIjtA/ FGv5XGyyNEGedlICNZ0sXAl0oRuVNRMtK/P+aD0F38bB7lry4R3XIBHmMN2punC7QBg4 /Isw== X-Gm-Message-State: AOJu0YyoVDkI+IhHp6UkbTaYLRi2j7y7K6ZEtRUqhRdxq82B7k7EPRF9 R786T7Xuf3xa82Jsgx6UjXVWZ/zX3jKwhn+2c7A= X-Received: by 2002:a05:6a00:80f:b0:68e:36b1:3d7f with SMTP id m15-20020a056a00080f00b0068e36b13d7fmr30899402pfk.18.1697217017702; Fri, 13 Oct 2023 10:10:17 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 04/13] tcg/ppc: Use ADDPCIS in tcg_out_tb_start Date: Fri, 13 Oct 2023 10:10:03 -0700 Message-Id: <20231013171012.122980-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org With ISA v3.0, we can use ADDPCIS instead of BCL+MFLR to load NIA. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index aafbf2db4e..b0b8cd2390 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -362,6 +362,7 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece) #define CRNAND XO19(225) #define CROR XO19(449) #define CRNOR XO19( 33) +#define ADDPCIS XO19( 2) #define EXTSB XO31(954) #define EXTSH XO31(922) @@ -859,6 +860,19 @@ static inline void tcg_out_sari64(TCGContext *s, TCGReg dst, TCGReg src, int c) tcg_out32(s, SRADI | RA(dst) | RS(src) | SH(c & 0x1f) | ((c >> 4) & 2)); } +static void tcg_out_addpcis(TCGContext *s, TCGReg dst, intptr_t imm) +{ + uint32_t d0, d1, d2; + + tcg_debug_assert((imm & 0xffff) == 0); + tcg_debug_assert(imm == (int32_t)imm); + + d2 = extract32(imm, 16, 1); + d1 = extract32(imm, 17, 5); + d0 = extract32(imm, 22, 10); + tcg_out32(s, ADDPCIS | RT(dst) | (d1 << 16) | (d0 << 6) | d2); +} + static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src, int flags) { TCGReg tmp = dst == src ? TCG_REG_R0 : dst; @@ -2534,9 +2548,14 @@ static void tcg_out_tb_start(TCGContext *s) { /* Load TCG_REG_TB. */ if (USE_REG_TB) { - /* bcl 20,31,$+4 (preferred form for getting nia) */ - tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); - tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); + if (have_isa_3_00) { + /* lnia REG_TB */ + tcg_out_addpcis(s, TCG_REG_TB, 0); + } else { + /* bcl 20,31,$+4 (preferred form for getting nia) */ + tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); + tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); + } } } From patchwork Fri Oct 13 17:10:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733250 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580861wrv; Fri, 13 Oct 2023 10:12:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkk+DPylYBWuCtG8y5TNL0o+WMQXKocxceAu+TU9akwB1hJaWSmsgUs0RRlEfMnNaUvgsX X-Received: by 2002:a05:620a:2807:b0:775:dabd:a234 with SMTP id f7-20020a05620a280700b00775dabda234mr22465020qkp.22.1697217124780; Fri, 13 Oct 2023 10:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217124; cv=none; d=google.com; s=arc-20160816; b=XI3BnOyj6hFnPoRulxD/LOUtwJxwSJ2N3JHQ+zBKrZYQU9QvCJrcXiKMkLIIKvFxIp KJ5iiGjdU2jYr1H45+k3yci1aXgnlxfLo/gfIKZxHTVwDF/Pumt+kBoK6qdMhrTc6FAU jcmciwMhBLL1fHbBjmgwsyoOADpUZXSTy10dlMDU38TYHAF1KXOm8TZH8nR+ZtPYUZrG Djw24Co/Fg7yg90Aimvbnwe4q0jS7smej9dPt5yLUUKNDZAaf81BpQlq5qyWgnF0QH6Y C+/4BsyIv0AsOFAHf6eOeZx1W/z7UI2uAXbOeWeZM4+jdIV4ydkUiQu9Rbsu9ivCRdLu ULMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kj+TKk2K3WfpkaNPPr/v3KoLmzqb4EREhy9sjMrwx20=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=gXclh1oFudeUZYeO02IVGu7hTpjDgz0KDUc7m9Pl3kp0VthxSfSiTNiysqHZoJe1+G z60i4pS/PhJXwY2UjhjAzR3VnZ+bTss+8fxdYq0Ax7A383sUqIM6BqRgTyr0CQf9YOyt PjoI8oakGHEphzwCc5DZLm4SShHY0Tcx+LiQ567Chrbbl5hiOo3IjknNI8Brsje2AmbH L9a6kUFpSl+qpjGG1TvjC8C6lWv6b70VRKjeHP3FvvHYSUvd9iEpVOYcQMQnyf8CAPwU ZbwArtwLQMaEV+96Mve7cNpKZJt3P+d5YYle43v8pvzBN4sTqEga8R09FQRCq+a4EH8/ QImA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oyLZph0s; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v5-20020a05620a090500b00767e30f501asi1460174qkv.402.2023.10.13.10.12.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:12:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oyLZph0s; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLg9-00012d-5u; Fri, 13 Oct 2023 13:10:25 -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 1qrLg5-00011U-UD for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:21 -0400 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg4-0005WH-Az for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:21 -0400 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-57de9237410so1347857eaf.0 for ; Fri, 13 Oct 2023 10:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217019; x=1697821819; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kj+TKk2K3WfpkaNPPr/v3KoLmzqb4EREhy9sjMrwx20=; b=oyLZph0s1SsBApL+WE+gnP7CIwPCHfkET5XodyOJ1+AiPrffQPGTRedOVQYQz70bfc JaSc8qiQ+H2loq8oVSBd6oJwoyBlvAGPxLATmw+chU+9RLNeUYaBE5U9CGzTMqN0CXiY hm8MwcAWOJxHebDsa5QfnaKDvdZd5b6zUA7ug1MKiB8vgbhwPOoXivjVGLCMLiJ+6apY AzipEAbhqeRvAeEvVxhy4YWvbKk9U99rEGDcKReN5wFfg7i4U23WWaWl232T+FO5F/bn +iMyZoBo5ezhwqoI2QzoBxqFBDiKysPA0X3/GMDZak7/IqIgkBDBipdicdGgHOPjJcaX 3AmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217019; x=1697821819; 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=kj+TKk2K3WfpkaNPPr/v3KoLmzqb4EREhy9sjMrwx20=; b=Hw8cA2E0PcT4Kbdim9U+TtnK08GcRoQ7gRrPpppjNrCDv5g6oPfK6kLMrGiVAXGVGI 1YGVNgTiEOAkCy7BibJcOefgNswN6hzl3JAMiBQ7of1oULPcEjs17ARhE3hFb8nzSdeo cMzXthBGbYdshHktmsRyM8DywhtSkwhh6d9zSz1pipELsV4hZ3G78/fBLQSrI0S7CbKY r9ffe3g5gfIKeCcERqype/ElJGe7T++wmmLPynYpE+to5leRIKdT76X95ULntyICO9Ew /eZdzmH9SWdEw+6/o+skyuCKtLJ07fFEWXQMJj/nkvcLjiP5Hix9WkJWdLUAPUly20kQ 8y9Q== X-Gm-Message-State: AOJu0YydIpiCjCXb8j+OcPJAwzz0eexYWkTJH29S5qhNcTj4hFD2Yc0z Jz/0ih8T1RP+bIe9W4H69/mqtG+UGQNnR5JoHZI= X-Received: by 2002:a05:6358:918c:b0:14e:28f9:53fd with SMTP id j12-20020a056358918c00b0014e28f953fdmr26230096rwa.15.1697217018805; Fri, 13 Oct 2023 10:10:18 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 05/13] tcg/ppc: Use ADDPCIS in tcg_out_movi_int Date: Fri, 13 Oct 2023 10:10:04 -0700 Message-Id: <20231013171012.122980-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index b0b8cd2390..226b5598ac 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1055,6 +1055,19 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, return; } + /* Load addresses within 2GB with 2 insns. */ + if (have_isa_3_00) { + intptr_t hi = tcg_pcrel_diff(s, (void *)arg) - 4; + int16_t lo = hi; + + hi -= lo; + if (hi == (int32_t)hi) { + tcg_out_addpcis(s, TCG_REG_TMP2, hi); + tcg_out32(s, ADDI | TAI(ret, TCG_REG_TMP2, lo)); + return; + } + } + /* Load addresses within 2GB of TB with 2 (or rarely 3) insns. */ if (!in_prologue && USE_REG_TB && tb_diff == (int32_t)tb_diff) { tcg_out_mem_long(s, ADDI, ADD, ret, TCG_REG_TB, tb_diff); From patchwork Fri Oct 13 17:10:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733242 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580287wrv; Fri, 13 Oct 2023 10:10:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0JsPc8lUEG+ZEYKM8VtZNFxv/j/zz+1exzZnHfxtSnU2dwGaeAaMqL7JSDFEkkuLvdms6 X-Received: by 2002:a05:6808:315:b0:3ad:f6a2:cfe2 with SMTP id i21-20020a056808031500b003adf6a2cfe2mr27066567oie.22.1697217057338; Fri, 13 Oct 2023 10:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217057; cv=none; d=google.com; s=arc-20160816; b=roODz3fVmsrlGfjv8/q8e5ZkRtUg+z/Azl2HtzhXK90jUIrxzj/OgO+nLUDGcZXHeP +BLv5JQJQmHRCvagmmdNFik3S/VLC0xJJkqebwYrSrhaAmglo1IFLmouWYMBGqGQg+4Y 5We9ww7zqVlY9HTg51Bneit26j9FFAEsp+SwoJj0Ap94Fm6RgjWnJwH4BEVuod1OHwqm 51LuJ+327bRdzC4ODbx/v0NpMaaZxTRcgEDJ5IsL+yj+wW0MkEMkukG1b+rBmtScSJoy k+yz8wiyvgCQqW3iufIprxmDtqHZFS6EpxAhB/U+S56hsEJ4/kYL+yIdd3BgAloWL3Nt Y3ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8BGO0/K3CdguLDzJsds4aGoMbgLTr4W7qQjeN+mh4IQ=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=Ct/cMaiDoJFXmZRCst+QCQxGFf6CpfMryjH/paTbM5ZbXXTZWdsTyxIrWarX8O+chU JxL6lzZ4xKg5yLIb1nN4DYnIG168XoI666GlDnAUk2IRfOm2jn8VKly+V17r+lziN9pE EBNUB2N0yddK6Ac1Q25bnKf+VkFbovtDS2p15AHCjTu87UcY0vKveLA76w4L+2XvGwXD ZiGvAlEdwwanPxD94iEOpTKh/z6BL56cu3PrzIKjzqlRzeulYSkkm+4pNXxdjcut10O6 ddBGvjKa9q2r5nRjZk93bg+Ee940uynOddobMZseZODZ57jPBlKDiafdZLDIaPYSE6CU Z2TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DA7EwFWv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ea11-20020ad458ab000000b0066cf62213d8si1499263qvb.58.2023.10.13.10.10.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:10:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DA7EwFWv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLg8-00012Z-OX; Fri, 13 Oct 2023 13:10:24 -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 1qrLg6-00011j-JC for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:22 -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 1qrLg5-0005Wj-1a for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:22 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6b5e6301a19so438315b3a.0 for ; Fri, 13 Oct 2023 10:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217020; x=1697821820; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8BGO0/K3CdguLDzJsds4aGoMbgLTr4W7qQjeN+mh4IQ=; b=DA7EwFWvPTveAT8EjFkH4HFwsz15k7mWS8M+VkXfqNi0B+kgH8S0EXhmit33a1KM5D vKRH5lALYeiT7x+6gskgmz9TNR03kBETF4ULNyM3HcwNK37TL2GGA59xnjI2DaRuQPVi 28aQuLRRq8DpKJYb8wuoJ74HZwx3p9HASzmpwK4SIEuTd2LRwsc5xdhacdkMgqHU4cw9 H1Gx0CTOYOdI1lDn4gD27KcaqDNEelgNKgxNHL0MFvKgyoo2hOy1g5KjgOe4P7cUGX8R pWHR5PL2dK5cAI5KJJz5Fh7CTMpjBb8lZCc6XK/HkJ1XjD3byZisZLiUBoqTzby4NhVp 7HeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217020; x=1697821820; 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=8BGO0/K3CdguLDzJsds4aGoMbgLTr4W7qQjeN+mh4IQ=; b=KKRkon8aEx23hHfOBVX4DdagjaT2QMF8CefVxGBZ7x5gyRZcF9Kxx1GEc3EY4N4N4u LkHtUsO23rLe7z50vrq029f6v/8sdwebrFFt6pFW6kJcHT5ZYxhBsYWPC/5RXlo18JO1 0MMXSeZx+nAs++jio74A+xabrBQEQBL8pYADF9szUHu8fB/13uzbO9Pj2LB71AbLd62p wEpL4gnoAXZIIpdcECaiCAeD+oYNkM3UKcIOvPj3mpDKpIaMBJ6XpIdWLZj1eiRUPgZ3 YPouF7snUg0XTx7vFqyMu8xYCxWX8Zh/Cq4gOyU/cisb2OKqIfO/2daLP42dycEET9LE EDjg== X-Gm-Message-State: AOJu0YzY56A6GYrAQUoHK3xbe8n1VohF3erynAa/z/LdbG3sqLb7M994 eKYSAVqbpYB0r3qMlhNgtyIpeif9/Pv3wlRNbi4= X-Received: by 2002:a05:6a00:9392:b0:6b8:69fa:a11 with SMTP id ka18-20020a056a00939200b006b869fa0a11mr252839pfb.12.1697217019756; Fri, 13 Oct 2023 10:10:19 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 06/13] tcg/ppc: Use ADDPCIS for the constant pool Date: Fri, 13 Oct 2023 10:10:05 -0700 Message-Id: <20231013171012.122980-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 226b5598ac..720f92ff33 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1081,6 +1081,12 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0)); return; } + if (have_isa_3_00) { + tcg_out_addpcis(s, TCG_REG_TMP2, 0); + new_pool_label(s, arg, R_PPC_REL14, s->code_ptr, 0); + tcg_out32(s, LD | TAI(ret, TCG_REG_TMP2, 0)); + return; + } tmp = arg >> 31 >> 1; tcg_out_movi(s, TCG_TYPE_I32, ret, tmp); @@ -1138,6 +1144,10 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, if (USE_REG_TB) { rel = R_PPC_ADDR16; add = ppc_tbrel_diff(s, NULL); + } else if (have_isa_3_00) { + tcg_out_addpcis(s, TCG_REG_TMP1, 0); + rel = R_PPC_REL14; + add = 0; } else { rel = R_PPC_ADDR32; add = 0; @@ -1164,6 +1174,8 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, if (USE_REG_TB) { tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, 0, 0)); load_insn |= RA(TCG_REG_TB); + } else if (have_isa_3_00) { + tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, TCG_REG_TMP1, 0)); } else { tcg_out32(s, ADDIS | TAI(TCG_REG_TMP1, 0, 0)); tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, TCG_REG_TMP1, 0)); From patchwork Fri Oct 13 17:10:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733252 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580956wrv; Fri, 13 Oct 2023 10:12:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPsR1cm+Vzl7Jk5sT/8Xnp+JHP7iqLmjdxrVgYO0I7cF6iHb0xYrSR8FM5w12sGapGvft4 X-Received: by 2002:a81:7c04:0:b0:583:d9dd:37fd with SMTP id x4-20020a817c04000000b00583d9dd37fdmr27234571ywc.31.1697217135371; Fri, 13 Oct 2023 10:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217135; cv=none; d=google.com; s=arc-20160816; b=VjorI2DivOTXPsl7nQsWxF+mcsRNYYIS+msby5SC6U9GIajILhaOYqNryAZGWua3KZ wjsxBOzU53umLiVP98OMQsSkuIIcG+sdZILPKq4Dwau/PSuionLNkukHqMSfTJI+E+JT 64XlVwjVXkmcrgVt68z98Dmb/KuZApQiLwOvuq7y9JfU4Rik+6+3WoScsstxF70Wb+7z TWyZVMhP3P9V1nwizxp6hO2R6v1mybLZxfvlv4RJDh89PWsl2+ozvWfBaY88gUF4D6L6 R74I/TLkeD5DVWtbLE9T5PDxjAtKIj9VHIh4oczXtOnKtpUmSuzf3HchI9Z/gq4c0uPM N6uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O6ypWKYmP3E0vSS+zdR/mRhAnNRJOT7ENlr0UKfEKr4=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=bIxyJI/fn1tcdv7iDwqk7NI8qfIcvB1gnqz/h7Wh5hSBI8Jr8w4bGjora5iFjyLIsD m9U928ekjQg0G3EGKwD8f7v46KaiLENl4x4sPgjoy4jWCLLM5BDhD/8juO9Nxr3Q95Vi FHP4xgT6D1x8eZWaVs5l/A7K7tRwVW+sOFWkSNO1MZL0Ps9LF1bqEXgyGDE0zbCsoIDs xYYBiU+oShxTZP0r+WuogfTDIVmSqQuOm/KDCSK/UGmMqxmmyYmb/teT9E0a8RaGwK3S mwpGR3o6X820bXiAkb0m8RSDXBHjoIiV1fTwqm4KSKjoUOxEIzBF3QCDunKM3m+PdJAA dDYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S0f9JsuO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w6-20020a05620a444600b007756e742c01si1577878qkp.265.2023.10.13.10.12.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:12:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S0f9JsuO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLgD-00014F-Dn; Fri, 13 Oct 2023 13:10:29 -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 1qrLg7-00012B-1F for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:23 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg5-0005Y9-L5 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:22 -0400 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6c4fc2ce697so1565563a34.0 for ; Fri, 13 Oct 2023 10:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217020; x=1697821820; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O6ypWKYmP3E0vSS+zdR/mRhAnNRJOT7ENlr0UKfEKr4=; b=S0f9JsuOtosawzF3qrXkxTbcA7TuGVMP/hf/BWEuUfcu2mHAiorMSU35QOGg26I2CA 8cxjPynzuGVIxRR1+W6CbvEmnDm7H068Hz4tUCRj2WhUlWkY3H6GBLERs4TtASceFO0L 1eg7aZZ2uG5WrXaD74JwFX187jnS7W/9N9p2CnvDjvUah01pL4fuapMSkrf8oXEzpowm 64cP0tAdUOG0hBll3ycb59CbIz7bSf+LT7TuNd89MlLVjkfDMXmDlJxCmTWu3o24ONAY RAXXWXkZeVMMOvUlSYi6f6se8ZSLYqJUNv4lVmupWLlQsUPh3+10uO4X/d9GYK0nlpe2 D8MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217020; x=1697821820; 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=O6ypWKYmP3E0vSS+zdR/mRhAnNRJOT7ENlr0UKfEKr4=; b=LG07yoJCFI5pMPOBcmleEZxG7ZjRlW8upWfPiJ08QPJkec91GxR+mPt4IV+kvB0UId AmTRz/Zl8Ni9PJwQoGT2IcKwGPw1ccOx+pQehatQKNQizDgCBk/ch7bNWScCa7UAjOHX cU7foue8WLd3STBwyPYU2Jgu/7r8FCSlKeR07d1CMn2SVvjBqF6NWp2SAi1XyzefSITk 4DhyQOXQazDPcbvFp4BgDE1+3HTkyQdWhM2gGmZOW16u3IwIo2VNlHV6YtkAx8AbW4TA eJaeLd7iHs7F6AV1qQaA1gUxXaNAzyjjZVqDNpsEdIJO/NopAWQdLiVh9BZnOJo/I7wD w/Kg== X-Gm-Message-State: AOJu0YzcpDlu4XwE7T88C4EbdHBAU7gMHN7ugHcxdHr2CCkkjW+6/ftM ERjKGdN1r2CKb0mEgAB+Z5wbtkqOHlSHRpfoP8o= X-Received: by 2002:a05:6830:12d0:b0:6b9:8357:6150 with SMTP id a16-20020a05683012d000b006b983576150mr28231659otq.35.1697217020533; Fri, 13 Oct 2023 10:10:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 07/13] tcg/ppc: Use ADDPCIS in tcg_out_goto_tb Date: Fri, 13 Oct 2023 10:10:06 -0700 Message-Id: <20231013171012.122980-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 720f92ff33..6337b1e8be 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2593,6 +2593,7 @@ static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg) static void tcg_out_goto_tb(TCGContext *s, int which) { uintptr_t ptr = get_jmp_target_addr(s, which); + int16_t lo; /* Direct branch will be patched by tb_target_set_jmp_target. */ set_jmp_insn_offset(s, which); @@ -2602,9 +2603,15 @@ static void tcg_out_goto_tb(TCGContext *s, int which) if (USE_REG_TB) { ptrdiff_t offset = ppc_tbrel_diff(s, (void *)ptr); tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); + } else if (have_isa_3_00) { + ptrdiff_t offset = tcg_pcrel_diff(s, (void *)ptr) - 4; + lo = offset; + tcg_out_addpcis(s, TCG_REG_TMP1, offset - lo); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, lo); } 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)ptr); + lo = ptr; + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP1, ptr - lo); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, lo); } tcg_out32(s, MTSPR | RS(TCG_REG_TMP1) | CTR); From patchwork Fri Oct 13 17:10:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733246 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580471wrv; Fri, 13 Oct 2023 10:11:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJ4NHrIyAyNzEKRYoDz5t9eDeVsPGYpQ+ymqC23oYNRK5Kuzd53+KXp731HnrknDQt3vGW X-Received: by 2002:a05:622a:130b:b0:419:a2c6:8207 with SMTP id v11-20020a05622a130b00b00419a2c68207mr34072192qtk.22.1697217077550; Fri, 13 Oct 2023 10:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217077; cv=none; d=google.com; s=arc-20160816; b=XnlLGZpl6Z3kzhKNPqccHdz+9G/xqJcLJm0YbIP0qpZZrPbxq0NJJSsd1y0kXlKa5d B7gIux2rSxbh69xsLOmdB4rw1pGDB1732qi3jBmjZyedEiW48h4Fe6g8b2cEGaj04bKo E8+ag9YL2CDA6Sd1ldUz20HXGwSyPQoE6s8PfODbmsY197+/GzKzmFu0T3I0Up2cUWpP G8cyasWq6XZoDIrUA1xtONVlU0eIrXjyAduoxU2kVRf0iClo+oBLUb0RKxDMt4FdKYCP aE3JJegrm8DN/sqn7gzVwuh4yyzcHEZs8umCUmqjTAWIK167qr+jYSC2m4+F8qIOpda5 2jSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IcT+t2NWvvAgl7ag7U9fcr97JnnF4drB4JEVTRDmT40=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=zi7rMAPJi66g5GLliOALUbKbHIE/vQfUqRL9mYH/vOvlXB50C32IEvQ6H54p1/61Or NZXDWXE/Ru2JUcm4FcQhVxPuDGmr2MLkVcy0Hm94b8ozdyFsMBp6eTtxeZuhkLhnp5ck sjgmTAcX/Zifgc9YDSaQj47PiTKFwMevO0cPBSNYtJezB1Zs6+uya/2gd1h23sXsmW2I VHf6y9RXE6uXo8AZY+vn6F9o5tHH9Vo40Sk94BKGRn/+gvezIi6zvx0gtVzvJrpk/cb6 oxkbkP/BTh8R6WMZTeGr+Q+h7lq0Swup4LJY0FxxVkk/8UM2rsW4uxXBrfv+t20m9h2O IKHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=avUC1n5x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f17-20020ac87f11000000b00410a08b3c74si1518212qtk.278.2023.10.13.10.11.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=avUC1n5x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLgE-00014T-E4; Fri, 13 Oct 2023 13:10:30 -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 1qrLg9-00012v-8b for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:25 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg6-0005Z5-KP for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:25 -0400 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6c64c2c0f97so1450633a34.3 for ; Fri, 13 Oct 2023 10:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217021; x=1697821821; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IcT+t2NWvvAgl7ag7U9fcr97JnnF4drB4JEVTRDmT40=; b=avUC1n5xIFxvVBI3cqnRTaM16sDJ1k/p0KQHvrm91rg1VZPKdJaVj4IlzAv7Ma4KT/ z7WRO4QKXKpJHsv5pS2FncDhnmuTR+aXkYzHDfNzs1/mmei91cRjn6nqsk2m2bJm/gAM lO7HYyTIytfyZV9bwWSzcOBPsVtZktaLIQgKmta/ibDxQieDviMNAOxiLvlJQJh5MIh8 9D/mvn/1bCeCjYcA6oLIDkn2PBRLcPIv0LWqYvoUjQtU1dTPvq9chWHsA4H1t53GTLFs PRIaqs0ihrTAvcn1XI0fBfBRk5VStRe9OzqQq1io6IDxFUHXt1BoF+g6MOB7Nx4dRlvE z4SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217021; x=1697821821; 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=IcT+t2NWvvAgl7ag7U9fcr97JnnF4drB4JEVTRDmT40=; b=M4u8oAGLAtFAMUVlTV6LwBPEPRphmltNXggaza3Z+LcHiXfbhwVz63Q6YgL4oGT0nK 9hdNGToZZpya0Rln97ccwjJr3VNp4VSyfxOR9Hi/tA2syex3E87gT6rbHXwN8X86zXOF g6YElC6Hw+eZjJunES5efmxoX1swJyOFwvW1PVvH2nPmPotkqbI2fWksfjAMmQ6QrdHS +pixMLx7fN7qgRyMxlfghyk+uN0vpWw2fJK7ywempcirCvFsEJJE/rVuYcSjSLeRuLRE /v0RrqZsLKDhiWyClnA9Kgq+ZcjnHM3E3aLMtlUsGHIprcGYN3riFhfEF13Dnf+/VClM wNkg== X-Gm-Message-State: AOJu0Ywt7FiXpe7cX1aVmlNf60HkLyNAOMVe5LZntWKxKmzNK6MdRQQb RjkS5sGXGQi7+Mc9RuZFUnAziEFeGcQyBBuJP4k= X-Received: by 2002:a05:6830:1d81:b0:6bd:db8:db with SMTP id y1-20020a0568301d8100b006bd0db800dbmr27658077oti.32.1697217021555; Fri, 13 Oct 2023 10:10:21 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 08/13] tcg/ppc: Use PADDI in tcg_out_movi Date: Fri, 13 Oct 2023 10:10:07 -0700 Message-Id: <20231013171012.122980-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org PADDI can load 34-bit immediates and 34-bit pc-relative addresses. Reviewed-by: Jordan Niethe Signed-off-by: Richard Henderson --- 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 6337b1e8be..f4235383c6 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -719,6 +719,38 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, return true; } +/* 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) == 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 *target) +{ + 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 = OPCD(1) | (2 << 24) | (r << 20) | ((imm >> 16) & 0x3ffff); + i = 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); @@ -1017,6 +1049,25 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, return; } + /* + * Load values up to 34 bits, and pc-relative addresses, + * with one prefixed insn. + */ + if (have_isa_3_10) { + if (arg == sextract64(arg, 0, 34)) { + /* pli ret,value = paddi ret,0,value,0 */ + tcg_out_mls_d(s, ADDI, ret, 0, arg, 0); + return; + } + + tmp = tcg_pcrel_diff_for_prefix(s, (void *)arg); + if (tmp == sextract64(tmp, 0, 34)) { + /* pla ret,value = 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 == 32 || arg == (int32_t)arg) { From patchwork Fri Oct 13 17:10:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733253 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1581061wrv; Fri, 13 Oct 2023 10:12:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1o+uJ6Vl9BPOSjIgtkYQh+rSvGhY60vaj6C20yorY9FPLtrfOAMhlrum9e3za+PTwDfCZ X-Received: by 2002:a1f:4887:0:b0:493:3491:ce89 with SMTP id v129-20020a1f4887000000b004933491ce89mr20393497vka.14.1697217149117; Fri, 13 Oct 2023 10:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217149; cv=none; d=google.com; s=arc-20160816; b=qZ9BBEAOw0tiVtu44EOHg+C4ihzcA9a604zAgcNSktfDfE2GWtGw+Txkrw8js+BD85 unlzKwI4gtiia2XUg20mLsuBMyKiy+dE88yibF6J3ZKxD3tYfWO/JRgcGFDW4vd1JY46 U6ydb5E9Z8rJO6urw1plm/EDFb+AZGPGWSM4Fe59ZQYE4V0ZhEQ9XDvxNla+feWccULq TcKsUIhUi4zhqScSlLLcrFM7azIPSQ0jN8+WSUql66UoCgF0A3mYKZ6FzcrKBDohGHB4 40wEz6GakYc5BBpwWaOF0GtDjlYJeel9GI9llB5Qjd9GSe81noTcEeZ7nWG5GbxXc8wq yLAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CnIEHz3YbyZLNAezqFGknAR6TwEjyjNQhE5DMYmjFw8=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=wP2xqmDnvIgDjB3l2qFrDo7grR1DWMGSz5c9DSwRxPfOjGRq7DLHr289dNCDLRoIdh ybxk1JQQQn7pxdljFXa28NrYpwtDCOF+HBOEylKKc5rLYFllxRw6n4vgc44Gtn+ejMPu aNndhfYgaBlSlNBlkef60TFF1T1iAu2klM+x6GKg5t+09LE3/WkbXS2T0Q0Lgcw5xDvt rh1q0XnGzeMhHQS2QiHB3Nhv+3jOzONXY3SsaZMstfzsSinul5fBBGOo8yzdpEAaFZC2 +ypzTZWNtOXJwJUaD6QMPH7nKPBKioh0r6WdP1/dtS16aA/Lys96Q56bCxTPvdxaGB1X Fo8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YjHc5EKI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v13-20020a05622a130d00b0041982b697e0si1532679qtk.627.2023.10.13.10.12.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:12:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YjHc5EKI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLgF-00014m-5n; Fri, 13 Oct 2023 13:10:31 -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 1qrLgC-00013a-8g for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:29 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg8-0005ZS-Iq for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:27 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b1ef786b7fso895664b3a.3 for ; Fri, 13 Oct 2023 10:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217022; x=1697821822; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CnIEHz3YbyZLNAezqFGknAR6TwEjyjNQhE5DMYmjFw8=; b=YjHc5EKIzlAKXdwsmYoGJJeweaOz9OY+WRjr++v9UtRNEH4UV1Y6xJDyYtHnEQyNbS BapU8UO9sRdjNXLf3GF01iHdS7ici+aznar6E88fXBPdwKVeyb3pv69TKokdKpcDrk3g cLBihmyUR82sEbTPZKJB80vNH1qnxJC+3cDLiZKxiJQ8e1GPVRBeHEu0xVjA7OHShAXh rLIJ3+lYOVYuZzXXdx2U6WeNTn0I55ocSg84g2BWi4tRAZjCekuzzqluvZlrgUR0mkk+ EEWtGOx2RDvxioWN6w8iqsvsEqk9HAs2uvnVdIkVoQ1H67GrfwpTGJp7k+awQZiKtN5I wfYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217022; x=1697821822; 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=CnIEHz3YbyZLNAezqFGknAR6TwEjyjNQhE5DMYmjFw8=; b=N9WqsynbZoe9PWi/fmEEAeg3G08IyjYwGRA43SYbt0F42oLuKF4PU+Y3o1m+pxkt39 wPAYuZ0UEDB49pI7ZQdViD2aEQvrZV5hloEWQsAZT4EgZandJUs3uZbvWgw+UgCcd23m cFV5Qb5+uHzfGPfMOxQDxcBLwvxnqkPTQXZEfYDpv1YdFhvFZGB3s8cHUV2FWJ89KU3O qo2aNXJL18t7XPdE3FvgJpSOCpKpcVEi8iXt1dNijKv4MFFSY4Xy6Oo9zs9eAB2WClK6 4uzYq5QpHIDqfeB1CLRZNKcG6kR3lShtYT2ClxJepXbQT95wCGKM2HbcehhdIePPYG9C FH2w== X-Gm-Message-State: AOJu0Yxpt9T6uAp8AwPaR9acMkVUZoCjjri0tVJaZwRtd6dPl5uqHwN5 QtzDKzAoRXDtxXi02kUkTpJQ2f568jTFQSmmC4k= X-Received: by 2002:a05:6a00:230c:b0:68a:6305:a4cc with SMTP id h12-20020a056a00230c00b0068a6305a4ccmr32520294pfh.5.1697217022487; Fri, 13 Oct 2023 10:10:22 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 09/13] tcg/ppc: Use prefixed instructions in tcg_out_mem_long Date: Fri, 13 Oct 2023 10:10:08 -0700 Message-Id: <20231013171012.122980-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- 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 f4235383c6..34df9144cc 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -329,6 +329,15 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece) #define STDX XO31(149) #define STQ XO62( 2) +#define PLWA OPCD( 41) +#define PLD OPCD( 57) +#define PLXSD OPCD( 42) +#define PLXV OPCD(25 * 2 + 1) /* force tx=1 */ + +#define PSTD OPCD( 61) +#define PSTXSD OPCD( 46) +#define PSTXV OPCD(27 * 2 + 1) /* force sx=1 */ + #define ADDIC OPCD( 12) #define ADDI OPCD( 14) #define ADDIS OPCD( 15) @@ -737,6 +746,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); } +/* 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 = OPCD(1) | (r << 20) | ((imm >> 16) & 0x3ffff); + i = 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) @@ -1418,6 +1441,49 @@ static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, break; } + /* For unaligned or large offsets, use the prefixed form. */ + if (have_isa_3_10 + && (offset != (int16_t)offset || (offset & align)) + && offset == 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 != (int32_t)offset || opi == 0) { if (rs == base) { From patchwork Fri Oct 13 17:10:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733245 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580399wrv; Fri, 13 Oct 2023 10:11:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwr+md7NlUacjkjQZNXWBfW3dVeZTT4N/qqtYIGvABtEMJjcwWXlEl0A3+fmvUARbc1oka X-Received: by 2002:a9d:6a05:0:b0:6c4:fc45:8681 with SMTP id g5-20020a9d6a05000000b006c4fc458681mr28632929otn.25.1697217068497; Fri, 13 Oct 2023 10:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217068; cv=none; d=google.com; s=arc-20160816; b=azpidPvYbmAjNGKafEagoKcj2SOlEscEbu8PkYliwGtcd8Sr4FCcGR+pdAAhdOIwwm t+DCQcDR14qh1R6tnKGJbEC6ptbvNBpim0m/zolJ5Uppey4blbyM90CmYXt5wcJD9GWz qP07BnWg3nZLYHxfB+iaXHVBerv9rAp6GstYiAVcnxnHSSgM8prxfUAlqbuzGkeR+I2Q EGrxfJLSTeZTmdDYNxScKGPiPen8h9Rgo7E/eesNhDW/qtK3EAk4qBG/Z7/AhfuVInjd GBNRiC0zfTZXzt5mrUR57AXR3DFLvOZqkP3NRp1Vi0hpAGeGBQWSgGnWpsjzqWN1PCXX PWGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=GU4zTZOglnSrPean+DbklEHFBrt08OWlWw6wfnyv9Nd6AVYn19kCX/EjZfirXfYfmn Y0JAMl/DnjAl2UAK6JEPEARWqoGzsFpWQlf5Wxcxs8UWsFQmAAzBuP0pjpiLdubsgBa1 XnwV7vcXV/uOO9QR29K/hVUyDNtS/L5gytQ2c22Nf+HpJKDp6raLeK+ytOYpDsp3O2X8 cPh7rFX73IPFZODzmNYJa7GPnx5O6aycUY+MPc6znhMZnFaK8szTdkqYPKjdJtGylAC4 COifWMPLyu+MToggWmSjH10ZvAEUnvrP+R22Isc3oTSFgFQ3bxzXDnhlh/kk73qgXZnU PYdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IzYvn2T8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c19-20020ac87dd3000000b00417f817da78si1591225qte.565.2023.10.13.10.11.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:11:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IzYvn2T8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLgV-0001Ro-Se; Fri, 13 Oct 2023 13:10:47 -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 1qrLgC-00013Z-7t for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:29 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg8-0005Zw-IN for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:27 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-57b5ef5b947so1425740eaf.0 for ; Fri, 13 Oct 2023 10:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217023; x=1697821823; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; b=IzYvn2T8OuS3mczGb7W2maZalHlQwg/D3g5MItOQ3So0xqsLG/rz5IdS8A3iQc0tLR mcmKqhKT9BRQaVfPpA0xia7UVgNdtWLzMJTi47+tqzb5vCFIaUxulyX9rkZJgSTLqoLQ q8ff4YUB0MdoF6TW1TO+H88ZETfGzXnIg7/Hh/mqMjkX9wOQkbbENBgNYaKPl8C/J+DI pMBSLXbbeETf3SlghKlIh9Xr8Ggmu92ovOVbY8iOs1K+4943TEOy1XRfj1Vx5X0KDHrl BlI2eZ1GpXspWEymcG/lHzIRkB7rIxcI5RhVKbqAGvR1wzp05mlOqbfIV1W1HnVYhfXZ 0DNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217023; x=1697821823; 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=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; b=fN7mW21Ul4g9/3Bzv5/RjvNF69npknPkTCIUELZXzX9m/a0LPQeschIC0lVSm2ss9T jSNUaQVRK+r0Dmslsnzv/UbBh9Z/DXexZdb4EPeiQiHT67LVoNGyzkrZhQaJaTlvrc+F IFxpcvwAsMt+bSYCYEEU7S0OAQARbg/q35l5NBtMH1BOZUrlqEINIvoxSxvqjSYlG56s IfBGIpUQTRzp5wyT/zoVdJzqkn6W1WHj7xC9vZbyMDCsFdxhikJnipopocFzyxXPFM1I gLwLSUPJRPTnaqa6GXpIFrMYg93czttm52gx8Q/yiZBUlQPTUn1Q5+qEoOEh8II71uD+ 8SFQ== X-Gm-Message-State: AOJu0YzqRW/aughOLDMH99yS8b9ChyphTTU18/dDygeO+JED8FIOi+4E ZB2U04gsyHl/t05g7TKIZiZ/LRms4Eo93GFdwmw= X-Received: by 2002:a05:6358:917:b0:14a:e358:f436 with SMTP id r23-20020a056358091700b0014ae358f436mr34972246rwi.1.1697217023263; Fri, 13 Oct 2023 10:10:23 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 10/13] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Fri, 13 Oct 2023 10:10:09 -0700 Message-Id: <20231013171012.122980-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2f; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The prefixed instruction has a pc-relative form to use here. Signed-off-by: Richard Henderson --- 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 34df9144cc..79e82d2f94 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 +#ifndef R_PPC64_PCREL34 +#define R_PPC64_PCREL34 132 +#endif + #define have_isel (cpuinfo & CPUINFO_ISEL) #ifndef CONFIG_SOFTMMU @@ -266,6 +270,19 @@ static bool reloc_pc14(tcg_insn_unit *src_rw, const tcg_insn_unit *target) return false; } +static bool reloc_pc34(tcg_insn_unit *src_rw, const tcg_insn_unit *target) +{ + const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw); + ptrdiff_t disp = tcg_ptr_byte_diff(target, src_rx); + + if (disp == sextract64(disp, 0, 34)) { + src_rw[0] = (src_rw[0] & ~0x3ffff) | ((disp >> 16) & 0x3ffff); + src_rw[1] = (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, int vece) { @@ -696,6 +713,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, 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, @@ -1155,6 +1174,11 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0)); return; } + 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 (have_isa_3_00) { tcg_out_addpcis(s, TCG_REG_TMP2, 0); new_pool_label(s, arg, R_PPC_REL14, s->code_ptr, 0); From patchwork Fri Oct 13 17:10:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733251 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580877wrv; Fri, 13 Oct 2023 10:12:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYECMvxlwWo24AnbTXdJYPdehB+eTsNYnopYRXPr6WZlO3kfH+Aex/7fq3uTA1hnedIa5M X-Received: by 2002:a1f:ab8e:0:b0:4a4:cd2:5ebe with SMTP id u136-20020a1fab8e000000b004a40cd25ebemr4695477vke.12.1697217126731; Fri, 13 Oct 2023 10:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217126; cv=none; d=google.com; s=arc-20160816; b=qALqU7Ntlof5ZskGtKdp6YHHigYAxfbjgWZjYCl2zJJ2TDybv7iz1vOru51MG/ecYy rkiVdTFfjY9IUNtweq/nUStnFivL/YK42/ikBc9Z4rPEl7jbPruD+HYHwnReIFkS0NIH 8qqqpA44J/1G4hfn/umrB5/3Mxi6Nobx9YX3b/MMgEyJ561048jMrrTUtP8ktKviduKP HVtuY03sbJFWhjB0Rdvc4moWnAd2Yydrb5QgO28+8azzAR1yVDLoz1XvAiD3N4WGAtsd I0ZLf4tH0v2bkNiZ/FS9OznJ4UtL8Lql4Umm2IO89x2qkr/qT7OjssGaPXYT7DajRcoE ATDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eJDwvSu5y6aQI1FUpLq82z/uiGp428KQX4VVdh13eIw=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=eC+Ty1TPeXfnhXOPFKzCir1DS6ugmgMbjUAqbLE+vhiR0Kcwk0oIqI8B/xWDCP5GZw XYHYgywagLy/YYlz3Xa8BaCGRoWC7zEUMazdkmLhSxmjmjTleKN9tS7YnLPDMfRioNr/ q0Lkt0cu/TGXNc04l8nJuwfm9lZPM1cDWrYcVhrwNUKJWsBdmHBNIKnnyYo6KncUEZQk FBBvyenhaaOmhSmd1+MBkZeuOlY3BKT1BKCv6TeoG54Ttbyy9bhe6P+LTo6+a29AqGb7 2w+02QLtz7ZW53c4M59GkNynxSDdOZKqSY4s8aJLw2odNpPDgLKmTxz+FLBBaNwUS9wE 097w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rPLGpPW/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h20-20020a05622a171400b00405516e0cd1si1542730qtk.445.2023.10.13.10.12.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rPLGpPW/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLgF-00014n-6e; Fri, 13 Oct 2023 13:10:31 -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 1qrLgC-00013Y-7o for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:29 -0400 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLg9-0005aX-9E for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:27 -0400 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-57bb6a2481fso1235347eaf.1 for ; Fri, 13 Oct 2023 10:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217024; x=1697821824; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eJDwvSu5y6aQI1FUpLq82z/uiGp428KQX4VVdh13eIw=; b=rPLGpPW/GmLywRdTtg+2xEgOJvhqMV9a1xw0lVYRD7mrM3pyKg506U19qhAf2ntA+s BWc91fCklah+xonQJmR///A5kP+yQUkE++NiSLAyjM1M38GVuOmqzPRgHBkn5ARPDrcs PtdQVUULeAaDd1fttFQtgZnyKkWVEDVpRK0WZzelovuGmH2zrpsXS9s+EoPeNawwdrZg Ibq7BDVXOiHwLL2YXSmAY45Py2hf3LmK0M8Z1DRKbNgXs2IojHFF9/xQN1bf+WGy8gk7 NPljP2eZtMIUWpgPDVGw6sr1i4GaBWFUMyFOhiNZOi8mpY4d34oBq01R66LuPab6JY6n iIIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217024; x=1697821824; 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=eJDwvSu5y6aQI1FUpLq82z/uiGp428KQX4VVdh13eIw=; b=sogcaRF8W+5yH9jSWOR8KV91injEupOj0sDJUqqhMo6JTm7txKMdOsHnYfgahRBKZ0 a5LNJLbsBmPXITtlgBVZagxXQOwltNMxvL0n7/LEIOu+LTporupJRVnYaDkvxQqvp91E FGlTMWbBfbq+lNYenqERtPX/DpMN1oHzqGxGGyyVOcgb90Vb/i0z8YizEvKduONZeLGT OG/EkvMi25pan5yxKi8ipdnGga6tQGYxUIOnEWTHvlFUe1TSK3wi7iHm59X0wgWR6DiE vTCi+MNFzIcVvjb6rQqEX98HViQF5Dkt18jBHT9abAAEDDUOOmUZ1Nw1Mo7uxAVPip27 2SmA== X-Gm-Message-State: AOJu0YwwsUWn3UeKIL0kWIXWaY95S5HSxhZnxB8T4f2Kljn9OKGfar85 iy67z6WIOHE/wfkbmr/itzSDajltLmf4vART4VQ= X-Received: by 2002:a05:6358:2624:b0:142:d097:b14a with SMTP id l36-20020a056358262400b00142d097b14amr20704937rwc.13.1697217024032; Fri, 13 Oct 2023 10:10:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 11/13] tcg/ppc: Use prefixed instructions in tcg_out_dupi_vec Date: Fri, 13 Oct 2023 10:10:10 -0700 Message-Id: <20231013171012.122980-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The prefixed instructions have a pc-relative form to use here. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 79e82d2f94..db3212083b 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1242,6 +1242,15 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, if (USE_REG_TB) { rel = R_PPC_ADDR16; add = ppc_tbrel_diff(s, NULL); + } else if (have_isa_3_10) { + if (type == 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; } else if (have_isa_3_00) { tcg_out_addpcis(s, TCG_REG_TMP1, 0); rel = R_PPC_REL14; From patchwork Fri Oct 13 17:10:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733244 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1580361wrv; Fri, 13 Oct 2023 10:11:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbH4GBVCFbiA7DLzqRQZbEDC31VnOkw4lmiackrhqsfLzNchqYHJpQob11g5uvQqY8NWMf X-Received: by 2002:a05:622a:1816:b0:419:4c21:d706 with SMTP id t22-20020a05622a181600b004194c21d706mr32917263qtc.23.1697217064306; Fri, 13 Oct 2023 10:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217064; cv=none; d=google.com; s=arc-20160816; b=cGT3FUYZCJqWjUUo8ubo9R7pMTjCuaQ/XWOn3QBrFWvy4MBN8Fq97n2liQDy4LvZYC lsWcaA4y7DrJ9Ln83QB88mXTljVCTnUv3GKJtsqJeet8FNVEWfvbNwls9546Xr45WRAB v/KsQpE4rUsEoZgRJqbwEEPXx59x2QMBJw7Gzfcgb/UoLPc+lFmXGXnJxHuEZSIcgQ+7 thVvD+Qkunvt2jHvTYnPx4a3F5GaQ87ZMdX2yqf3DRVNlZSaoa6PqKMSkPQTnshPpGkC FUByBVoIK2a7Z0cSBheiCvKydEvsXvwYXJtO4/G94L7V8St96OI7R+JEznKIKM5Lx6y9 HXpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Sq2XuaUgq1WVJLtCb9vCiBQv+e4IAv+CN8pWqHj0rc=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=vlCWiMrj3QfATTW5EIXmTCna8h+OZg/J/j0+EGSBNHzhQzIBO+l5mHxBgUkkr0mVgA 4X6dqWznxcYV/1yJwdVtdQshDkNqFZHaHYYYK+UA9Pr86/Z+Ifnd5e1epTIbujFswhQB 9wF4ZINOQ34LggkGt871NTYaUDQRlYotsdf6BCGDrZCfuL6vXsUX0rUbpDU7nZE5Zbvy hEsqLzHlPKP4IA5TyW6oPVx+OKxXj0RCLAwFpNidBhlI/P4mUKr6pMtzLb7dJZLct+qc NVUWCFZHdmSu9SjYIBxUefBOM8mo2paK7cfooqa5ZWZr4xu7xlrGA6WUjSTVtywE6PzS 3vbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GNwhz9hy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w9-20020ac857c9000000b004197aaf0c28si1489761qta.535.2023.10.13.10.11.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:11:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GNwhz9hy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLgQ-00017Q-GN; Fri, 13 Oct 2023 13:10:44 -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 1qrLgD-00013n-AJ for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:29 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLgB-0005bl-GD for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:29 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-57d086365f7so1191433eaf.0 for ; Fri, 13 Oct 2023 10:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217025; x=1697821825; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Sq2XuaUgq1WVJLtCb9vCiBQv+e4IAv+CN8pWqHj0rc=; b=GNwhz9hyPxvj+NpiJiNOvJxv0LoTTWZXQK3GkANdXXwMopvecXoyk5psFC+n5GTI70 J3EfUK+flm5gRCTQMaV65UJYcqE9q2LLnD3+6L5GoaUel2QZTWXLEfGDoxIK6tTEM16Y nCmKJWDt8pW1cjkUEpAAb73PYkzOtV0poZF24rjXL5ynulqahEKdYIshmVV2NjvvPmp6 Krkji4THDbZKGxhu8WpCMnqUO7UEwWnMl5+SXzSUMI8CHq3P8e2vz8hQ+aB1R2tHvLn9 ZMt2Bzx5YSXwFa7WDppFRjqoE/IIMfpXX14mRf34GGtNjnQ6TIFbQ8n7h/MzuuTHATZq p3Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217025; x=1697821825; 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=6Sq2XuaUgq1WVJLtCb9vCiBQv+e4IAv+CN8pWqHj0rc=; b=KtY34pUfCBOBarc9uKHcns5xQj3Y/NAGhd6mLdwkVR61sQck2qJWCTZQX+f0pUqQW4 wCRg4OkTn55yO442/BQxm9P/i1+qr0WwtR0OYMIEDZGGCU0sQZW2ZPjQ5sZP1LElQLP8 QX1kqIeSsOcq31fYOMwhaHsvxaJSbyog3tLm+K9wmfaUWwTGwP/CogrW2kMKAvPyczVu LBziOJHp8ftN2BWaM9dos35Nnpxf8zfYJL3ObUWR8n41PBLHwTHi6wxJoMoa0mebayEx 9QDmN+220N7ou2j0RX9PC1m3HFHosJtPpBxWFGPMfUTWY/yeTJaEsx+3gCPxLpY6o3up notg== X-Gm-Message-State: AOJu0YxLAvs6ZHhEhuYCqH7s/VFzSUl96OMgwwsV9KX7l8Ci/iXEI+eU CSSxS6Ohpw4DI33uZu0LJgrZjiHiX+BX1SrKJNs= X-Received: by 2002:a05:6358:988d:b0:135:b4c:a490 with SMTP id q13-20020a056358988d00b001350b4ca490mr28883714rwa.10.1697217024924; Fri, 13 Oct 2023 10:10:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 12/13] tcg/ppc: Use PLD in tcg_out_goto_tb Date: Fri, 13 Oct 2023 10:10:11 -0700 Message-Id: <20231013171012.122980-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2b; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2b.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index db3212083b..6496f76e41 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2753,6 +2753,9 @@ static void tcg_out_goto_tb(TCGContext *s, int which) if (USE_REG_TB) { ptrdiff_t offset = ppc_tbrel_diff(s, (void *)ptr); tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); + } else if (have_isa_3_10) { + ptrdiff_t offset = tcg_pcrel_diff_for_prefix(s, (void *)ptr); + tcg_out_8ls_d(s, PLD, TCG_REG_TMP1, 0, offset, 1); } else if (have_isa_3_00) { ptrdiff_t offset = tcg_pcrel_diff(s, (void *)ptr) - 4; lo = offset; From patchwork Fri Oct 13 17:10:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733254 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1581248wrv; Fri, 13 Oct 2023 10:12:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfQsjh9v27WRzmKl3/jHgChcNiH6ONBZDjqV5Dgn45ei/yUELZzXwfOcpgj1QMTyStRhVQ X-Received: by 2002:a05:622a:1889:b0:403:72fa:630b with SMTP id v9-20020a05622a188900b0040372fa630bmr34361361qtc.58.1697217171218; Fri, 13 Oct 2023 10:12:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697217171; cv=none; d=google.com; s=arc-20160816; b=xZPW6EU6p4tUk+N789+kUAJ87lxBHdqHYF5xpRfYyTgqHeR2LAbfoWojlzHuZipoz8 9NQjXtAr7V9ZKGgu/NszQPynjk7GbxBpH2yneYqG2FkIqm8NWGaqsVv3geyAPZGI85rn iorOsW6Niy/jHb+enMKQ/4iImUYrlwBX+sAAZWkdiFCBUIdHaCauvgsxELYbO7aaCzOS 3MuNbgPf4u1nk1lZLqrdUI0CPF5eYW6QtoKdyxVLegB4aVjL1tf1/YYBhVKjNAB3bZjW 3zK9vDylwR45ilq7IrcVDDOgtKYh2OYM3FyjTpLcvQc2sXuhUitDn6i72jtR8aIkF9pG gFQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wgo3sS5iUyrU0Dzdzk24htDnmRxHdeX5tUMGq3kg/oc=; fh=UhxwdZYHP7zKrVOsDzSwq52OyFUIKgoVzT4P2jPed6w=; b=ypYNIzoBTodiW8lmEMGNBaQXRP7+DT71rKdzgFCs1OMl6yUHBz2pQlOYzGlBGQe87H g8FhgiZ4CDC+/WmWG2X3MK7FKqVsBh+F0TueVJh4fsImfKzlhxbuoMcA7lVzhXYCf9gq j9oNaUSa5FJTglH4gEeJrAfnZmGR4FyMpmmRh1WlEPVrHcpH2J2AutmnFzxUKRrs3CBQ SD02Yrjc/xMc5OQgfzAHrfXp68xWsnvP5mEn945AkM0qh1W0qHzs+t1OCkFyjippd7xp /rCBdWORbusCCU3RJilyw6QWMRYQytjDrfXkvO1uLdd0Fyw0LltahHCUetsjioSDjSQn 3sfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kv4v9X9Q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u18-20020a05622a14d200b004197f495da6si1461574qtx.554.2023.10.13.10.12.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 10:12:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kv4v9X9Q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrLgW-0001UY-2p; Fri, 13 Oct 2023 13:10:48 -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 1qrLgD-00014N-Ey for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:29 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrLgB-0005bw-Gb for qemu-devel@nongnu.org; Fri, 13 Oct 2023 13:10:29 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b20577ef7bso846407b3a.3 for ; Fri, 13 Oct 2023 10:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697217026; x=1697821826; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wgo3sS5iUyrU0Dzdzk24htDnmRxHdeX5tUMGq3kg/oc=; b=Kv4v9X9Q4Do3lxi26xKka4Ss23qZ0qiM+hgcKc93YUCPeqLsHRNfB+rkVF1Cbs0JSL Hvph/Bva6mRCraGRK1J2d2ARvvi5SqLXFt5NityvZ75cMnLH7tPS+gZuLWvONWk+w0Li 1DLgQMTnHdIteHeeUzcRfZo6GfA0dtoH5AIIMPaGR6TQkqYyPJDbxTbTqOxMHN9R8Nva ID5RlCUzn0jnQDz8PLYwO77TfInP6VEYljxY/eg7jRSD7CFtkqz93k3sx6QESfZ9mnyK qSXyDqfIDWAVeaKADC+q4JV1kcEYP3Bc4OWNr5P/UZAf/RFbUcul/ZUI9nFOP9ZpAP0D sMAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697217026; x=1697821826; 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=wgo3sS5iUyrU0Dzdzk24htDnmRxHdeX5tUMGq3kg/oc=; b=qn6PWHYElVrrxW54Fy2PpmlXbaV5rJQMoMtSB6S7A1cCrF9Nl+TzDw1JD/prmNG6zP +oL5KLnkNWA/dmpt/rkzsqVa5fxYbnj7TcMLzYroQIeIBBSQOfGT3UCEbnVi2C6IwAQ6 tDrIlZZY0q80wk/4/F8tQsQA777AaLUhyjOERo5dT1i3yWCaBVM78ha7RK7nTjKfRy6v YldVEy/6j/ZX3RaX4tOVboTghwjNaZ1DtQ05PESfVJQiAa2e+0O0B+57pxZcNpVgjhFr 7RCNutfbS2k1xK1oPRCqWN+MmnBm8tLLKRM9cq47KNtXiJU+U+GtUZ6U794V8vwDC3Gq aAuw== X-Gm-Message-State: AOJu0YzRY4pOMHwNsmUlt8iR75g0YOJp5lEG06MFnJaBQRS6Ws/hH9RT f/1kyw3J3q3zPgdWFIaEkQ0bfSPs1JPlGipW7DY= X-Received: by 2002:a05:6a00:1946:b0:691:21:d9b9 with SMTP id s6-20020a056a00194600b006910021d9b9mr25707931pfk.30.1697217025784; Fri, 13 Oct 2023 10:10:25 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00693411c6c3csm13687926pff.39.2023.10.13.10.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 10:10:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: jniethe5@gmail.com Subject: [PATCH v4 13/13] tcg/ppc: Disable TCG_REG_TB for Power9/Power10 Date: Fri, 13 Oct 2023 10:10:12 -0700 Message-Id: <20231013171012.122980-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013171012.122980-1-richard.henderson@linaro.org> References: <20231013171012.122980-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This appears to slightly improve performance on power9/10. Signed-off-by: Richard Henderson --- 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 6496f76e41..c31da4da9d 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 #define TCG_REG_TB TCG_REG_R31 -#define USE_REG_TB (TCG_TARGET_REG_BITS == 64) +#define USE_REG_TB (TCG_TARGET_REG_BITS == 64 && !have_isa_3_00) /* Shorthand for size of a pointer. Avoid promotion to unsigned. */ #define SZP ((int)sizeof(void *))