From patchwork Wed Oct 18 22:25:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 735138 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1236482wro; Wed, 18 Oct 2023 15:26:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/uz823G05fHL7LCIlY95s/VH0BiJnjksXtH8nkMgJisi6WepvkBnrPb8xemTam3R9U5XT X-Received: by 2002:a05:6214:2a8f:b0:66d:32ad:77ba with SMTP id jr15-20020a0562142a8f00b0066d32ad77bamr664638qvb.1.1697668005999; Wed, 18 Oct 2023 15:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697668005; cv=none; d=google.com; s=arc-20160816; b=WZt7REKf0rxxJI/0ZzZ0L3gwRz88yDWeh56000AxDED6289+smAWN4HJHgGYyZoN4n 7fbH1m+FGlNL2s8m1H3XLS/jL69N0y0crZSivACVZoD0NpRH/mWm6kYgYZ3Bbe5tLwE0 41gxM4sn7j9Xrnxm9KS6/0+G9UBwC5/JetZ4SplxiE+v71RoKRiNS3k3DgBbjfkfvbDe IxMX8+NJBVo6J6PKeSWRRKqpW3bYPRu37yyeBy0plYSSu4yGrPsyV+wyJ+9TKdYdKslj qCBEgtzIDAGZwKPGJ5zxEhLCoW6ALkW/sVq+I7yjGQJSgdm+TDOh3o8BFDw/3J6zDuGD WZdA== 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=zJ0E22Gz0tw3W1Z4VPNBtq4CN14o5uAZebRaRHqaaJRNrDBzeoqkjiPq4quXT7Vceu XKq4ah+7UXpT+e+LBxRb1TfY9o98gxPxo8/p0YVV0CmFAFwIU4kPt74BtpuAjKEXCkwK zRM2xd79RKhLRIFBdThfPyAQISUmQmP/Ff/RXPZC0XpUPSHf3w0jQIQDMihmph5J2D4u IEHb1w+gzBk5TbIWeSfRxK7+3CzOu5lv61RazeJCsan7FXlk6oeVmzaYWWiBoIY/a8AV LWTC+7FQo2MhvKKDkXHe7JeoePs0Uu2jGiOePAVL6Y36Ex+KZ/3XAa/kVWP+6baJ/QXy S73A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kklKVsv4; 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 s25-20020ae9f719000000b0077438d488d2si619633qkg.405.2023.10.18.15.26.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 15:26:45 -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=kklKVsv4; 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 1qtEzU-00086J-IW; Wed, 18 Oct 2023 18:26:12 -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 1qtEzS-000854-3w for qemu-devel@nongnu.org; Wed, 18 Oct 2023 18:26:10 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtEzQ-0002TY-CC for qemu-devel@nongnu.org; Wed, 18 Oct 2023 18:26:09 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1caa371dcd8so12745695ad.0 for ; Wed, 18 Oct 2023 15:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697667967; x=1698272767; 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=kklKVsv4uP8wBr4z+PD5akacKFx/MT+hn1t/CKeHDEHb38ljpTPYYpzU84IWxjoguT tB9Z+VXTuswLvKZU8av/EFmFu/VojmDIsyD+mGUWQ0uQoMC4wRgIbm1ay0tTi7bJOXN4 sMDqnHPCB2oT+DXYoNnC4rIiA8ANytwB0IRkhwcgCPkrJ79SYCNyDmVOc/1xeqp6dzR5 gIOTfa7f1z0/BwfzI0upqAnsGIqwl39NC2z6xDOoexMIhv25ANVqHHF8bwAXBET7CpiM EDPiXTWhLkU3gavwqaFU9QUlCylZKaehwcncX43cMiMZuztxGUBJz5A64Sip+vsn+Nqo 2xfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697667967; x=1698272767; 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=ml2vPUwv6BMD88C5WYJNKsukgPk0mSaNDfvyR+klZpKtsOQWBgyuPe7j/3hy7NB0ei /AdfwpH0q44IPz7+60Gv5LnNo29qZTvdPi6D/EHMsfJR5YpUCzQh7/tBZNxpeLukMXVL BsfqRdtJbaemrCP7JnZkPyLILggK9Gab3SCxog8VjK2RbC+9gB0yf9Ur0sET59D6OtRv KLD//7ESk2vz+Dpx21KW6loxiJ3F8QWi364vy5IgyFx4ZU3HCmBuRfbYuux1ulTZZvdA UQWVhfMYAPixJavsWrVDtdo1nt058OqNmdQJcGwU6ln1NhraIpAb+1JztkasL5aws6oY vz2g== X-Gm-Message-State: AOJu0YzQmEjbYV9pviIsSoIUWRtXlaU/7xw0LDCP3pYVb+Vpc8uA8M0F ju5Nxt5Ic4rAVVbT1L5rkq76M4kjKOdFpn4nZnM= X-Received: by 2002:a17:902:f9c3:b0:1c6:30d1:7214 with SMTP id kz3-20020a170902f9c300b001c630d17214mr641119plb.55.1697667967188; Wed, 18 Oct 2023 15:26:07 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c24d00b001b9d95945afsm431058plg.155.2023.10.18.15.26.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 15:26:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 10/29] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Wed, 18 Oct 2023 15:25:38 -0700 Message-Id: <20231018222557.1562065-11-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::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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);