From patchwork Tue Aug 8 03:02:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711541 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1911485rwb; Mon, 7 Aug 2023 20:04:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdwsBQqynhwxf9wAbzQsIopjdW9FQZCve+Wma7SZ+9dffsaKYBsfBKg+eUkKLp0I5nHaSS X-Received: by 2002:a05:620a:44c6:b0:76c:af3e:3c14 with SMTP id y6-20020a05620a44c600b0076caf3e3c14mr9319344qkp.71.1691463876825; Mon, 07 Aug 2023 20:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463876; cv=none; d=google.com; s=arc-20160816; b=dAVIsBfEg4bWku7J6899pwsbya7F6Gb53WJEvDDAbqQELoetGG5CDp8o9oJImqRYjQ W7UCRIWvqGoE9k//PhyjYZAIMMIOHIe7AeAnN9aoQMbn2CZ0PEKxd6Dph1AU49YphZxn L5vW7t0uOc4pnNh/rfBsJtm/sMEU9FTZeiyVxT5RqbjOAFzu7e4srXUThxVngMkLntKP onwIq6HZ6SSDeIaZZZv43f1xZxZcj45AE4rvJMcvbxvhJGMaAC2gMRY0Zosk41amz3W9 Nj1AECqm8xJhRJeLkYsKeTMoyV5GKXKLRXh9vQxxB/YfmHvu774LJ9iNmNY9k8JuXMNV L3OQ== 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=PZZSZu8M5U/PcU0xDddsAwmIrS1Z0aEmfJuCGCmTsdA=; fh=54SyYXXl3ghnGdcQkJAiPGLp59KgHlkQMz7FX70zS0g=; b=HLEhkyu/MfqcKfZfKj0bNqGNcplUYHyJ2O6tfYg4cGlMxJsQwK3YQeMEOce6NIOnaH rl1t2go8AxDzCt2aYjeKP9Mrzss3jS2XPoylde7E0K3xmaFxuHZpjzOA+XTFwwBm1YFH 3C+N6ZxJiLPTd/VPCPvmHpP4Cuox5aXKLO5QuhCNbuXHEBwhqeVV3FC/p0/qbmBy7/j9 4te3Qs0L/GZQxQYD+U7Wqb/fBotg0NApqJpa71PrKznbhgN+zviX6okKnWHF2mWRDYFK gwrTMD/AX9ARcwKTY1yXryeeF+9Nnb7+uwrLS1HwulgXsQNtjqoLb+FXE8yn4zZmmgmX +0/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="e/iAIBHM"; 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 bs42-20020a05620a472a00b00767d5b81886si5847231qkb.458.2023.08.07.20.04.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:04:36 -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="e/iAIBHM"; 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 1qTCzp-0001MG-C7; Mon, 07 Aug 2023 23:02:57 -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 1qTCzo-0001L8-DA for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzm-0006ZF-2a for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-686ed1d2594so5014291b3a.2 for ; Mon, 07 Aug 2023 20:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463773; x=1692068573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PZZSZu8M5U/PcU0xDddsAwmIrS1Z0aEmfJuCGCmTsdA=; b=e/iAIBHMt2hlcB+cbx3S0zWJb/t1SpU0uIhpuHer38hgyGb4Tw5n7jWQRI8O2Ubkj0 G7D3G512RTkvaBuDRfCD1o1scDAJrX3RHGqMzo3Z236rbNcSLA1PprowBWVwAZn9Eut1 lI4U6ocPfC7UNHizaRL0rutKvv/hutlTfuUx3tB9PVGCs0sreKIYyM7OYDoThn0puzPO bLVMxZU8k+h9Ux1A0EdnS0lesZ0NhIDS4O1SEhWeCTE+LJzmMYQN5gBEMIs6Xc/AeRTW jDsRG+Vife4zoi1KIDVqPM7EYBT/SzHNiFlS8aVxAoFfg7zH4pUgGER6jlWOz8QGYIIY lWqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463773; x=1692068573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PZZSZu8M5U/PcU0xDddsAwmIrS1Z0aEmfJuCGCmTsdA=; b=ErfLbbT70OxcvLG/1AUC6SyKt5jI2cDTKEqmXT6udp3EltGSeZfW4g2OG762OKhqRT dSuTvm0cUSoJ8PGE/qsCGsqwU7F4hOGooLpKp7sbLj8n+MwAdLGU6geE2RauXsT5kE4U tR5cGiu+8mf+xoen7VlFPVVyHauTijgg3Jb2s7+NZksTUzwhiFzSmQfREHUfC83kxgkc ANb6PZX1ueEAspWdW/NGrZC2lYqPbe1uQEjFYaVrxI/YCQ8ogCo8P6E/Wqra3Y/gIRBS k+4UFW2FeanbbK/sKIiAjW/2fcT59gmWqYIX36KDuoCWKnVkzNHemvBb3wcZcc/mW8V6 6rNg== X-Gm-Message-State: AOJu0YyOr3IWGIeWVLwn4h7HwQoM+8mhJwzVOCD71NDzbwx1ZLbmn7L5 3T8jvLq/pfbggJ3NvyAORhE/2as3IWtdjiHetDY= X-Received: by 2002:a05:6a20:3d94:b0:140:a6ec:b55f with SMTP id s20-20020a056a203d9400b00140a6ecb55fmr8968954pzi.16.1691463772836; Mon, 07 Aug 2023 20:02:52 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 1/7] tcg/ppc: Untabify tcg-target.c.inc Date: Mon, 7 Aug 2023 20:02:44 -0700 Message-Id: <20230808030250.50602-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Acked-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 511e14b180..642d0fd128 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -221,7 +221,7 @@ static inline bool in_range_b(tcg_target_long target) } 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); @@ -3587,7 +3587,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 Tue Aug 8 03:02:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711544 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1911644rwb; Mon, 7 Aug 2023 20:04:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg/gnyQDySDtdfxAAre46UUAzYbexU8qUSOuTlWAhrQL74uMhKOETg4cOhbmxZo55KZP3K X-Received: by 2002:a05:620a:f02:b0:765:4dba:92fb with SMTP id v2-20020a05620a0f0200b007654dba92fbmr15225769qkl.15.1691463898981; Mon, 07 Aug 2023 20:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463898; cv=none; d=google.com; s=arc-20160816; b=iFxWrHz/r900ZJd7kuwHUc0OSEpJxqUwdxXGekUkNV5QMPmVp21JlbLlzI7XCsg7x5 kRcPJuGLRXCv/ABrFBVvSw3qsDXqb4N7t3aSjCpUtMGwyGFBCgWu+mhx6K/m/0tm0MxG j47cWCvH3rdVhP5wzsyYWqltC29u6fc/vKDy3yvvP5h+72DYQPIONcaQb4D8bh/9Hxm1 362HIOnP4TCf+xj3+QppqvQice6U3/rujHHKNmhV6HLlqGIEeUtoIoggCOL+ds3hSyyP J0B8daZ6ehKzvyKtGNYU3HI8ZlbxUwdHB+W0kxXJiHNBI9boGdeenHftIbSrer7I1NbF qLqg== 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=hbxSTVv8l+gK8qmeoMZlY1+rXFa4fHFVXKxIo6ZA74I=; fh=54SyYXXl3ghnGdcQkJAiPGLp59KgHlkQMz7FX70zS0g=; b=G2Q843nfQ8V9vJk34tmeM7+m8zgPQ54YWD1gcDRzU109wcRWQ7OXPKj//G9hCieuJM LhfO6Dl86A5tDV+pftxeNqnf/UtH10m49pYH7tVck3FiPm6z4Vp7zWe9ZR1VHXHrfqrc r2/wFU8f/DzQlPJF20yl5md8lsfeEf7EYEv8rxDcp2vi985XnbNOLHBVO1C8tcEZZn52 IpWm8l3DLDKfuSitlvLQzlICpuV9yIasHRQNJefX/ZHKB1d+VxQ4Ss6cb2ebd/QzVfBz /BQTyetzLNDQ3k4kKRFI6OVLB7ygpt7FgrfBeSefZqTcu0A+01y5rrWazMsx7N3rZH7A nfXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nsETV6yt; 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 bl4-20020a05620a1a8400b00767ee543571si5723141qkb.403.2023.08.07.20.04.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:04:58 -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=nsETV6yt; 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 1qTCzr-0001NX-5M; Mon, 07 Aug 2023 23:02:59 -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 1qTCzo-0001LL-Jj for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -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 1qTCzn-0006ZT-2h for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:56 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-686d8c8fc65so3555775b3a.0 for ; Mon, 07 Aug 2023 20:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463773; x=1692068573; 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=hbxSTVv8l+gK8qmeoMZlY1+rXFa4fHFVXKxIo6ZA74I=; b=nsETV6ytu9ktK/rPexpZSlZwA9rWUWMKq8YcnH8si+UJIZqh48peQ/WtLS89k1PIfU RebwJCR2ykljNZiin8H483drqzOOQ01ntHO9le/7K5auRjS6CFtBhjlLqAAT3EdyX/N8 uJ/Yh5P5dopwT2nr9ZdATEDLEBBZ6as8kpxpvFU+IupzmBwEbTcllhvndW18ICgyOLSI n91+8bPBdSbRuEB72qhgeNOkrnWu458sL2HYPnFHgSMlvAvPuGgyY/XkJehRWERV0MyD gBJWQY30JvBG5Z6T9p/CJAc7mRiUFstrml3/LW0JrOqMS125Y6wHnN/fcWwkQyw2qzia Ay2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463773; x=1692068573; 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=hbxSTVv8l+gK8qmeoMZlY1+rXFa4fHFVXKxIo6ZA74I=; b=VgFfoKEDF98U7tSSJhnpUTPH/ZotXqtcFJBbds7U7+V6QWK5G22HeFYM22xQVC8N8F RwrZXbgYRFcQdf2lCN2ttmb2q6zyt7w3CDh0oHHwacXWMSb1Ql3VK6izZLIHYBqtZ3eJ JP+Au+odt6HwRKs6Ti8Tw4p28JUAqou78u/p2V6HnXFcFRA1MKZVOpoerQCK0yih07uR zb2RInZ1+4qvHZJS2dTcKxfcezqJaNKZrWscKwwSfh5hEeBlNHfMu88vMWMBADiCjONU 96xmS/R7gLsEO0u+C1/2m2SDclhNYjiGcCOKsNRT9tw3JEf1+BwcOpZkpSbbKXbGA5aY YKGw== X-Gm-Message-State: AOJu0YwSsOfN5MEehDKry7uk6/n0awlgB6SQCJ+9ZNbIOKNZ0zunJ0IY T3hXHOSNI9vMGzEnPZJlyPzkfZvvwYaVOwmUBUE= X-Received: by 2002:a05:6a20:8e28:b0:13c:b1a7:7b1 with SMTP id y40-20020a056a208e2800b0013cb1a707b1mr11328219pzj.25.1691463773626; Mon, 07 Aug 2023 20:02:53 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 2/7] tcg/ppc: Use PADDI in tcg_out_movi Date: Mon, 7 Aug 2023 20:02:45 -0700 Message-Id: <20230808030250.50602-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-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 PADDI can load 34-bit immediates and 34-bit pc-relative addresses. Reviewed-by: Jordan Niethe Signed-off-by: Richard Henderson Reviewed-by: Nicholas Piggin --- 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 642d0fd128..2141c0bc78 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -707,6 +707,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); @@ -992,6 +1024,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 Tue Aug 8 03:02:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711538 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1911266rwb; Mon, 7 Aug 2023 20:03:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGB4HIfjBxKq3Iu2756suo9iY5JmPoaNeyF0RnlhjBf61RKyN21YPjVsMyHrzUDRIDGuRev X-Received: by 2002:ac8:5fc4:0:b0:40c:58a1:cb48 with SMTP id k4-20020ac85fc4000000b0040c58a1cb48mr16191986qta.51.1691463836132; Mon, 07 Aug 2023 20:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463836; cv=none; d=google.com; s=arc-20160816; b=ZLezikoYfV4teaFSE7GDrsETMlDFasslsvtAvCE3Z4l8/PR08qSd2UDmL7UPckxCP0 Uk//BrKuIzJeyOF53q6wYSnFBv2rHifxQKmippm0E6YcxmoBURvLhqEBnw2rTmRU4hjp 5ByIqJF0E10rIp9P8TjJdiFg+yKyXvZUrz61a2rWX7PFTuphL38ugMxfozVGcUnhwTJG dT913Duxes5h9XwRZCKnz6eVv1dfe4ubvNcgFYHUDhvKqSHTYlnlfuim+fMiwr4A+TyE d+8lsstQ8c/76DMNlivtlyaSYwjpbBuiY+CGjeNVqGVy4tXGALhc8vNnVvdD8fy17tMV MAOw== 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=pHOVm1j3rxxzTzvqcEEGiLi8+wjs2ljwtbn2VN1LzVo=; fh=54SyYXXl3ghnGdcQkJAiPGLp59KgHlkQMz7FX70zS0g=; b=hjmDF85Pwpab6FbCzs8c1/8zbdxsbzKP3c1C/UNw84obhfGbXY2fi1gGC+oULFBy6F tE2Naqj8t0vAXACBj9HEd1WssJ9/EVwRrvlsTZ9MVmcJqjOPJdyun09af4JKgjIjBcwj hrH4R4+q2AEQ5HRns0igqA9ymTyChqVEvol4xgozI87g+H3UCF9d1JQ/n1bkUDPO3r64 /4ocZ2cUHaC2wnEHqvinZX8ikIUurKM7wZ7bq4g/pYJncW9+FxPkXDvJ/sFwMA1SYAJe tYqw7eRoBBzYV9OHWd3SNTRSVIe06Nf8pdjTNtPvnx2qgaFJABAzAUhDPdZZ9mw/F31L vMJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JTPG/2QS"; 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 j15-20020ac85c4f000000b004055012f6c6si5723200qtj.466.2023.08.07.20.03.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:03:56 -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="JTPG/2QS"; 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 1qTCzq-0001N3-CW; Mon, 07 Aug 2023 23:02:58 -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 1qTCzp-0001Mi-Mw for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:57 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzn-0006ZZ-Nh for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:57 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-68783004143so3679403b3a.2 for ; Mon, 07 Aug 2023 20:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463774; x=1692068574; 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=pHOVm1j3rxxzTzvqcEEGiLi8+wjs2ljwtbn2VN1LzVo=; b=JTPG/2QSiPWd0gRNTL7Ng63wxMf7leHtb3axzW+MW2d4umyLPMuYlMYfZHi2SdDXuX V68s2HYJcs14Csr+Hm7k7lgNPC835EWNR+Khh9XogQOZaJk+Q/Pvg3SOROo11GmLZS/1 J2a2ITDpDZ1oezpTfzS1rlem4wvaMw37zKKnQqYJrQRY8mD+k4piPfGhEC7UJjN4UYff GLqeGp2gZOKR1VQ6RdssYMAElNKf0WxoC+CNuYIgTUiJTekofA8KaZJMHJwEWf26/n6Y kU3+3xNEIc357VRJKXfkFuQv56GzXllSZotQhhQVqppFm/tOpF67JIHB5osLhrIIcW57 h9vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463774; x=1692068574; 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=pHOVm1j3rxxzTzvqcEEGiLi8+wjs2ljwtbn2VN1LzVo=; b=MLG/0Q8k7S0gscl1CpfntApf55h3+hPQva4GwPQnRwDvX2ceoyVGGReZILfF+LVduY uD3G5S8m8tStNQpbrHyX2q8dsp4wf2ZO5RD3Q5Gp/aijp/La1L+CsftwI9ThODXB7X0z YrVJbuLIo0hwySRbecj8TAjxtQZi3dWjbspddtBOFxohvRAbKlBIisa2PRCfaYmU7yHU qTL0D8JJAb4T1joVofowkZQR4f1+n+NIN4RkDlMQIkC+E1YvnHMTl9eS0voKIqnCxiiY wNqvIGk/V03yLGDlYRD9Ccr/CMPZSuq3i+wRVRkXjj8vr73z1sKJGAV45yRwrGPVWVT4 OLIw== X-Gm-Message-State: AOJu0YzwSqkF1l+CoypKBWZLfzrPeI3Rec01AaBc1NPQkIT8JtKuUP0a HjiD2yOymfZ/R0D18YQBhQN8IQ+rOYuiosWOOUE= X-Received: by 2002:a05:6a00:2294:b0:67a:c810:3cb0 with SMTP id f20-20020a056a00229400b0067ac8103cb0mr10675440pfe.3.1691463774319; Mon, 07 Aug 2023 20:02:54 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 3/7] tcg/ppc: Use prefixed instructions in tcg_out_mem_long Date: Mon, 7 Aug 2023 20:02:46 -0700 Message-Id: <20230808030250.50602-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 Reviewed-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 2141c0bc78..61ae9d8ab7 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -323,6 +323,15 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) #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) @@ -725,6 +734,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) @@ -1368,6 +1391,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 Tue Aug 8 03:02:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711540 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1911334rwb; Mon, 7 Aug 2023 20:04:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+hbjie0pDxiJBBFYxIrYFGlIzom2M50fbO1Zl7RsmxsOD2Il5K79tFzu7w8+MF1UsizVU X-Received: by 2002:a05:620a:1794:b0:76c:a695:fe5b with SMTP id ay20-20020a05620a179400b0076ca695fe5bmr11673289qkb.62.1691463848202; Mon, 07 Aug 2023 20:04:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463848; cv=none; d=google.com; s=arc-20160816; b=i/0FRLd/B3azgajzY4ACJayQIDBAXxOzjFSG0oCRpL0eYMpAlV5jM3AEXx6WNn04Uz E+x96/vhMX1Tr4H0B/xSjxN0OjHeSZE0dN9hsxlNX6wR+gomtf6huOTjsyXjh+gmu6eY FuXBwP7wZkb31QbYgXNnn7qQUoohMc68etWIG7bF2epavyMMjqmnx6J69YalKxDjxOu3 pFpu0FSmjzJUpP+8ObTBwov2dPkDZjFjD5xBBclMWE2xn/mBpoyeS9vuXLq7+oVYvTNB YF4c0+HXFzV+Pg6di8YhkfvZpMyqqZiNm4QPL8DulFgzM3qmY5vmU0EjAmsGOE9ftDk/ NA1Q== 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=XokUtbe+DsLYWyevZrlewM8nCsy1TFXDfLF6baDQHOE=; fh=54SyYXXl3ghnGdcQkJAiPGLp59KgHlkQMz7FX70zS0g=; b=WdvJN238ZzVUKxrNTNl+e8nl4zEZFEZ6nJdwJn7P/rIyoCZffHPpIPyzDPNu+HDL8P ciZuSRGwgUpBr1S0s2Xw6qH9ktopnkYDcekfWI40Q4FFuv6lqc2Scz/l5riUQe8Stx+W 7de/cqUa5IgI6aRCDNaJpapgtnvH492o5TjAptqIkpcpbXVmS8KxLiW/pjRpM3635BUb PTAp1NfKqtAMY1D7saZSTxj1QRykpMXiUSbIreXpkiijL5iY/snqkgf3e9IcJ0tXS24E ybC1lHcVTXU6MWRYn3tWikPzdvhH3+clhtHdmmPmkuVXuT1mHRAbJcxPBaH5Zaq6pgfj Pvhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wPwKuh4W; 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 x13-20020a0c8e8d000000b0063cb0a132b6si5684115qvb.199.2023.08.07.20.04.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:04: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=wPwKuh4W; 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 1qTCzq-0001NV-Um; Mon, 07 Aug 2023 23:02:58 -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 1qTCzq-0001N1-8u for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:58 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzo-0006a4-O4 for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:58 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-686f8614ce5so5175119b3a.3 for ; Mon, 07 Aug 2023 20:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463775; x=1692068575; 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=XokUtbe+DsLYWyevZrlewM8nCsy1TFXDfLF6baDQHOE=; b=wPwKuh4WUGKaOcRqdeltxuwtQCALNgXPFt1NZHzkK2wYgCqOXYWdVqySlg5t+IAwyB av4RqWiaD6QTfQ1kuD7WS+6sOvXD15Qpf/diLzdfczPDtoJLre1K7mFwTWpDqUxJ/spg Ufclm8ZhPAmZLBfGFDamVeDy6lc1ggbBRU+XfDqMwtSIVH1yAJZVnTEDWuPuhy0mmxVi FvEX/xjnxDleeVg/1xZ0AE/hat0wefIkCGqHb/1nsU8LuYAGV4yk/I15UgdpK27+vVrj /mDCsZNR5Rd2wd7uRric4tU/A85NSWQGMJ6NX+XYp0kvPwPkcGZE3+yBuOMre6lGZ2qX ksOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463775; x=1692068575; 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=XokUtbe+DsLYWyevZrlewM8nCsy1TFXDfLF6baDQHOE=; b=Ih1XsjGiCwsXeLqApKubceIObfeuIJsfaANx9lHPg4L1y07rhZ0ziBV/clg7T46vL/ LjcNdBChG8DCw/P+vmc3oz17LhP00XCFfmX0dUemJ5xYlf4jMMIj7h9qM7sP1wYgZWLx p5L/PFy9IRyuPXb3Y9Oo5bASeXc9rrZbYOiHtkPqSaCsBoZ1u/DBGUhFQdYadsClHn3V 9JSvCr9ZiiZCpKlM42pVyHF2yvCBmkP82GrDJvV01Wv4+Hziriy60ZvtvzU4QsyHMb06 Zpr5VVfD2w6YdLCyVomdNOpJntZTyGn4GZnCVuqSnF7R8qmVB9d32ykNFjKMgbESmA/1 Nfew== X-Gm-Message-State: AOJu0YzLzW1bVhTprPEYl+nr5dDBko/3sEOtA/A4MddzYKOHKye+4fAT J8gRswHazkg2sOvAxip+DhHKGSMiiCWWvpPA93c= X-Received: by 2002:a05:6a00:1305:b0:666:e621:d83e with SMTP id j5-20020a056a00130500b00666e621d83emr13765296pfu.13.1691463775303; Mon, 07 Aug 2023 20:02:55 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 4/7] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Mon, 7 Aug 2023 20:02:47 -0700 Message-Id: <20230808030250.50602-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+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 Reviewed-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 61ae9d8ab7..b3b2e9874d 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 @@ -260,6 +264,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) { @@ -684,6 +701,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, @@ -1111,6 +1130,11 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } /* Use the constant pool, if possible. */ + if (have_isa_3_10) { + tcg_out_8ls_d(s, PLD, ret, 0, 0, 1); + new_pool_label(s, arg, R_PPC64_PCREL34, s->code_ptr - 2, 0); + return; + } if (!in_prologue && USE_REG_TB) { new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr, tcg_tbrel_diff(s, NULL)); From patchwork Tue Aug 8 03:02:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711542 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1911600rwb; Mon, 7 Aug 2023 20:04:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGv7O0GkFhzQ6EZbLvQgE+JcTVd6oddCOkOlJ5Mqmop6765aLXtz5uXSbQ7z8PCHC3er73B X-Received: by 2002:a05:622a:1a96:b0:405:4816:6eef with SMTP id s22-20020a05622a1a9600b0040548166eefmr11178771qtc.24.1691463893901; Mon, 07 Aug 2023 20:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463893; cv=none; d=google.com; s=arc-20160816; b=MHLMNwIcZ41JEs8ysroT7s6qse45VzZX0Mo+Q9WrZ3DrrAADfdpcDPVKZTz82ON6Mi t2NLxyUN8MBSaypRQxTuXSeHz+EkpmecNQkV7YOmCAJREenR2cjOB+8kra9RxKseLDif +AQmpWul6V1x+IyU7KMzpDPABx4tlGAJqYYNjkm8oG0cUsEEYfRSfQhXgdKMNRFAQjrF teV6naluVHUCcsofhDaMNty6bN4GLH33Rb6zC1brfuCj7I5768jnD564nhdTEsMzZPUP n/N1eW1XJwSQlPIj2tfbYkCA7nQ7JZSYQt0RxPk5d1o1YxGC3CMUhNACg4rCpdCOxiGt FfyQ== 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=dfIP5tcDs8OviC0N81Mxzhk3p0beETYinc+feTbvQW0=; fh=54SyYXXl3ghnGdcQkJAiPGLp59KgHlkQMz7FX70zS0g=; b=OcdfUM36FUGGoiIBIa/pfXw1pS5uNdYV1dKXkF1k20+i++snnSkdmo65/X6/725rBJ iVXtLLQrqLiNGTZJtj4Eajz5bZjyijgqNJikzQpf7snxiUyIl6idjO9ECswwHaLnmmkK k17WKZYfQJMDnOygXFo0Wi5w4ok9a9GTB5mDViczYglyH/e9SJJivZSIbmh71HGllDfz EpnbIcBkz5mCyaeEEH+Xui6wRKr10HnDmEPz1lsll9Z5RjPSF3ZnCldKsKqSdMzzhzXe x93d+tW/iJ/gf78iuvIKg/EXursSrBq97IR81kMEYIk1RwvSG7zzew3MBVB+pVGH8xSd ym5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NBZq6U3W; 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 x20-20020a05622a001400b004055a48136fsi5581944qtw.129.2023.08.07.20.04.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:04:53 -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=NBZq6U3W; 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 1qTCzs-0001PX-QB; Mon, 07 Aug 2023 23:03:00 -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 1qTCzr-0001NZ-4S for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:59 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzp-0006ac-KV for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:58 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-68730bafa6bso4098654b3a.1 for ; Mon, 07 Aug 2023 20:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463776; x=1692068576; 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=dfIP5tcDs8OviC0N81Mxzhk3p0beETYinc+feTbvQW0=; b=NBZq6U3WPaeS59sHrT8JZG+IX4ZN628sKtQweWvB/KVDPd8aECblcN6YfosewUxTdN hktUfcf29KyiURkrXTmffqB6LUMGNrvHZO6v2xKAdQOAnkBU2ESUZK3FW1mYd7WjK1Sx KtsrErlgHkQEvZvK2dUAC/plJiKXQQ9Iz4bp5oV9Ay92Fzza07//ob6B+J3fiPul3KMN qQN5fnPabEuqF2jE8NriIAZfTdRYCJBZJ/nFk/7zUiLRRZR+kLsqZ++8Gp/p/Yby+ASS 2KzivUdsHCNUk3s3xZqduxbzs+MSLZW087u7qoDANpGLtn0jP4d2TwEaJwcZqOuwc3dw qE0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463776; x=1692068576; 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=dfIP5tcDs8OviC0N81Mxzhk3p0beETYinc+feTbvQW0=; b=ae8MY/kmvlH6DwZvo5FNuIF8yzx8rZAeDr5E0SxNbUOHloKALZpbVT2gzn/hQG7Sbp cPBeX/fGLUPre+8i7DqKNnReLcFGB6Pog0cicNGEUzbbBzljg8A5BroZKvWR11TIaFpE /H7tx/GhmhKPifsn+BfnuXtHae7984HEXDLJw0KrR3axFFaCzs34ZMtF30TFu99mMUKy 3ZFFPlbolePRpUyeAk8y65EBRxVSiQjHYp1o67ERMXB73GMhEM7ixMZFXm3mQYXxM01w f20OJQ6fMbmgmCO7qM4TGSLcyPxvON341VdZ21eFooVi/xjuaSX23EEU5fA1H/ViAL6i TJhw== X-Gm-Message-State: AOJu0Yz9g04MVbtEtCJ0BnrOYxZBcbHO0EDW+wRh6nP+Y4utYaCwGtW7 +BcGpWXUYnlc61hEPaBUQaKTg+guznLeKd9Wd5c= X-Received: by 2002:a05:6a20:440a:b0:133:38cb:2b93 with SMTP id ce10-20020a056a20440a00b0013338cb2b93mr11346174pzb.9.1691463776330; Mon, 07 Aug 2023 20:02:56 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 5/7] tcg/ppc: Use prefixed instructions in tcg_out_dupi_vec Date: Mon, 7 Aug 2023 20:02:48 -0700 Message-Id: <20230808030250.50602-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index b3b2e9874d..01ca5c9f39 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1195,6 +1195,18 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, /* * Otherwise we must load the value from the constant pool. */ + + if (have_isa_3_10) { + if (type == TCG_TYPE_V64) { + tcg_out_8ls_d(s, PLXSD, ret & 31, 0, 0, 1); + new_pool_label(s, val, R_PPC64_PCREL34, s->code_ptr - 2, 0); + } else { + tcg_out_8ls_d(s, PLXV, ret & 31, 0, 0, 1); + new_pool_l2(s, R_PPC64_PCREL34, s->code_ptr - 2, 0, val, val); + } + return; + } + if (USE_REG_TB) { rel = R_PPC_ADDR16; add = tcg_tbrel_diff(s, NULL); From patchwork Tue Aug 8 03:02:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711543 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1911633rwb; Mon, 7 Aug 2023 20:04:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYXuFtXLGBICt8Cv33ZUNI3h+QIOyED6V6ZlExhrsUfF77InFRWy7onvGP8qw0eUNTCuRo X-Received: by 2002:a05:620a:2991:b0:767:1152:aca7 with SMTP id r17-20020a05620a299100b007671152aca7mr16227160qkp.36.1691463898324; Mon, 07 Aug 2023 20:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463898; cv=none; d=google.com; s=arc-20160816; b=sw+3RaoKskdsJx0I5Lo64dsutmY57ArDmXU2AOQ/5YLl8avz4OveZz80qV8uqI9wpx uoRuebZeVWzatxngvVs6/FMD07FRWCl0ZwcWzO376t/8PGLgRwyDbJQvwy9Uh14TENYR tFSe9dujEDjFPgXT8m0xY9/Z85wFPeocXVjioARjMeniq/sKhO+LBJs3j2yQHgBHLXeP idW+TduvGf1PY559r2EX7Q9a+66A9IKQovnrmq0oLwFFeMYeh/NRRlPn0BmeLv93gL/H st/HKQlv7laAhVNIPFRUjLtneQVYaxUKoWNj5pNH7HK8tsOn8d9hCYSd5I/w8XqnbzTI Gx2g== 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=6EwDdAjnwUPowWvaCh4C85jrngqIJ8regtvwyJyUpkk=; fh=54SyYXXl3ghnGdcQkJAiPGLp59KgHlkQMz7FX70zS0g=; b=TuQ4GEzEZJHmeeYAGlhcufqoSEyFHgvcNfVezdoTvacXNNyjOTFNapxr/ql+emh8o0 cNddCK0X7PBhL4/Mn+nOzT/9gIuNnO3G2cOCEFDoFPh7o6ZfvYb35fE8Wcs2+Vgq7Rdy 1xVNwYNcmmD0VxfbR92UknoFmDWaq7o90EAYCMLjq0L85b1O+fqMWaBh3GoQOWmmYUsU jBhyHuRoyrgkV1T4cpcR4aSh6kYgzkuKMkBb6JzpZ4W49Th7y9r4CTkXuuGFlvZ7FHAy 1Q7LXqR88ddRMJjfLQcILAdngQyOBmfyyHWU4Q7ksg5thNNFqN7nBupvBZYear29SpeQ sKXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cmyfsx4s; 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 rh12-20020a05620a8f0c00b0076c87073a06si5538383qkn.629.2023.08.07.20.04.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:04:58 -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=cmyfsx4s; 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 1qTCzt-0001QX-NW; Mon, 07 Aug 2023 23:03:01 -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 1qTCzr-0001OK-VB for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:59 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzq-0006ay-Jr for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:02:59 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-686d8c8fc65so3555815b3a.0 for ; Mon, 07 Aug 2023 20:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463777; x=1692068577; 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=6EwDdAjnwUPowWvaCh4C85jrngqIJ8regtvwyJyUpkk=; b=cmyfsx4s5KsAd/fy6+fkyMra+OvBCKCWoGbGe1umVDx6AI7ehKmP/KB73+umRqtfzo /C7XqRy4EAPpLkm/mAcSGPZxM2t0HCvHokJjpZ0LNgPXhMabkdKuG+UUD0KGT/CvMRpc j+CJgQOnePiAE+uTjS3i8uEpqGijSD9wVxRlKZKe+EUJjgtLJ9cRYnh7ScI6ZN1gjC9z C2ze8kCdjEjhyQeXeYWpCq7Oup9ChxRNCh5FWHEPeM/L9urfbbZ6f92runuZfH+7+tPL PKb2BfI7PLP99P51JIS3qnQk4KX+jnmLDKOpEGpW67qLjnyBxC06kdcXl6rEhyOMmG57 1xfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463777; x=1692068577; 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=6EwDdAjnwUPowWvaCh4C85jrngqIJ8regtvwyJyUpkk=; b=C9k1tX3eq0xQFODvVU77CspLew6aaGmoV2kEx+m8PjO8U9LpxomLPY6VwzvJhqtQyF R9TdIsKUYVe2m8BPN7hxDCk1LNglgHhecZ3JmkWn+1rH/0gFkx7zRzeyfiKg8eWR/499 7Y3iU6ekCLJDbz8MtaKgLxz5b8cPP909QlEnqjDFFyV5lvts2z9L2Y4WfbJzUd8mnslw VIuO9naLQMYV++ELsDg6Iaru9CTykm7Dv8KlaFKRnlpZWprR3g4p/Ln/61FU64NBEM2j IzD7xO6C0RB1S2z4Dmf4E2c0h6dWEeiRLV8xFsVQACDZWMjvVX1DjqDwUhDyo7ZESn6i rHUg== X-Gm-Message-State: AOJu0YzrJMN82kaheRDRnQTEQbqrQwuiqTracHCgUahmI4e+tU0mwgU+ yLcLzswug+VhLKJkM/Qg8c/wxWOmXIiisekKlPk= X-Received: by 2002:a05:6a20:1612:b0:13e:14f9:294d with SMTP id l18-20020a056a20161200b0013e14f9294dmr11430325pzj.58.1691463777057; Mon, 07 Aug 2023 20:02:57 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 6/7] tcg/ppc: Disable USE_REG_TB for Power v3.1 Date: Mon, 7 Aug 2023 20:02:49 -0700 Message-Id: <20230808030250.50602-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org With Power v3.1, we have pc-relative addressing and so do not require a register holding the current TB. Signed-off-by: Richard Henderson Acked-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 01ca5c9f39..63fe4ef995 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_10) /* Shorthand for size of a pointer. Avoid promotion to unsigned. */ #define SZP ((int)sizeof(void *)) From patchwork Tue Aug 8 03:02:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711539 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1911292rwb; Mon, 7 Aug 2023 20:04:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjFLKxQ9u6ibYolG4HDH0LiDxC5ryPw+N+TtqnGoyhKRiSGVeTkMjClJd0CaSNEiPRkHE9 X-Received: by 2002:a05:6214:5089:b0:63c:f325:5aac with SMTP id kk9-20020a056214508900b0063cf3255aacmr9193536qvb.19.1691463840339; Mon, 07 Aug 2023 20:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463840; cv=none; d=google.com; s=arc-20160816; b=h7OLQT7NcOmgApraL6VQ1Pek3nwsKdFOQudVnC3VfNlPn+HFvYU1zkgRQ307f36H6v HLmOyy0K++fBcDABR1dY5IZFejdE9zUtgZsSCOrvFVrqqM79L1qTkIYNwuObGMiU+Td2 /tXD+x1ejeqC1m5F3VEG7L16xoe50ssgizDUMndFWWdxhZXOJdECZ0nrnrq5S/ZqJeh0 /+1Mkk6/OMJIvbTU5ze6uzM5Bf7Edh9jFgLHdUHogAJ37zq7z6ZQI5wxlwYkr6B7O7iz lR/iZtRW4o213LLvhzQK0W3au7ZRGb3oGO3619brQYeU0yfs/Jp6QnT44AdRI4bfA0lF KjFA== 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=V+PZ+MkLecLrqPhUWEMZ8qOCbS3Yrr8j9Pi4RnELYw4=; fh=54SyYXXl3ghnGdcQkJAiPGLp59KgHlkQMz7FX70zS0g=; b=aCmfvLIh2Owu1i+9+gXMysZV2QsrRUOET3+ov/ON9L5/y6wUY1DO/gqESuVp5nk9+n dyFkQw/lLUy6Qo0o3CpLKRo2x8wh3UrE6moLH2bq1cwyRhvodjXvJZFRQPMeBEEhA3g3 VWVaWz38hUR9+JjajPTcP3bnyv/EwtsndrBHH8MOEeMN69+hYhaH88G+f3rohVT5YTS+ 25dqvv29MSuPgTb47CFD9o0/Gb4VKegEys7S7MOpg7S57Y/LgVUpaktgIPyGoGgYu8wi 16bDwYlbuhC4qcG7Thzqgd8GTSgZLJc/9L71ILODw10k+Fj0SZfZ0MLN+3BVtldJWGuP +drw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vXRjsnRX; 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 fi11-20020a0562141a4b00b0063f7ee275dbsi3547463qvb.70.2023.08.07.20.04.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 20:04:00 -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=vXRjsnRX; 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 1qTCzu-0001RO-Ro; Mon, 07 Aug 2023 23:03:02 -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 1qTCzs-0001Pc-Uf for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:03:01 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCzr-0006bR-B6 for qemu-devel@nongnu.org; Mon, 07 Aug 2023 23:03:00 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686ed1d2594so5014317b3a.2 for ; Mon, 07 Aug 2023 20:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463778; x=1692068578; 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=V+PZ+MkLecLrqPhUWEMZ8qOCbS3Yrr8j9Pi4RnELYw4=; b=vXRjsnRXqv7Epg9Yr7JAj1qV17tS2XgboGE851OTloUZr0pD9l3+p+5dzLi9B9ArgV oUk9wBxCCiaeJyj3LsjjzHYEAeYRlY8qLVnghzNXIyqMzlx2zynbBE+9/oqAJ6J8Qxdi QiswrpJR+7Lii5O/JXc+Jc80XXarx9J1unYk3z0Ho9yEB1B2uQa5X1a5mBvzyAPpjaCB /2g1HHxWQn8MqeUrknZipX3l2pNrDhDIa6vZsYRO6DLCy9E30e5i9aT8pz/7jrsOFYSF v8yo0NAFB+8RR7TBbzRKzDPvV/GOltWKXfK2/eZky6Y6scG2ZKfmD1cB1SzSPz/+LvSK KFiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463778; x=1692068578; 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=V+PZ+MkLecLrqPhUWEMZ8qOCbS3Yrr8j9Pi4RnELYw4=; b=DEsT04vJ8ESyFAOZoEfgjmqJDnAaw9hmRCWvEZ5oT+FK1JLLyx9jCyXCSxpfFIU0hF X8hf8o16RVZbW0MrWVh/nKnJ3oGsUXD4/eYrCWvZnPy6x2VTlJSSktMZ18MJ9Bm0/RfU +WjCVHntlVfn8QRJ+EZB9tj90ul8LX58G6S8x6RNKBAEnZzfsY5yMP5zDxLXnyVK4zHW ZxysvKM25r4h6tLF7/TofNYX9FN5EeuvTkJ2xW0+D/rhSEf7x00+Ko06yVBa+YBfhHJ8 VLWq7+j0itgU1cdj79bzb9gb1AE7hW6swdvekg+kTttgfrTiDkWvmbhwWWfvZ52YoDWA 5dfQ== X-Gm-Message-State: AOJu0YyU8UfnjBB2qe83Ke0It+mbzbHHWGbIfMrMdr6ePYv0o8+1zkpR FUVG0+nW/3AIYOkndOuUZD5YlBaH+ifOF+7lNik= X-Received: by 2002:a05:6a00:1488:b0:687:6184:def4 with SMTP id v8-20020a056a00148800b006876184def4mr14000203pfu.21.1691463777951; Mon, 07 Aug 2023 20:02:57 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id r7-20020a62e407000000b006870c50efaesm6903609pfh.9.2023.08.07.20.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:02:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: npiggin@gmail.com, jniethe5@gmail.com, qemu-ppc@nongnu.org Subject: [PATCH v2 7/7] tcg/ppc: Use prefixed instructions for tcg_out_goto_tb Date: Mon, 7 Aug 2023 20:02:50 -0700 Message-Id: <20230808030250.50602-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808030250.50602-1-richard.henderson@linaro.org> References: <20230808030250.50602-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 a direct branch is out of range, we can load the destination for the indirect branch using PLA (for 16GB worth of buffer) and PLD from the TranslationBlock for everything larger. This means the patch affects exactly one instruction: B (plus filler), PLA or PLD. Which means we can update and execute the patch atomically. Signed-off-by: Richard Henderson Tested-by: Jordan Niethe Reviewed-by: Jordan Niethe Reviewed-by: Nicholas Piggin --- tcg/ppc/tcg-target.c.inc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 63fe4ef995..b686a68247 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2646,31 +2646,38 @@ static void tcg_out_goto_tb(TCGContext *s, int which) uintptr_t ptr = get_jmp_target_addr(s, which); if (USE_REG_TB) { + /* + * With REG_TB, we must always use indirect branching, + * so that the branch destination and TCG_REG_TB match. + */ ptrdiff_t offset = 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)); - } else { - /* Direct branch will be patched by tb_target_set_jmp_target. */ - set_jmp_insn_offset(s, which); - tcg_out32(s, NOP); + return; + } - /* When branch is out of range, fall through to indirect. */ + /* 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 (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 { 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,