From patchwork Mon Oct 23 18:13: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: 737289 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665175wrl; Mon, 23 Oct 2023 11:16:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzXmcnML8l1Hcwno0bZ4kRVCVMRQqj7yuEUyZw3fzJhlnxMTCLKPru03jhg8VolxhmIoKs X-Received: by 2002:a05:6214:568d:b0:63f:8839:658 with SMTP id qm13-20020a056214568d00b0063f88390658mr20357107qvb.1.1698085017705; Mon, 23 Oct 2023 11:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085017; cv=none; d=google.com; s=arc-20160816; b=Clqi1JMGPkaqNvMMdF75EBRmTe9woaZLtSYMqiLiPK8ISG+K658NDKRHIIvg4861B8 jn70R/xH8bfGH5n1vYYupqVG5iZbsi7hvY+9dnU+kzBUIDWHItoxgrvSUxExDMTNY4C9 sN3zHBgCukOKG+LDDS8F7Lh4xa8ZUOtWc3w18O0soci1jLkuvtNaQ5Qg5vUsYWq8p/ok bDXaNbokfg1ZSY4CFRAym1nmh6tmF+svqvaZ3U7fydvwu0koX9tT62fbKMBqf5W4UbGr 3xTsv2610BN7R4GkZFWaFJoU0EKnO1JCyZvc0JxVdRTKy64nXTn4G7oVir1PJ9OhJaEq 1xfA== 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=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NgCE3ebTS3b3TVy5tttXFO6gfSXTK4KKuotx+77gjdFMYOCayfiLFkEu94Kt/RzpZo PkYvROP03qm8bfEXtiKxNeHD7iB1MF6DGAiZLzL0zwUREvWSI8W/KOwnSZRwHBNPStpl ChNx0muZWA9XOj3SUeQgRiF+IAPTlybMLUJp/DP6BaYOhMcMJiDnrtqxNeEVgkGg6I/8 N60kjZeU2Mzs2IsQkyPtaZsAZs/mk+vpI5cBoE+CZMldsY2qPOzn8r+fwiBo0kLI/TNM Fcoi2VcCK6hWMO7MDwLIBBirArr+V+KWHvWUGfX3zUdsm9bBwPoMsuCkDaSjwlGyw7B7 AV2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QKMmiCpl; 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 dl12-20020ad44e0c000000b0065afb72d696si5992693qvb.454.2023.10.23.11.16.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16: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=QKMmiCpl; 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 1quzQx-0005X6-Id; Mon, 23 Oct 2023 14:13: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 1quzQv-0005Vv-Ki for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:45 -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 1quzQr-00086O-6o for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:45 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6bd73395bceso2610056b3a.0 for ; Mon, 23 Oct 2023 11:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084819; x=1698689619; 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=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; b=QKMmiCplK/iJXS1XYv4o+C3ELvZmOsait1wOf3MykKISkFtO8GEMpp1b7FPcSp40LI 6IHkgSIfGwdfzyNuypLWjT73y5ToTUo4wr1ZNpzDrr9rhvhjM0VBXzxQSUESa5xPacDn v1SmRiph9W/NuhMLlenkMbJg1K1x7Pf+MJ7P6GSTCW93BS9C+IhgHcfv+YuPG8YdEbRy Hkwj+pb4t3oShSiwBvoG4+mq/pTKBnOdRyugfFeQPNC+lfyvFuXyv96C0VpkUSiVwglY 2x3FC4PBMnQyv5W2MW+ODJ0ek1FW8jl1E55tPSMr61CUHXZPPn7DLjGR5rsGj9WWRMYj F5Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084819; x=1698689619; 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=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; b=EJlDCWHuRrOw/RqAVD2w4WVuhHli4LKDJIpAJtpHx9SdV8KtZF19lmSpQiBS1GsRgA RuZeOidkwDQi05Zy3XSk9SmRzI8fwAI3sA4GWS/GDgilAfUPp8c7vnWSCHQTpMie//Fh nVp4R3cZ/YnoPHOl8JpIm95fpDrxTSWK/7+wnq7uktdy9vMi5xS0vcSF62JiLdJE1BNv BrlW0BZitLYJlB51iCxPPeTow4AyHXdMIz0n+ZsVYzO7sS39Qj0HcPGa2Xe4tq0+uybm Iauq0Y/RMjoUfQI5xWAkeysgXAe4Fbmnlk68ezNHqABx8JLYxWciyBdOtJ2cE25mc6FR MBtw== X-Gm-Message-State: AOJu0Yy13vvblHKRvCN1RWePMRdEtcGwRQ5w5nhmkysnwzLEE6wrmYnf mlhVwugLxf+Nnr3ZTV1IFwXSinC0BV4SqbCVm3s= X-Received: by 2002:a62:f246:0:b0:691:27b:15b4 with SMTP id y6-20020a62f246000000b00691027b15b4mr16940176pfl.5.1698084819628; Mon, 23 Oct 2023 11:13:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 10/38] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Mon, 23 Oct 2023 11:13:01 -0700 Message-Id: <20231023181329.171490-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-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 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);