From patchwork Wed Oct 18 22:25:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 735164 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1238499wro; Wed, 18 Oct 2023 15:33:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg37gHWCd5IKRiG/jjWXi2EnI9S59s+TG+yEL4wPRhA4LqKVhaBMzry+yTQStbNCIEWU8T X-Received: by 2002:a67:e149:0:b0:452:b574:3c9a with SMTP id o9-20020a67e149000000b00452b5743c9amr345630vsl.26.1697668381560; Wed, 18 Oct 2023 15:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697668381; cv=none; d=google.com; s=arc-20160816; b=WlVYqfA3MOYXpKPYr7WVRdrHeANAbT25/yBpvbUzWDQlfhAiHUUIobBOuxltUmWh4h qHa/ZdoSBTBvqYM2tN44kXIH9eTR17VvOJO8tMtR0zSCmTxwhOJaeUHNKFZtJJkPIzJr vPDkoUFYFjDPwGjqh1ORAQ67XCCktBcJqOcAvo4TEgQ4MWgbB9UKkGaJPpl+gtoRw6uM v8RzOwMIBADSHG8wK+Z2DZe/N2/f01AOY/ys8+NVW8G9RSFuhVgnRmXkpTlQntTSEXVR eU6MGZggdzkgMCjuLGesbu4qu8e9CsQbNRlx/wzt/te6c4mtlPIsVCJVf65oSS80rIks W1eQ== 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:to:from :dkim-signature; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=szgiollMG0SAA7m3kiy/53S+23MqjagrIH3YvYHa/hRzPyK+lgTXDUA8DS0+ebsRwu 4lg6VUYI8CIJKRVppI7fzl9DaWSaU3+kJ3UkPv8C1mGq7hwCmuo2Y5+G313r0f2jMmms MWkyoHn6gC9naGe/4aysfMTbCQ4a9PKXu8Ep+aObGwt4BFlx5lbpRbEiITNfwtG6zA6q yj9I/mSCR1Dx1GCq/M1RSLtrOuhF6E733BUCSCneE+O0bX5/A+FwVzl1YR4bAAVmCfnb ikLBVqSTMx22RRG71pgrYXRJs67H9apVoQ5PA8aAG6/aeMxthlOomaLv4FzenNl/H0he vtPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=htZQrut+; 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 c8-20020ac87dc8000000b0041cbaa0003dsi702783qte.202.2023.10.18.15.33.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 15:33:01 -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=htZQrut+; 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 1qtEzP-00083v-K7; Wed, 18 Oct 2023 18:26:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtEzN-00082N-CG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 18:26:05 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtEzL-0002S9-M9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 18:26:05 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1ca72f8ff3aso28054915ad.0 for ; Wed, 18 Oct 2023 15:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697667962; x=1698272762; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; b=htZQrut+kscvqV6XTHK9BlBpuw5Zj/b3SGv0R4/ehx3rqPhoLQpbQuOexDHIgblTgL 7xqDCc/LYfGReol9hP/tXBeyXiGAmhvb4EGFsoN2/RvlUYKTxEYrsa8crNzRH4a0zdev qLNjRHknHOuXejQqhJnAetiIIziEHYMmzi66SDNOhfrQ6ba/LrHxIXrkVq5JUyVu2prb +7iRnnRPKT2NlRZwSh22GDc2xERu7Gv61L19IySdOnTz5z9wt9/Ywv2gZwICHrO9kLdy csOBMQjOL/A83z7hpJUT1rxl24HByh4Sta1znZicUEb0zzpLBqWfDx0XgJFwzX0QqjHr hRjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697667962; x=1698272762; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; b=hqfv86bjrpPn/XmvSLcON0T1wY3R7hdhW9vLGiCs2pakNDzVOm1CsCK2gt4giW3ze5 HxXU2XMkFpmQGtSqNbvkVugAEK1m/WyNx2jX3yVaDKYQ4QqJ18LTJfKFGxDr8NQMzVgM Mbj9M+EnkcH1AJjChWz4HklxKtJRJA/KpUH55OCxetW1ngIloeey1Fn2YpZ/OyDhG6EW rE92G5RZ/n06xvtrsLvpOGlj/EKZqrWqKuJcbNJ06YzNeeC463sbaFglVQnsKfy+ETTD Cn9nYBJ4/LYm6mjon/sA0f9ven39W1CO0yeHm0CPFsO8ksnBc/WDPbg0UlrexMbaWQvM F1Ag== X-Gm-Message-State: AOJu0Yz/7BvYZ3ni8b760mABcE/7DdBQ61ArOH1JXZZTCrGSoQn5AEvb CAPTAoCGXcFf/mM2tTmtymwfTveHFHpNpIA4rEk= X-Received: by 2002:a17:903:22c7:b0:1c3:2df4:8791 with SMTP id y7-20020a17090322c700b001c32df48791mr824107plg.27.1697667962471; Wed, 18 Oct 2023 15:26:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c24d00b001b9d95945afsm431058plg.155.2023.10.18.15.26.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 15:26:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/29] tcg/ppc: Use ADDPCIS in tcg_out_tb_start Date: Wed, 18 Oct 2023 15:25:32 -0700 Message-Id: <20231018222557.1562065-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018222557.1562065-1-richard.henderson@linaro.org> References: <20231018222557.1562065-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+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); + } } }