From patchwork Tue Aug 15 19:57:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713800 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968322wrp; Tue, 15 Aug 2023 12:59:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKbzboHXUuHkEnh2iX/WfY0u4U4/r2UNh/y0Y9IeberM9A7o/RE5iQUX76ghVL98KZEYvi X-Received: by 2002:a05:6102:3d7:b0:446:ff4f:bfff with SMTP id n23-20020a05610203d700b00446ff4fbfffmr12511249vsq.28.1692129565902; Tue, 15 Aug 2023 12:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129565; cv=none; d=google.com; s=arc-20160816; b=ixUGcb04FQbqcREZs26yJ1D6zvSXsUjuWiACONoFG1DxwevY1u3knlrUMAH8CojZ82 uniSygwXBSk1tdJgqFP7IFAPDCNSIDTo1x7dzGt7md/vHDMvVNZZb9YSnJuyPhZAdX6I RyY8gsArOfUPLArFFYWQnpNdbnRUEKeYKXfd90iTntGUkwND92Y6gHbRtgOyY3vJKK06 N2cQ2qTpmjgW1nhsfdTeawW9xJ1CZCbW3gEcItruUb8HV3ZTORlnIBIsqx9tcSWyj1iL BU6qfOsRMdwzswtE+zUWWHs8jillc+L5F19dwMoVdNbZLUjPGkCDdj+FT37jvZVI9I+q 7zCQ== 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=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=gJ2NyDkCQlGA6S1fBNIxH/eXKb0nmwcUiHU/7Hz6E3ibAKzKwvPEKq7GDNy5Vqy0IJ 8Of/k/roTzEfiNmqtML1acYR5m+PURvfDROJ/Uve2+zNXTKluTeN5Ql0rxsvaImWmbQK Z2RxwfIqla6u0/NAZotMoKGwaMbPkE82j/ehy7YnAXf3RCmMnua3X2wgRK2sk5qYOHh5 jyJ4LvZYTyNHb5thzJdymLSGVFFZ1pGCuBvO+sP4fkfiKOLjj0Ltu/qswlrqFlRP5vCA 03B4OrzvJOoD+g3jEF+XMBWZ3LRGoxdH0gGPqwJM6VC4swKkplv/3TbiWQuSH55Acz8L TiEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n0Z6Cu6Z; 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 t7-20020a0cde07000000b006475edb99d8si276333qvk.511.2023.08.15.12.59.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:59:25 -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=n0Z6Cu6Z; 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 1qW0An-00053O-Rb; Tue, 15 Aug 2023 15:57:49 -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 1qW0Am-00052Q-Nv for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:48 -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 1qW0Aj-00012Y-2h for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:48 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6887059f121so586475b3a.3 for ; Tue, 15 Aug 2023 12:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129463; x=1692734263; 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=n0Z6Cu6ZV7rmZah9JdMSjq6mIdC1qR4M4a4aWFe9U52OIBflhWADyfCn1b0qaDbGO9 2OVQg5YGC5kamq4YUm5LnOkuBBZdoJkHp1fb+/SfHZiHOvx1NrrRkd4HM+epfVHiU+lz Dlezj4sTuvN+3Uz09brVGJf2RKeQHvLxWs+KPn9YmZ6Db4oOWKth6Q63Gy5ZFlxgCUMM bkc3lfQmMjtF48j7pNvqlQRiUeJyV7O3lzqgHRDQ9SSVGxjcWxGaP6yDy6T2GqRaEbI6 BwyfWlVLlqT9MU79TDl9rZq2mufolp3k70ztNh7IcOomZw7yU7OBqDiaS2NvSaAkWAn/ /w5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129463; x=1692734263; 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=gRR1YK16sXqBeApujxapEDs/trm8F26B9Lzb89S9DhtD7SHg0Na7y+LsnJNadU4n+F Q4MrZ9mfcum/9XS6wzyBoalY8LotPdc1drtZf7rwq60Q+jd/EgPnpn84+7mgZmRoBjnV tCZp46Atf9fOH836Y486JgHSxH8UXA20bfBzKI9P5a6rctPteMiXvWjDSrxjn/3ePLb+ MvyMPviZ5b+j8207U6YJpLMvQg9tlXG4QviiNfk+F4+FIC8j60AgGF5ZxoOYbxlsRXX1 TczxoXNo5O8s/EuuksU0WTX4KTBhjHgB8yKTKO2pnUc077yFpOZJZYNSMX4D4iBKXheK 7uXw== X-Gm-Message-State: AOJu0YxHSBmiTReYb+aCcFfRtzeVmhCG/J5IlGhJQ00aq+R+CvedzyIE cipati85ZsXgeE4DVdsCtD+TWk1nS3tDjqdYokg= X-Received: by 2002:a05:6a00:10c7:b0:688:535b:717d with SMTP id d7-20020a056a0010c700b00688535b717dmr2132919pfu.30.1692129463505; Tue, 15 Aug 2023 12:57:43 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 01/14] tcg/ppc: Untabify tcg-target.c.inc Date: Tue, 15 Aug 2023 12:57:28 -0700 Message-Id: <20230815195741.8325-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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=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 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 15 19:57:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713803 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968595wrp; Tue, 15 Aug 2023 13:00:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9ebgBHxP7x7+B4qi4s679s7WP/YtmmZ+Rh4fx15sFIYM76r7t07DX52XFN6Uh/Cvb/wA1 X-Received: by 2002:a05:622a:1a8c:b0:400:9896:b0fa with SMTP id s12-20020a05622a1a8c00b004009896b0famr18444813qtc.64.1692129606799; Tue, 15 Aug 2023 13:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129606; cv=none; d=google.com; s=arc-20160816; b=HjtiKOLRVL7HUOzSRRXb+MwxACxhhlshpGVcUGCA+jJ3BhBVsYIPi0UThjrtNNEgn/ xKlMfKyp0wgvJpDD7qeurs/wjSs5KhdBkGB8lkgwKOl+nNeXjQT6g15+AVj2U8UloaJU Rv48H14xY+yLLb0suLBiXneywfabOObthfJLO9vul99slzcnJfkQNHk99TP7GJaEgZi7 w5HW1SOMo1RVkSweDLBEFokd4x5J5FhubQaVChaDPnPkU71jP2BnEt8V7bh6rk3D5lOX vmvjKL4M3VL0ATMsD0Bf3Y3ntLOBLiHn8voqmkCi42XgaWG0U4+mSqOFp8uQR1kURAPh QzfQ== 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=3Hu8xuNnDAHTDqTBUhJjYGuMUXSC+Qs+gzIxHF/zrlE=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=H3nGu8UGvcR0ijnLu4uUdNtpL7m2oSrfWWVNqGvUNSTEtvWTrxlJxb1JNH7VqOG5t6 FG8rr8jdkF0ugmxUQfzjJhSpNkqO5zzcIcEHMk5Ft1blQ4g5nnMM1GiGEyrb86nSaa9A i18pjR5/HEWCgjKFF0ocPlql4sHHsYDjiSJcgTTUMqrucQvKr5mhs7nUX9LKPUd+kx1h g/7pDUR7kUiDoVBHkBlvoGSeNJ3I1wVLFv5Rlt0mgR5QIVcnJ585Ss+axqx1DAe3EhZl ArEf/OHs6hHiBQ/5557q/vPRb1wH+98qWboMpXhAh9fDQAeC2m3QH9PRYHTVx4aezPsg +Drw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AYYBe0lf; 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 3-20020ac85903000000b0040bc1e50bd0si7674771qty.422.2023.08.15.13.00.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 13:00: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=AYYBe0lf; 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 1qW0Ao-00054D-OL; Tue, 15 Aug 2023 15:57:50 -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 1qW0An-00052m-7F for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:49 -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 1qW0Aj-00012k-Tt for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:48 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-68859ba3a93so602386b3a.1 for ; Tue, 15 Aug 2023 12:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129464; x=1692734264; 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=3Hu8xuNnDAHTDqTBUhJjYGuMUXSC+Qs+gzIxHF/zrlE=; b=AYYBe0lfD2Lt/zch4WP35v/tZhp5fIfxxeuHsd0sBQlMeHGKkDw2SMK9qaq2+yF2K+ pKkhtcb0eaU05uAMNrBHpbBE2ZSzrrqQ4mX2e7VS+s8swV86cUkvvlFrh0ccva/JBXOD uwOwWx9Yvh4CZUk5pP9Uiyb5IBDxh+kqciuZTmiDh1wJC/Ck2jeUYZed8/ihX5IbPVl2 qT2rZHZnoUNLUT0250meCGF0SsQqhNRW8zX4lp9oXkADLyTW6/3QHwcWR8yTXILRGzuF WNpv9YYa2ByMsCBxmOjCKWXJgQYbNQIIaimIZqKJugAobLuPB9/+nxQJuY2nAse9X7hP Jy8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129464; x=1692734264; 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=3Hu8xuNnDAHTDqTBUhJjYGuMUXSC+Qs+gzIxHF/zrlE=; b=OPMtZmHdMx/n3vJoaBb0YpuTB+L1sot7qo3yCSCdqqYpIpbX5YN3VJ3azwQke12SMl mEG3fxY6fSoI9kpFzjNg00RAriFkK/+2KmQpoo5CyIhcV+i0ePDpHwRwfEJaB3EFhJ0S ocbHn4XdRQRHfEx5Uy6AxUIPS9oj0AcSW0vq/EQjzU1Shy1sLQLg7XqLG9Ty/HP5pa30 zVhUbaFXomhroT4XqzaUuoW2sQo/sofs13pf4utOAxjp43eAaVb7VRZJflRDgxSEoVV7 2f04ziRJNybpvGjNiKoWQPHvIWhHikTk42Vwd8K8vQPuVjR7lwh9xsLJvHwv2XseJmxy z5Yw== X-Gm-Message-State: AOJu0Yxp7YmFDYTLZpN7rrm5Vu1dBv/B9O0PdEIXLoZOiYt5jG7wggd0 i0EMQby/a+kMY1D/75TpzJr5dyE5kT5Qm7sPcJw= X-Received: by 2002:a05:6a20:6a10:b0:132:cd2d:16fd with SMTP id p16-20020a056a206a1000b00132cd2d16fdmr13416246pzk.38.1692129464547; Tue, 15 Aug 2023 12:57:44 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 02/14] tcg: Add tcg_out_tb_start backend hook Date: Tue, 15 Aug 2023 12:57:29 -0700 Message-Id: <20230815195741.8325-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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=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 This hook may emit code at the beginning of the TB. Suggested-by: Jordan Niethe Signed-off-by: Richard Henderson --- tcg/tcg.c | 3 +++ tcg/aarch64/tcg-target.c.inc | 5 +++++ tcg/arm/tcg-target.c.inc | 5 +++++ tcg/i386/tcg-target.c.inc | 5 +++++ tcg/loongarch64/tcg-target.c.inc | 5 +++++ tcg/mips/tcg-target.c.inc | 5 +++++ tcg/ppc/tcg-target.c.inc | 5 +++++ tcg/riscv/tcg-target.c.inc | 5 +++++ tcg/s390x/tcg-target.c.inc | 5 +++++ tcg/sparc64/tcg-target.c.inc | 5 +++++ tcg/tci/tcg-target.c.inc | 5 +++++ 11 files changed, 53 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index ddfe9a96cb..1e9b7433bb 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -108,6 +108,7 @@ static void tcg_register_jit_int(const void *buf, size_t size, __attribute__((unused)); /* Forward declarations for functions declared and used in tcg-target.c.inc. */ +static void tcg_out_tb_start(TCGContext *s); static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1, intptr_t arg2); static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg); @@ -6009,6 +6010,8 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start) s->gen_insn_data = tcg_malloc(sizeof(uint64_t) * s->gen_tb->icount * start_words); + tcg_out_tb_start(s); + num_insns = -1; QTAILQ_FOREACH(op, &s->ops, link) { TCGOpcode opc = op->opc; diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 35ca80cd56..8d71ac68f6 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -3123,6 +3123,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_insn(s, 3207, RET, TCG_REG_LR); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static void tcg_out_nop_fill(tcg_insn_unit *p, int count) { int i; diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 83e286088f..7473b23672 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -2951,6 +2951,11 @@ static void tcg_out_epilogue(TCGContext *s) (1 << TCG_REG_R10) | (1 << TCG_REG_R11) | (1 << TCG_REG_PC)); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + typedef struct { DebugFrameHeader h; uint8_t fde_def_cfa[4]; diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index a6b2eae995..05581dd89d 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -4114,6 +4114,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_opc(s, OPC_RET, 0, 0, 0); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static void tcg_out_nop_fill(tcg_insn_unit *p, int count) { memset(p, 0x90, count); diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index baf5fc3819..29281e954b 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -1698,6 +1698,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_opc_jirl(s, TCG_REG_ZERO, TCG_REG_RA, 0); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static void tcg_target_init(TCGContext *s) { unsigned long hwcap = qemu_getauxval(AT_HWCAP); diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 9faa8bdf0b..b4da737dbb 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -2628,6 +2628,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_opc_reg(s, OPC_OR, TCG_TMP3, TCG_TMP3, TCG_TMP1); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static void tcg_target_init(TCGContext *s) { tcg_target_detect_isa(); diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 642d0fd128..97b7697921 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2482,6 +2482,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out32(s, BCLR | BO_ALWAYS); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg) { tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R3, arg); diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index eeaeb6b6e3..22834d087b 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -2054,6 +2054,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, TCG_REG_RA, 0); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static volatile sig_atomic_t got_sigill; static void sigill_handler(int signo, siginfo_t *si, void *data) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index a94f7908d6..379aaef1e5 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -3457,6 +3457,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, TCG_REG_R14); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static void tcg_out_nop_fill(tcg_insn_unit *p, int count) { memset(p, 0x07, count * sizeof(tcg_insn_unit)); diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index ffcb879211..6458ca202d 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -955,6 +955,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_movi_s13(s, TCG_REG_O0, 0); } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + static void tcg_out_nop_fill(tcg_insn_unit *p, int count) { int i; diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index 253f27f174..95b3352f82 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -955,6 +955,11 @@ static inline void tcg_target_qemu_prologue(TCGContext *s) { } +static void tcg_out_tb_start(TCGContext *s) +{ + /* nothing to do */ +} + bool tcg_target_has_memory_bswap(MemOp memop) { return true; From patchwork Tue Aug 15 19:57:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713794 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968123wrp; Tue, 15 Aug 2023 12:58:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5F8HkdcmF00wZk1U8BxPCf/h9HrdGF8O2ontPA1hyWB2bCbMYUNw+pax612FED9+NxASI X-Received: by 2002:a05:620a:3915:b0:765:6524:8441 with SMTP id qr21-20020a05620a391500b0076565248441mr3458245qkn.22.1692129528008; Tue, 15 Aug 2023 12:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129527; cv=none; d=google.com; s=arc-20160816; b=l5HIz6bUzZidNF73R859xgTSBQIkMpsQmxwx1JT0/UTZF6n+GAVFTkpLkgugIc5pn1 L3fxdx9LwJ9T33JRBQ+A8oXs+7wY72+FPAMlrayAj8Ggqa8nfejSYTIJPcMMkw+rdEJC nMXOA6fGOr19PPNEHjTNOc9/LzIYZSYfaVAl8ltcdzW1ZN0/LYm9chIe5X5rR/9Aykrq BT1UG/gRClkS+LCF4dPU1ry2pxRf9vPx8P/ReedibvfTWnxdZMWfpENkN3YfBmwi42bG GDXK84y9UGd3er91SmQzDT3Kh9aVXWzllI+Xnq9UyZKEh+XqtOoWrGukE/BdVmKQ8qXJ oMSw== 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=RJZ6ogXJOw0J2MAEkk8rAYiluI26jV6bi5dyyeMPndQ=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=aiLRYsTsvkYoknR2gA9bOLJzeNNzuDyR8IF8SnsPHsnFGL9s4cbitVuoSiWVvAZ62X r5I66ti5zSO3Rv+dGcTxjp04JvowpGcecRgW4SGBJRkpQfrB0Ors7gfBADkr2c5kw0qk kkBdGpIcvFOzFGGaO+A5DshUn1+1jD9SN4ZRE+8PuD0u+6h9woCAy/U1xtkvQgIccm46 MxqeLsGUP2UELjRqbOjAj7wJ9a1SKV7A+vTZig/nQ5ncbogvnSLCjNlqvnPLsLcxsRpi m6aZLWi5rm+7x6IpwJk1OJKWTat4D/Lyaxk8VqrDxlWZVay3qpf78pOShCGryNUQSR1H QdmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1rwoCLA; 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 c23-20020a37e117000000b0076ca3265eccsi7305234qkm.704.2023.08.15.12.58.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:58:47 -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=N1rwoCLA; 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 1qW0Ap-000558-PC; Tue, 15 Aug 2023 15:57:51 -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 1qW0Ao-00054F-R7 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:50 -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 1qW0Ak-00012w-Vq for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:50 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686be3cbea0so4570515b3a.0 for ; Tue, 15 Aug 2023 12:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129465; x=1692734265; 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=RJZ6ogXJOw0J2MAEkk8rAYiluI26jV6bi5dyyeMPndQ=; b=N1rwoCLAkpOk1w3Q52F5mzB5eW4FeBZDJvV2mB7t55UNEodUfKbTMDVuhX/p/Rq84s weJhPxuCrLhpZW70b9dg6PlNe9mZQKA4A3VxvQFd3ev661LeIt27TwjomSWDqwP8srDp oYd5FBiI8qVk44FNri8iEhApbltB3X4/xnvMoh1e/6/7itBV3Baw1hO4cwM9Y0yxD5+G EhbDQfvbxZkfcBvKvQQJSTGYoM/rCUKVTGxSD5f7a0GSk5QWCQ1Q2BAoiBAGUydvtv+n 5KB66mUNMkxaDNR+6IU7CPGmp84ncpZXqWnREn8nMInd6vPRDR5Hk1Ma2utjbgWR/HFe 6gYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129465; x=1692734265; 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=RJZ6ogXJOw0J2MAEkk8rAYiluI26jV6bi5dyyeMPndQ=; b=EgoLyE5b5ZDupZOPPLH0FocdRIF7AOGWEG8CdvYMtJmKQdSt3HfBTcKffistaiSlEg q6hU50f5p/DuVkYhhZ/NJaglPXRn7S74ToWsqsLRbxBFLoFFJ5u3E2AMWSm2p6xRTdi0 P7WNEvTLsILL5Ht3gu1T5zsIehDywgIS/cT4jmAo4GgyB39O/zxKU8au3e4m0jYk6e7y 9GP5fV8e8YOftNuwYGE/ZWpv3Lfqz9dgyphDpbZ9KG/BPsz4TPt9jKyqFCbswpNuGlGo eg1Y5xDCUc3pBGnKazNxAMXLOPDKG5zIs7Uszkh8LEretwiaicTmKaaAIpGyhjiBSZJE 7j7g== X-Gm-Message-State: AOJu0YyqekGQIc6/jWMRiEp7xPwJWP3ZnyPifY5bYyz4SszYqaDO3cvj 1D/G89gMtso1SgwE/WVsrMyBDLKXShexWd5EWb8= X-Received: by 2002:a05:6a00:181f:b0:676:8fac:37 with SMTP id y31-20020a056a00181f00b006768fac0037mr3757658pfa.4.1692129465544; Tue, 15 Aug 2023 12:57:45 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 03/14] tcg/ppc: Enable direct branching tcg_out_goto_tb with TCG_REG_TB Date: Tue, 15 Aug 2023 12:57:30 -0700 Message-Id: <20230815195741.8325-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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=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 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 97b7697921..134a9bbcb6 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2464,9 +2464,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 */ @@ -2484,7 +2481,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) @@ -2497,32 +2500,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, @@ -2532,10 +2525,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 { @@ -2555,9 +2544,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 Tue Aug 15 19:57:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713801 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968417wrp; Tue, 15 Aug 2023 12:59:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFu6LIfWYntIFFkTAZjK0sTCQWCQjFUjca9KfWynNqHZ3fZgQ5hJBu492m/swfa2HnIhDI X-Received: by 2002:a67:ef94:0:b0:443:70ec:d28b with SMTP id r20-20020a67ef94000000b0044370ecd28bmr13244781vsp.19.1692129579677; Tue, 15 Aug 2023 12:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129579; cv=none; d=google.com; s=arc-20160816; b=iYn6CDKoKjqD8qh8mN9sSwJpItpBNBdWIgwtB0DErm5X1nqc3WCEe/txuYhtal3cpC Ao5ECucBB1C2Z37ND+FiSdUbZH8maIy+k89jj72EW7AuI3Rf0qGW2St1TK9cEgJgs5MR A2sK/2XK5NJMu2KS82ZcsIl1U7Dq0pOY/uQp7jjaTVFnMqxFs3uuhIMsBFiGvHQCoDWZ 4pYTM6CPR5a7yz1nDgIVRN5XQMMTv6t5AEQOf9fEkHr3jj+VsVI8KhUqcaiebYaMkPiw Bhj68qlqLEc1n67S3NxadyAJvG7JF0+VHlR+neo0CTDA3N09EeYHs3X5IbHzsgxloqVA 8dUA== 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=ZnRqmTnyTo64hM2Ux3fkk6v6JrhGQ8w8rDALkc8lD9A=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=FGIExYqfKRWQZ1NTjM0FE6QE3CCbX7YTuCqd1ALptGNvchLEUUTLD2klV3HjTruNI+ q1sSasJjlq7hZILYf257yDndHBVogZps9eTdPYJSNKW7Zi+8999DIZ9dMOhXYRL8pcuP HqilzYoauhMBE4TImEHLEh7FN1UDtZ4amD68cK5kTI6qBYtdML6gHmWYNcQYfUxe98SJ kND3ep7maFwuJLP2D+hDvmyzbMV29XWNzejnW2My00ZfKsVXjZWQ/wOuNMlVKPi+4cTE YoeAv/gFIkweyRiPigkcgoUg3vG2QwcCr/NL0Ujmjcu8k/q5EIV1HLO8rTDUXYLohBb+ X4Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aaXR0WkJ; 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 t12-20020a0cde0c000000b0063f7e544745si7634380qvk.286.2023.08.15.12.59.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:59:39 -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=aaXR0WkJ; 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 1qW0Aq-00055X-I1; Tue, 15 Aug 2023 15:57:52 -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 1qW0Ao-00054E-Qz for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:50 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Al-00013L-Lt for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:50 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-565e6a9ccedso417211a12.1 for ; Tue, 15 Aug 2023 12:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129466; x=1692734266; 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=ZnRqmTnyTo64hM2Ux3fkk6v6JrhGQ8w8rDALkc8lD9A=; b=aaXR0WkJlJNjkiOi40rV/P2zmuxkPDflFhvoDjg56kLau7kiZJu8LZ/nyQY2jSgede UpFgPL04nzAG8t6zpJ76xSSW38OKTEbAGhPlWR57rd6W7/hDtK+838ROHi776WB3x5Zz IV02RnQTFP+ELrSbZ9erIabH47Td0XNuHXirRefjZISMqLazL1vcXRZSc2RuIau4eCVT Qs/E2G7e7q/tubdTZPLvFIveo1Ez7YJmNFCfADDKSup8aTqrjV177iudXCJWmAQG7jf3 QTNvHIJ6UKcGWhePrpxuQP62RhdsKLqAxSsDZft5jMl0dr/dbHQLNEqKMG4oy2+8OPXr KZVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129466; x=1692734266; 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=ZnRqmTnyTo64hM2Ux3fkk6v6JrhGQ8w8rDALkc8lD9A=; b=QnLEN6Ot2EuVM8YX6XdPf+dqjzherhLCcZRLPzYKzKacC/5wdSfLvuGNRS1nwjokKj WJQ+NeW9CjSG11eMvdvPZtaaFBfVB9ZmdSjpAat1PzuREcR28KCxusXumsNyv0X3j6pa 9a/lG/Okkv21t/J6MzC0BWQtCQzqWvl9ow9700HpuJ9XY9XRq0f6K+/uNjlTmiBWqRBN YY0C7vzPx67q0EQRRmTyuhEPsbIvRski52bx+8nNNh9z1uuM5LrPmNaUGwF5LuXPiazl VGzXt1Gbz44RXw4bNhcv7C2ThywIYBsBpy37S907+kqGIe+ezslzvmahi5wEOpqTC2z4 pPcA== X-Gm-Message-State: AOJu0Yzc9Bkm/VkSC9Zv7uRAsdSCxld8PeYuhKO4I3cBlouEqugYF8v1 sUKqW4Bb3yiqK3VmsfQ8DyYJJV5cZEhcYgKnUwM= X-Received: by 2002:a05:6a20:4415:b0:13b:9d80:673d with SMTP id ce21-20020a056a20441500b0013b9d80673dmr16942774pzb.48.1692129466406; Tue, 15 Aug 2023 12:57:46 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 04/14] tcg/ppc: Reinterpret tb-relative to TB+4 Date: Tue, 15 Aug 2023 12:57:31 -0700 Message-Id: <20230815195741.8325-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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 134a9bbcb6..19004fa568 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); @@ -986,7 +992,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; @@ -1039,7 +1045,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; } @@ -1099,7 +1105,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; @@ -2486,7 +2492,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)); } } @@ -2506,7 +2511,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 Tue Aug 15 19:57: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: 713798 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968272wrp; Tue, 15 Aug 2023 12:59:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWQ7NGOV06jv1zjffKrtAF2c3haMfDccVYcKbpqZ++vFS+U3v1Q2pwKktPQiuVfHaSObbE X-Received: by 2002:a05:620a:284a:b0:767:e9aa:5d51 with SMTP id h10-20020a05620a284a00b00767e9aa5d51mr16300416qkp.3.1692129555631; Tue, 15 Aug 2023 12:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129555; cv=none; d=google.com; s=arc-20160816; b=UNBo1EDJFR1DnygFigC8O0ymz4fNz3ENrQoN1CIyiDzZXMz7edTlaGiNVkmYwf97QU GVPxJpHvWRVW46mRRAvC6ylxDw8DHY2i9wBBCqBEVSxR3tDLyvb6wB+J42xpXkfKQumj f6hQCLLw+XOUZScacZvNbN4wXAOvC6a+OordT+EGHJUQBacFEoQBnO3HRBDiEfdNcsf0 9ra93tjWJT78fWo6jx83CQraGp9FsPdLhrjYLRfGEZzpJBk8rtMFNmC2XRuC0shubOjz glicKMXcIdWsY6LxfHWv2T0gvJebFrQwN8DeLW7NxnH+ns+65NGAdDDWfjxP2BVndm1X JQJA== 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=fgvvzZ0eTjUrFQe9+P0KCKj1UuoBbbqjJKbXrC6sZGQ=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=A/+Cmrebej9gLuPVhDfb1rBndAUuRme2NHSBCyVnoFtYU/z9fAr8cQqiKLEaM1LwP+ 2SXh60IR7L5P8E85ubDnrXHFzO57MiqWBhXbonU6YbUCYlLX+hiFo4V5TaCQfP8B2BTw 4MsOEv62Ttd+4PzyiiriMDFk9/p+t/REiAPxX9FEugMlBUR2gQZNVRFnMUThaKDijcsH JRSg+i63/XCTHbabnUqo/nFSAzao5UENO9BF0YGg5I8dXtel3253tr6M9mx6SaLk/8Xa BndC+20G7U5IFQYsvmzje1HLn4lanskTIutBlL0z/xA4zj5GR7LXSEnjsimTsgo3nkMc /KfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SLLKOxFh; 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 g21-20020ac87f55000000b00403cbd1ef77si7916849qtk.208.2023.08.15.12.59.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:59: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=SLLKOxFh; 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 1qW0At-00057b-3X; Tue, 15 Aug 2023 15:57:55 -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 1qW0Aq-00055B-3e for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:52 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0An-00013l-Sw for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:51 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-68876bbecb6so462213b3a.1 for ; Tue, 15 Aug 2023 12:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129468; x=1692734268; 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=fgvvzZ0eTjUrFQe9+P0KCKj1UuoBbbqjJKbXrC6sZGQ=; b=SLLKOxFhZMbNi7Dw6odspzStJ6g0MC6kXHvs+vXl+BiUsxywdOYfD3yAXmL6r+OZ/V hVTEjtEvpPC9lpeGvGKokZYK6PM6ALqykNU8645rNZ2SjzvOqOfTR4LIVuawvEKNCFni 87V7Cf8m2btrdoLzenoZDbOjHG9jbFNgAPcnpZbe7ck7WaYZCc4V4uVNs2U1EYEPsFQE XiUs9T38WDYJg9s9fLeWM5loPJR8uv1q5QabstL8B0GGUDBFNVQgY4b+tnrKf4uyx9mR NwnOgibsYCOMn8TM5DRMdLg3R2LP/APfabwFXGVMCDL4YzbQe3Y1nhhdRJNJMWM2Nda/ HI6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129468; x=1692734268; 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=fgvvzZ0eTjUrFQe9+P0KCKj1UuoBbbqjJKbXrC6sZGQ=; b=EPG8ZdecMwqQYxB5oII/auK7zFSz9sWY15wCqxBKDLXeR0fBupcVdnxQmseAej3Kb/ BjEzRkCgRXIADxAcJOBf92JGFuvbarDBMKuWiDktq/3gNwFzLX8t1Vkf7phbTIT0sVUs GgQkh8Cb873xJPOwYrcxPjt3d9N0070740jROyBrRuODMlddx0djRlfdsvRGGlDTqymc RmhCls0DAjzQNZSnbYqMj3ejU+k09cL6S7xnaDo427AmSlAlTLMHFpFDreCjX3kyfYfH Fj83ugRjbOPc9kKFPr0MVGTu25mWzKKnKjpfA4+J806vwaQq8+Jbp/Hji7vG8aR07Lg+ G0/Q== X-Gm-Message-State: AOJu0YyMqG5qMESXfnRtQ+/gwrRZHx00/qamhdub74eNJdJp2e8bvpuG eb98nrIX8EizcdTStnHVVkc5Gqjvanlqx/MQ8q4= X-Received: by 2002:a05:6a00:1acc:b0:688:4c21:a6f0 with SMTP id f12-20020a056a001acc00b006884c21a6f0mr2145788pfv.18.1692129468589; Tue, 15 Aug 2023 12:57:48 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 05/14] tcg/ppc: Use ADDPCIS in tcg_out_tb_start Date: Tue, 15 Aug 2023 12:57:32 -0700 Message-Id: <20230815195741.8325-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 ISA v3.0, we can use ADDPCIS instead of BCL+MFLR to load NIP. 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 19004fa568..36b4f61236 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) #define CRNAND XO19(225) #define CROR XO19(449) #define CRNOR XO19( 33) +#define ADDPCIS XO19( 2) #define EXTSB XO31(954) #define EXTSH XO31(922) @@ -854,6 +855,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) +{ + int d0, d1, d2; + + tcg_debug_assert((imm & 0xffff) == 0); + tcg_debug_assert(imm == (int32_t)imm); + + d2 = imm & 1; + d1 = (imm >> 1) & 0x1f; + d0 = (imm >> 6) & 0x3ff; + 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; @@ -2489,9 +2503,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 Tue Aug 15 19:57:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713797 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968252wrp; Tue, 15 Aug 2023 12:59:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkkv8L421yBlwfsEOI2M4T/T8NKyPC8F4oPAYX/VuCrOF+ZrJzM4oIH46pTCsLvyv+H+nw X-Received: by 2002:a0c:c40a:0:b0:636:afa1:345d with SMTP id r10-20020a0cc40a000000b00636afa1345dmr10110653qvi.17.1692129551636; Tue, 15 Aug 2023 12:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129551; cv=none; d=google.com; s=arc-20160816; b=W/mTzQHs/fY9JzaturjxoOmcVEV6pvYmLPIER1hRJ9/gP9uml0Pq1DNwzErPXF5ObX nAFPN32rTYdHz1w6//IfCY6fTCTGpLfZixoK57H8zrqTrfaoQwNvXlJE9N+AywjB46hw vT1lhE/26WucPncy7kbo8RqNzG25OJgbb9iIcDmj6BnZEQkh8Wd+//Nu1NY+/3I0WJse 2huGhbSwOdhac4qYf1NRBsM3y+iRKZgAUdPc2V6vLbUgRyVxkruBw65aeagvKGaWB+EJ wAGku89OUDNXto4OB2eevF1d9pUXGR1mMouS3+q/XIiPwdovjNPUhrK1SqO007oH/hKF LhAg== 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=CAfW4M/c3IgeounQPta3hLHkVcqc5lVrdvZ/euSX+U4=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=KecRX59eRs1X4+pNDLhM2KX5gRDD6LASbamT4+JVukBXs+KQESU7KQYKL/hXfIBkEZ 4hvbAMORDyaUxU9dFzzjUMyEzAFSp2beFTm5/cbjXyYABMgIHvd5oaiuKgH4ff8yyqZC AoOh7goaD6yaiRmUXs0CtZKOMtrDFJmQf4g1VezIXH8RswsXdwMgKH3jH+oQ1SFW8mL2 fM4/OSnxxo+KSPOYx0K7vYZvCmQ2exh1fZ5RPMklQYTIGzUcYEGqDid/4qCwcf2ebXRV QnbE2jYyyW5CS0YD84Pp0h5lWbSqqCss2ymF5b+E5ku8kKjyMy9AkrfiFu9Aje/gOGsE 24FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h5CL47Fi; 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 h21-20020a05620a245500b00767b7f31104si8094943qkn.147.2023.08.15.12.59.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:59:11 -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=h5CL47Fi; 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 1qW0Au-00058K-7X; Tue, 15 Aug 2023 15:57:56 -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 1qW0Ar-00056G-4B for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:53 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Ao-00014D-ON for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:52 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6884310ee75so1651081b3a.1 for ; Tue, 15 Aug 2023 12:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129469; x=1692734269; 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=CAfW4M/c3IgeounQPta3hLHkVcqc5lVrdvZ/euSX+U4=; b=h5CL47FiV2u4P7YnWBM6bs06tw4WXbhEiXmdOc4CYpGKNpZffJgdEyDnosb21XP6/5 P60QT6rKkDmr74C6No4eXqGbFiOK28aQp1bgGcgqGVhVJGnB2VUR82JOt4BnSx4N6oF5 S5RZruVQDiMSTGr4LS/KYPTRGmTnMr6NAgWf3O4AOCrZCL152Yzd/M07io8z3RNFMgzQ T4yNSzfVGff3jg2gHyNllZkc4SvZDMcqSiWk5piQXHe2c5J3Q4WlCn97egp9sPEiXmTy BjrzGClO5GtgO8Ua7aCFVCFqo7Z4A/CwrxXhYqJf0d/Y0AjOer9VMtKdAFw+76NRdifr 7UIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129469; x=1692734269; 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=CAfW4M/c3IgeounQPta3hLHkVcqc5lVrdvZ/euSX+U4=; b=D9eIOhTdqG921tuLGd7BLDFaGm7UjlRUeY/C5bhuamDWDXNbESuW7LvbGTFJdUkIXH mTaN++gaOj8FA2hfL/2QTrUyHGB2fEwBKoKqKfR1EMM6xODav+8BrGL6+RXKK2zDDk1v 8SxmXv5DsTTVkrVsSjEhzD5JWYR4qo82wW2VOcAjDnil0TJ/JPXULI4nQwYRUMx1RyjC aoz3qTl7pTZWrL1L64ugM3jxPsHc7f5lggwoLCQm8SL/Ybsp43xqveCnYCKI3cChgwTo pVUgRstT8VpMztcynOYazlYvLEMKPiI+dTowwYfU+5j46hrs4COaZCUqioRLhMxYnmP7 GXmw== X-Gm-Message-State: AOJu0YwliyC8ea/MRXOUTsTVDpmXQfFGeVkSRLZVtDgbf6fvICGHWRKK nmYyP9VdsubzpSlVUvmnBGqeLbCTQe7k3SjZB6s= X-Received: by 2002:a05:6a20:324d:b0:137:a3c9:aaa2 with SMTP id hm13-20020a056a20324d00b00137a3c9aaa2mr14896424pzc.30.1692129469425; Tue, 15 Aug 2023 12:57:49 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 06/14] tcg/ppc: Use ADDPCIS in tcg_out_movi_int Date: Tue, 15 Aug 2023 12:57:33 -0700 Message-Id: <20230815195741.8325-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 --- 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 36b4f61236..a302bfff2e 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1050,6 +1050,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 Tue Aug 15 19:57:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713805 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968945wrp; Tue, 15 Aug 2023 13:00:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIFE5qJmu5/3Um8bsJIL8k9Ss9wJgUGj4x0PzZkZIfvidIViiAaEvGECL/wiBl84KjELGy X-Received: by 2002:a05:6830:128b:b0:6bc:f999:188f with SMTP id z11-20020a056830128b00b006bcf999188fmr13077119otp.3.1692129643918; Tue, 15 Aug 2023 13:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129643; cv=none; d=google.com; s=arc-20160816; b=rnzm1ixXGbfy1AXgN1+1803VANgExTrXjMsCSMGKeRN+5DvluEb7yCU+0d30/0DnLk CqG3LTCve/+C5gvysNiYn/APdx+B/5ReaKV7ZpKcoMbs9t56ecni7tW5fHQVm+D4zbXz yfQ3dodUx4hxk/32MmiqN7y737gZV/x4Gjr252wpadxBSRnc/qtPzvKt8ZRkZLMS6s7G YnbstOfoG4lgacnkczRPx3+WNPmlG0tTYNvSLi/wZ7mJFe58wZluux0QMlCKIbXX6yFp s7a/mdDNvGhwKibA+x/bjpqCUs/psL/KSKNhgBejLHEh6Bi1ZObUVmCDJ+F4QubBW3ab x65Q== 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=a3aggFvLmkyyl4eR3KUMuICtg6+359fE3pW160k38Qs=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=cVtR5cFaT3onrJeCUi2GU8hZ6cbGc5d3qkp+XpqLxl9B+rTQnVfmLQC0Oh6ynG9Ip4 NAAGT6avxwXVrifkopV1Hba+NKDzLvztElIlC0D3n7cwNMJ/ptrUkaZJ65IClZrak0B5 nyWNzDKzgAvpZQtaUJXtYg+LDxrGdcwU5AOU389i7Q6RRNUzI82YE9YSdQPEfy6o9jul 2RWtCwOCZbpsHwDvP8zLs6VDwoDH1ArB/zKklbFpGzuISjBXZ7HFkL7ym3mvsjxU43dM K9AVQyqZ5D/ViU3Udp18XBA9iI9BKXpU862J24e6AL4NAjLhaQzocZzz/zX7FibWP/q/ gUqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KkdJjxmP; 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 r20-20020a0ccc14000000b0063f74e8e713si7375493qvk.227.2023.08.15.13.00.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 13:00:43 -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=KkdJjxmP; 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 1qW0Au-00058i-Pz; Tue, 15 Aug 2023 15:57:56 -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 1qW0As-00056g-1Q for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:54 -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 1qW0Ap-00014T-H6 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:53 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-686f1240a22so5734502b3a.0 for ; Tue, 15 Aug 2023 12:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129470; x=1692734270; 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=a3aggFvLmkyyl4eR3KUMuICtg6+359fE3pW160k38Qs=; b=KkdJjxmPf9lI7OCk0OpP8JtvjIIzlItLrvtHxYv+gvd1uCAELXYT593RWMuWAJmnYq JjRG3IkYCQuBMScU6olOkgbI3o8HDCmrGNTLF8E5x3c8b8Biw5Cqr9Of5YEugAVYBvuW XRX/8dCpUvM1cAo9lO0sEBAvFF64vp5otLcOAL/puunKnzcB9d+2VCzSvmmPZlYWGKaM hF0pvcwYavtL/w8Dz7viVXwaUB24YHbHDaYHUtbMGUl0z3TzsxNlU/Q8GX64n9cwTOge PaPHkZH2+GWUAO8AZ9itLF33d2SY2w9kfYl/+sLIetmxSMtI2UwDEMJpVAYkMLAO2iKX dL4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129470; x=1692734270; 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=a3aggFvLmkyyl4eR3KUMuICtg6+359fE3pW160k38Qs=; b=LZsZXAgRDJYccHXzw+hiHXqwb74JLlMBUSGNih08Smy5b8Ui0c8RYk1x8gDFfZ9FQh D6oXGXT5HkQN4E/BL5qrY0nnpJBEI7KlnphxiRXsUnsYlx8CPteLirBlanZa4ukY47RA qXzlaig8wzKdvZq83ZIJ5AivTe6GH1FlwrzOYhba3v/UXHLuWFXU4dveJxCZ4YWL3hDO X8iZ1KvbGixwsmwICmQPM2qVHS/y9mnrs7TU+TWuTFhnWTavyLV90MLf75h3pqq0fDiC +868RRjcBOGZgUHFMhagmfB7OZYSL5wqXoW8GZIRyD24fIEa01OE/NviXGLG5h3wzy/7 WB5Q== X-Gm-Message-State: AOJu0Ywa/9AYebwyFkpxYbOVFeOLASZg2tJ8dOPct6+gAJVjGxfKP6WQ c96VLY6e6E12KzeiReDt9V5RZOXdwqrAxiUNFh4= X-Received: by 2002:a05:6a20:748b:b0:132:2f7d:29ca with SMTP id p11-20020a056a20748b00b001322f7d29camr17481785pzd.24.1692129470227; Tue, 15 Aug 2023 12:57:50 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 07/14] tcg/ppc: Use ADDPCIS for the constant pool Date: Tue, 15 Aug 2023 12:57:34 -0700 Message-Id: <20230815195741.8325-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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=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 --- 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 a302bfff2e..a5c1891eb6 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1076,6 +1076,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); @@ -1133,6 +1139,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; @@ -1159,6 +1169,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 Tue Aug 15 19:57:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713799 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968303wrp; Tue, 15 Aug 2023 12:59:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdm/h0YbBUVfrICbwVk9TGsfehMAslX9m8F2E0muEzNrBwTX/jhyfDuPA8Pgs0EAIqKKjq X-Received: by 2002:a05:620a:1714:b0:765:8347:e92a with SMTP id az20-20020a05620a171400b007658347e92amr13714333qkb.56.1692129560813; Tue, 15 Aug 2023 12:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129560; cv=none; d=google.com; s=arc-20160816; b=Mc/7qyEuT0LsKhA64kCD9jaknCHy175JBWXZk3HrXRdnlv1GCaWUo6mwGgSafUzMSV 8a5Qubwa14E1+o+w/Jv+Ao8ijOu4pE4a39X46i0v5WCQ4YfYYk5jctgphVVCHB6YZ6Xf 4Z7vd9UOLyrTPwhiLmyrEplMERgq/c+0Bn78/ZVRwz/3gJr1HDQl34OGDX51ZDsNxSYF QWz5nSJRX+jTu+dv/ZUez60Ox2tWnORQesIGdL/zPVKfq0736L3f3bPDNANCocSvKuY3 IPl5ulUY97dPR5mzbNTo6nVoQsm/5OilFvPL+ZghRjEXcndHyYFtqJYnvnixs2MzxGti 36Ew== 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=2a12Z19iXsASCqZDsR31Txy9HCN36MK3mWzwcxfOs68=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=Rgpv6eOWOaB4ULwVYGXiQsTOLoK9xzMd4qW8tswgSyFt3G+C5hv442WaWGnIdR/XBd 9H2En3zSPmTV8lRKZLAE7innwfYe2SiShk8stoSEcKfjndCDMPxa2IDbVUfb6UrooTMv wtE1kXq57UzEon283hipTXK4Cjzm7oeYd9pAvqosNcZLVE82jz1+6rZPfcUh131JGhVN lX8ZlrGYPAsFffw6/H1mx6zhmBhPJ/icMuL4QOCh0vwOZn5ZBwwrKqruYHCS3SZmR0s+ FQ17y1VwcS+zl1JDgYVfJ5wItTCRYX4yCiNP7/fJdmpDp/iPZdLJUGk2hzk9zG/agSGK 9OJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=glcOeLGm; 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 m13-20020ac85b0d000000b004034ec745e1si8004145qtw.59.2023.08.15.12.59.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:59:20 -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=glcOeLGm; 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 1qW0Av-00059D-B4; Tue, 15 Aug 2023 15:57: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 1qW0At-00057Z-1G for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:55 -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 1qW0Aq-00014m-Os for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:54 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6887918ed20so321727b3a.2 for ; Tue, 15 Aug 2023 12:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129471; x=1692734271; 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=2a12Z19iXsASCqZDsR31Txy9HCN36MK3mWzwcxfOs68=; b=glcOeLGmS1pANxTeXrZnAv2hfWb/QJxbm0ypXqKLAgXseZrAvGMGO7xMVDDXpWFnT8 QWHyLes3m5Jihh4dDG8BgtsLQZpXy4hcvYREl3ROHly6OMcb38Uvd5QuwgLg6AoJepqv VUL05eMencyEeDfr1bKVEacIDVOKvqKaWwh0OZZH2CkGyz7FUigbADIjAWpdOeb/epWZ 67Bml6Q0Kcpu4f+DUUMA7GlJ9IozEk2ArRoywDzmFUcKZrjtX2KS7Rps1gvGKo/Zn+CP ksiAyC576xdQQVkLPGDS4wDCwebb2W6Gk5N5nqx/y4t8cTtjUU5ub64pJuBTPcrsrBAl jNBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129471; x=1692734271; 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=2a12Z19iXsASCqZDsR31Txy9HCN36MK3mWzwcxfOs68=; b=T+skLMNrG18QYRzpUhYKTWACNddErYAl3n181iDzO3AZx2brcgc9PL4R4ITZvHWc4C 0I4VWFg5HzaTOylPn8Asxeh7BpYFtCpNiSVaDvfI3t+OcE0UsKl+lmV7N4YrlTnYvOUm PHvBZwyDY3qkk/7EWRusnQdt/RudWoLb/M8f/WuPNywnfaR4l0mZvAaIJMn3QlgSgeO7 YwYy5rcXwFESApD0nLQ2a4lIjpS0EL3rW/zXviTlYPTo2eWXgW1wvVgMSoggQiBGHn5/ igfUet7sLbbk5BUKrORCcc5ewND3qTz5gUlBVcxXevoTLHiTVOb3VxJPpPjeGfsCfcYk dPBw== X-Gm-Message-State: AOJu0Yy6E6WbhEu40Nd7aMwUUcq4z4zD37vUClKTBnOYGSsBpOjWH6Mj gZ4cksm14WSSRy3+nj/p1wM5uLb+qfsfu5dSy/M= X-Received: by 2002:a05:6a20:42a0:b0:129:d944:2e65 with SMTP id o32-20020a056a2042a000b00129d9442e65mr20044110pzj.13.1692129471107; Tue, 15 Aug 2023 12:57:51 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 08/14] tcg/ppc: Use ADDPCIS in tcg_out_goto_tb Date: Tue, 15 Aug 2023 12:57:35 -0700 Message-Id: <20230815195741.8325-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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 | 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 a5c1891eb6..b7d1b4f1bb 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2548,6 +2548,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); @@ -2557,9 +2558,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 Tue Aug 15 19:57:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713806 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1969020wrp; Tue, 15 Aug 2023 13:00:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEq4vMZJnGTjsWJNQG9smrjtHJzog75mot11tcNIIadJZ/+M+XlEW8Lc9lJdXZ2nx3gkihj X-Received: by 2002:a05:622a:341:b0:403:54d7:e337 with SMTP id r1-20020a05622a034100b0040354d7e337mr4211847qtw.34.1692129652449; Tue, 15 Aug 2023 13:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129652; cv=none; d=google.com; s=arc-20160816; b=qfoJF/r5P0MGTDpHIv+i17f7uOFQfhlAoWdJVJVXyJ/tQKgjM3GSS4Qb1pvdV4odTm +cmUCdcHbGDONbXH7f3R+vlAtNWdNkpnA2yrBizslMldNC1oP/vz8Pxm7TyK7cYNredR 2nywtfLqmtT2CSC9EMJc7baX1FUP+1QaqRUCRXyEBr3ZQkhEv8kQRrg2w2PnruEZVX+s mK9JEMenFAcrOFxE3fc54kOv8PGJzePt5LHOyhgefI+BjtHeXth3txehwoM2zc0w3u0Y /SLOezGStYgbxpAlwiIXJLATEtUGF+ojqRpLoofb50Yn2tAX6H9U8ZGgp9TNMMF8xp/E Kvvg== 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=3yC0mxP+Pzdku/R2U4WTUfNcg5S21JJsMYdzIv6kLFM=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=TSJT0WpXSvO8JEn076FeUJbXFrd+khWzHUpXuq+34DlfTvQRVy8B3PniBqfESz+yse 5KkXTpCV6iodRRljnmDlMurwS9aSGjitdQCkBCMnm6MFiB2/50nYmbtNGZmhSOTTYS3a Zu9pxTbcEaUeo4rnS2tKWXcTDu9Bd+l697WfW+B84bNogTMrTfk+4d4TCL2Lo/nk5055 WcnYmjL7vKFKdocgMK8SIArj+haOFSa5BXgj3ogl6wv3k6b1Ri2iHVqfilFexN979cdD Gx0OLCPZUojfaGGfA6UoWLmoXT23WUVVJvLTR7lFu+lmQdxXtXqlTVxUDNKjFBUAx/XS 19pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YjELarhX; 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 c5-20020ac87d85000000b00408c10b50e0si7629736qtd.204.2023.08.15.13.00.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 13:00:52 -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=YjELarhX; 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 1qW0Ax-0005AT-1f; Tue, 15 Aug 2023 15:57: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 1qW0Au-00058Q-Dj for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:56 -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 1qW0Ar-000151-6Z for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:55 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686ba29ccb1so3897348b3a.1 for ; Tue, 15 Aug 2023 12:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129472; x=1692734272; 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=3yC0mxP+Pzdku/R2U4WTUfNcg5S21JJsMYdzIv6kLFM=; b=YjELarhXxYAmk6Gw2a3lI0J16SSyPIWBrh/gEeiXfSSE+hf5ZX0gjSzTgexkuilwWr u+s/OshZSJzIOw0oJF33mdxlqs9nAgP3PR17Kv8vnExd7OSw7Rq966xOdab4TBg1Wxor 6SIpezfQSDmvN9MpTOzBrHn+4qUgIKGcNl74n4vG1cpz+KAKsM3w5wq4l5TZtNB2iPMV yobdiUmgPTbyik6M8E+dPRlF4XSPDeVkCONeoSEpmPHYidnEPRBFE+e8C6vv4H/z8lzt L7zg2DDMAbVqVmOAiJsEpeQ0vjU3xGlU0/iSqAaH7kiNp5PEwa4kNk+f0tsWaUPZ0qPN I5zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129472; x=1692734272; 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=3yC0mxP+Pzdku/R2U4WTUfNcg5S21JJsMYdzIv6kLFM=; b=htoPolQCYx2/K6hUhXtjazKgYDZovZMLJCafVuVCjhgfv5dqCGy7OSj8hN6d+StydQ PmPRBV8qlL6sblcEVSG6IUF7jfocKnUIE2bVspiI6tr6hUqla/by0HUY1NWzb3pDj18j JMZ6CX9IrH14xx1P7T+yKSAZHUjf3m7EwyEvC2mVCFWd30xsC91NYeSeYqQTN5bi1nar EEvd4N5pBIsbHlvB77IO1tFJZmrlRRVa/wa+h3jkJgY78buXnbg/W3AzzJ34FPI97J7d ko29WrtYdo1EL73i5kkB+c2QvORqF/MrO78LclZ9DpfmOZzdnGZmCLeva5UrTED7wfHs 5NUA== X-Gm-Message-State: AOJu0YxC7j9wN4Wa6FTcurAKI3RsV2VgC1S46IfvSdg9NownZngKnIAn VDmZQjd/ODnxWKzGOPMwWEo9EjA2nafB/Uk+EIQ= X-Received: by 2002:a05:6a00:1392:b0:687:9785:13c7 with SMTP id t18-20020a056a00139200b00687978513c7mr3799044pfg.13.1692129471957; Tue, 15 Aug 2023 12:57:51 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 09/14] tcg/ppc: Use PADDI in tcg_out_movi Date: Tue, 15 Aug 2023 12:57:36 -0700 Message-Id: <20230815195741.8325-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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 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 b7d1b4f1bb..40472f3d00 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -714,6 +714,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); @@ -1012,6 +1044,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 15 19:57:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713796 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968132wrp; Tue, 15 Aug 2023 12:58:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOuXOs3DQpP+3EXUXucA5ka+kYcFp+pgUtIPB/6t3v1jDG/y7h+SX/Ls9MXAfzuCIOtXGJ X-Received: by 2002:a05:6102:2e6:b0:443:8b27:6dac with SMTP id j6-20020a05610202e600b004438b276dacmr13708416vsj.9.1692129528628; Tue, 15 Aug 2023 12:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129528; cv=none; d=google.com; s=arc-20160816; b=X6T8lhrEGpizgDjj7qhiKX3ua3uKXnTcA4REtiKaAErrpM5gjsoKGkLZVZxj9AruGr C0nNrwDme29iXvEisUrnXomaGd8zN81tRqVdQ+Xoc/Lh6+MxG2J36AMv/CIVMJHH2MFH BYjzSVzEnyOHoeSLRsjeLWdQTdTNoJxNhz6h8Nz932WxUGsLwl0h7JOU5BZ34IuBZnkb qHbOBxEAN0IlsBe1QIAVqQwd4zfcfITTIQhhGt7UWuUjWKpoS9m4BeyFodIzRjVvT9zR anqaBz0L8U7GH8QWnwwZMl41h6OVid7LQFu7Nc2hSZYjs/TPu1qIMGPcpVHp1ymVty1j uXmQ== 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=NqBKPmbTeyzbaEOoqwFakyRjcnv8k/gpOjB7jfp4teM=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=fG2a1INHJiLPciWIaYO605hl3SLmO5XkPG21zDk3wkaG2+MnTx6RcbbjeLAr/Yzymk JZ9BtPh9q7toobWW1UsuLRUNgvZwslIChdNT49G7YOiE2bT1Ughd06zixd7kMhPUUKsI ai/d9Fd+Oec+Kiu7Fth6hbF9KGvckUFi03P3lZwyJwbHMylWGKa7cQIrFn/515DNGLAX oc39BCYVZFEE9XJ5fcQV7QHII6ySEqrHkxjmdFddMBh2NfivKB3tGu0xR/hILZvgzZ8y Vxz+6JX7270XMc8bVLhDVAvbMmnsIJDBE8NZOfakJTlPPX99diIS/24ybSl8ax1SsOXo 7ueA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Iph7fDMS; 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 a25-20020a0cb359000000b0062596e0fb72si7581302qvf.121.2023.08.15.12.58.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:58:48 -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=Iph7fDMS; 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 1qW0Aw-0005A8-LJ; Tue, 15 Aug 2023 15:57: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 1qW0Av-00059B-5e for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:57 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0As-00015Y-Hp for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:56 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6887059f121so586573b3a.3 for ; Tue, 15 Aug 2023 12:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129473; x=1692734273; 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=NqBKPmbTeyzbaEOoqwFakyRjcnv8k/gpOjB7jfp4teM=; b=Iph7fDMSyC3A81kverLqvoj0p1sM6GHXO+KQgSLyJzG5NGNdsTj/tIgS1vg2lycEaU VNC5jzIKPkpSuUonn+zIG1LC9rNVS3zwh082eCRRyBBZcetZ2JwLq1TFSW37acAoIL5G zJSzve5W70Gd8B1uqp80DEM4bNhO4AXCPHwoCOg0ZmUlZaZriXOE4uqw33T97Et0Isg7 7YsvhnP5YDi4Rln01YwzH0JJEgEeIRwrHZIG0gxSioK3Wl9BUpN+eELt13BRUuXu7e/W dssDLh0LaX4hvxIt3NI3xTPQ0D7Mq6ylECbQDkS11Q6MI+F+8yGmM2ILX1lHhSMFalK7 b6dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129473; x=1692734273; 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=NqBKPmbTeyzbaEOoqwFakyRjcnv8k/gpOjB7jfp4teM=; b=eAsSGICywoJLCVIsYw8HcpR3X4jsjOy2PPkdaBXdi+P7e8fE+rNC4disqiK0evgReR e3Myb3fg5oBKswAdL2VyRq8tUAGFipDHkTwolTnmvP5UUjBjs1gWDAo5e3Lgg3XyxeI4 AaO19JQJwiPKSWcgcCIQ2lROZsQ6jk8KFZLUwt2iJ9j7kN+8jfU6QsAKC6rfIHXHKkTL htugxcPwtIJe81QbhWY147y2C+o7hjGkwiOuBHybHbfQbtRcVjM2mRIHX+KLIT2pIUxF zyaAormSJ9YGudFDb2sZV1floy+huBrexdxlloCTQiaa9ArlJvv2knH0Us2iyxSWO0j5 +7Xg== X-Gm-Message-State: AOJu0YzUKv80bQnk89PnyOPFnDRyp6ditbBVmrso1qYwnhOHB7gnEBZa Orgzhep+F2OMGknnlu/rb/bvOfIkXevSGgxvFHM= X-Received: by 2002:a05:6a00:2e20:b0:686:be77:431c with SMTP id fc32-20020a056a002e2000b00686be77431cmr14303019pfb.13.1692129473034; Tue, 15 Aug 2023 12:57:53 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 10/14] tcg/ppc: Use prefixed instructions in tcg_out_mem_long Date: Tue, 15 Aug 2023 12:57:37 -0700 Message-Id: <20230815195741.8325-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 40472f3d00..1aece2cbf7 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) #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) @@ -732,6 +741,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) @@ -1413,6 +1436,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 15 19:57: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: 713807 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1969146wrp; Tue, 15 Aug 2023 13:01:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOFD82P2d5jFwZB70ORKXxH25IQOnNKDMrA3z6y79hryj+jxTvdRQYRdBNxJfaI1frVDVu X-Received: by 2002:a0c:8e05:0:b0:647:29f3:4b54 with SMTP id v5-20020a0c8e05000000b0064729f34b54mr4944568qvb.30.1692129665316; Tue, 15 Aug 2023 13:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129665; cv=none; d=google.com; s=arc-20160816; b=b/wTbeHjqhICMJdwyh5h3piJoHdAmk0yEPwxPieRoFcfdpp+DbtIifb1+5srvlpGSP u2+b+U583eQ7cicHRrUt0u/70GHuwtn0brvqM8v74dELX1gZXUxm9ayh24rT5aub6Mc2 MdOD9YnGiAgb8i0WMTf7Q6GiNQv+OWlgbOVJpmLYKSYbshtkqBil1D7M53ePbsFt4ayW 4tCJHZS6fhHkH+X36xZqovizD+W4CFdD0puBzYblHHXNY09nyEMCq5naR5Y5AqWi4X57 sn4G760hGRkwhYgu6S4JfyR1h8d9x/MGEDhO3cJAeuvQrhhYZK15+8EfWfIS3CQ1plJs Gu0Q== 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=pu9KEBeJ8el0D1W01E7RaWKVL1yngJNhhEobU208UWE=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=TI+U4mOJ8p37SpkGNaXJ2/IJiQr8m6ZUWpDinXwMbaw+71nsvWoYtNqc2Oj4yOnkx4 QlN6ge1GmBJdr+byiZ/A4CkS7m0GyYBRNSM6KyZQ24CWZ71ptEB0zxLg4I+nc1EbjJW8 kMBFucZGh37cot6pPtRpGajf36O/5Mx+b8NvLyzlda9WhX3zs0Mt3kGeyXa4XnrzLuE2 cdPO3x+WtEPhV+HV9JSNEHO3GPM6mz8+5VBGyVZJo9beZnV39Njt6ISkb2itm5t4B5NG jAMoFCTY8a7hyP8grbB84Dfqwo1tLpAhE4CPee0XqEiHmAlX4hB9MKtJ/P1HC1E8Bvw0 Ou1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PQS7Veyx; 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 dl4-20020a05620a1d0400b007681285fdf3si7790668qkb.744.2023.08.15.13.01.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 13:01:05 -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=PQS7Veyx; 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 1qW0Ax-0005BK-KV; Tue, 15 Aug 2023 15:57: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 1qW0Aw-00059x-6p for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:58 -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 1qW0At-00015q-7V for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:57 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-686efa1804eso3931879b3a.3 for ; Tue, 15 Aug 2023 12:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129474; x=1692734274; 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=pu9KEBeJ8el0D1W01E7RaWKVL1yngJNhhEobU208UWE=; b=PQS7Veyxa8xlO69A62nAoJkL51SxfZU5sICvPXZE45pZxkmLCow05I2o/JDNcX0od7 dasyY7gRq3K2TMZILUiXTjF/BD13DdLtz7bEozaw0Z/SgWIEV9lNvKZPaTQY4sCq+GKA ybiHU6dgP9uVvAjfuNfuffZsijSMNm8Il3YH0EUN482mPajjOYom1EFiEBA5kFdnV2TM xiMGTpleBSOMUaw9C5yVIvu2iPttyooiMivIzkkNW3pyZoSCf+APUb8ovlSQ8/J7zb2x WV5GnvPy7nM9c0fPo4/BGge0Fo4UrxS66XJ8wPwyHhUJPbjX6+gcN6lFYdu2RbXhC9NL fodw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129474; x=1692734274; 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=pu9KEBeJ8el0D1W01E7RaWKVL1yngJNhhEobU208UWE=; b=IlAzIehpVtTZzK+PGAJsGjsQbhbxDZWmyrTQ/YglDBkwwIi2FS5k4Z++rkb+38EROF TEnaOG5AlWjFynN+nFPTFmP7axnmvYzqL2Yom+gYrcy+7Lou2sgHY4Mjnk0vbUs/JUiW 4Qg7K3fa9hV2QX9GyqRQDrGOPY3fXYLV4kp9Qyq0NVdjeZ4W3X9HFOxBLB0I6wThKWWK GtGpiMDr+pTpQAjdtSGfR3SJcL1YcD9phnRV9dBzQ6N+qvAbCGGnDB83i5cGgiB0V2ES F9HkZSM/XV+Zw6+Q316s0QtTd1Nlh1YNZMP8gFlDbcQq2wt3euP94xmAZzUFvvoqZvnF ORBw== X-Gm-Message-State: AOJu0YzsceWLtKJarHbefzQhEUm9TBoS8EwRlfrF4xN5XehrS/Vve0fD lzATQgNdhUaeHSgM9SEE5xubQ4T1R254+3KRyF8= X-Received: by 2002:a05:6a00:2345:b0:687:14df:51a9 with SMTP id j5-20020a056a00234500b0068714df51a9mr13923290pfj.12.1692129473936; Tue, 15 Aug 2023 12:57:53 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 11/14] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Tue, 15 Aug 2023 12:57:38 -0700 Message-Id: <20230815195741.8325-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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 1aece2cbf7..670811b636 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) { @@ -691,6 +708,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, @@ -1150,6 +1169,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 Tue Aug 15 19:57:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713795 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968131wrp; Tue, 15 Aug 2023 12:58:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEar1H9ztauPRsUCX5vyKRo/Kzv1vBTp2486PiFX6jw+EdWXmM5agUO+hWVA2wQxOrcRKdF X-Received: by 2002:a9d:6d08:0:b0:6b9:9cc0:537f with SMTP id o8-20020a9d6d08000000b006b99cc0537fmr13331166otp.33.1692129528416; Tue, 15 Aug 2023 12:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129528; cv=none; d=google.com; s=arc-20160816; b=RNwjxNwiQ7sMSdiTnJGfdH6RCkofDJu/LSMETEqtuWPrFDaNpl74qPKN3Zs3Li0JS1 y/VYQ4XACTKtIeSFqp3BrMq8r8Yxl94Pz0Pt2SMb6wrgkQipHttLbTx6CQO1eOYhQE/n ko1x90ZXF5m8h6rjyRy3GCGcbJmllgKWwYIBuwlLbg7m3xBSbrIz8mssDRier3owJmJA e0qmiTt9Ic9e3lJ9ruWIAf4tiJi/GJ+aMr2BXTvYr4FzB/3aaB6wQgJS/ZEHpPe2aGur 5VhqA8WsDDPxiE9pRzHhObDIrBKTljr6+soFNrAnrrL7NWERL6wd9Tp+JUF+JCCTWNsb ceyA== 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=PCV3wYEQOpmY72+V1Mb+CICelf2ZsmJiYhnZyGKj9m8=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=bZapwqpR8BaxTDM1+2RQFd+2jvQQyFH/ib/sGTY2iKZO68G2zVcGgjNKBPpCAzoRDp e4NWY6RHnMqxULXBqxehhn9xXI3updPX4/612R7YpbslaAk2QHIeXrl9kTZzdr3hvYRR /gi4LrAQ9n+8PUwakkk//DwaIzZugfJCElfK51JUAby8ZaIzibl5yYDaUGp6NBWMMQeH qForbxKud40DHOqQxPKCanUnG6Xayn7+YUFd8ub2OY8Z+XvO+THQLEMGPZR49X+eq//a 89MttDZKGO3oAEo94kYpeIGuHN60tLAEqeWQEvzeYvtbnjP2vHNGroR1Sx4LPmuWE66Y Mp/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jepb0RVI; 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 d1-20020a0cb2c1000000b0063f82aafb9asi7601899qvf.299.2023.08.15.12.58.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:58:48 -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=jepb0RVI; 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 1qW0Ay-0005Bu-Cg; Tue, 15 Aug 2023 15:58: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 1qW0Ax-0005Al-1j for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:59 -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 1qW0Au-00016D-6c for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:58 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6884310ee75so1651161b3a.1 for ; Tue, 15 Aug 2023 12:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129475; x=1692734275; 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=PCV3wYEQOpmY72+V1Mb+CICelf2ZsmJiYhnZyGKj9m8=; b=jepb0RVIsMULAKTqzdRUKu+sAVtNG8seMOupuNlbyzzQXeU4V+3MExnJFjOVSAcjsV h3KGPPTTDPeIammroCAX8VHFmyyRfqwpiMrZhwkKEYGDEaR76Z7lIGP7vwNmEV3mGann CJfNIY76uKlq04N9pXxCHSlAwkIfr4jDtuVFrwL6l49iozlEJn/yE7ZSqe/ssZKbcWee Lqye4GO67SdpGYVyP2gwuHqa2kYSP9mCJ25KWfrt/00rc6PPYhNcXy5eN+AuByd9Dfto ktovGiXcTwawiJpX8w/yTlKBNX19IQGWh+esekpxp72q+yXiSvPJUnPYuiaELMuV1yRl hsqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129475; x=1692734275; 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=PCV3wYEQOpmY72+V1Mb+CICelf2ZsmJiYhnZyGKj9m8=; b=AQe4GM2r7PIbErZPYWbQUpEpATRRrX9ar+LC59kldh9q7Mi186E2blU5rokBSW9MpV UV7zmEejL2y1rI7PXXyGM1t496NGXYD9wIh+6RCCT9r3qw79ZKjvVV2VBhHFU3yNWz8n KedYbBuBcs5sDw+yd+8atHsPh+04j/wTSchfWtwmha3IetZTHDbNStuRhE8uvKgnnxrL WSx9YsXJ03rZUkhQ10HVHeo311bAdIULSQXmanSrKeBIHfrw5uOmAqu1GbtCsDsLPPjx vuuITs7TAIQHBIfPvC7Pkrvu3+xDV43lEJJ6v0bgN3RN1PuD2M9wXj/dtRdFAsQcnc/N ae/g== X-Gm-Message-State: AOJu0YzQcZNhwjWLu2H9AYbpUH7dZTV2Ea2DBl/JtjOUnEgTTlbdS+xg aBDVILvMd82eMUzUkUF4h4vsFWkA2WAgPsiHLbw= X-Received: by 2002:a05:6a00:3919:b0:682:537f:2cb8 with SMTP id fh25-20020a056a00391900b00682537f2cb8mr15260421pfb.26.1692129474798; Tue, 15 Aug 2023 12:57:54 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 12/14] tcg/ppc: Use prefixed instructions in tcg_out_dupi_vec Date: Tue, 15 Aug 2023 12:57:39 -0700 Message-Id: <20230815195741.8325-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-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=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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 670811b636..0cdb7ef37a 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1237,6 +1237,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 Tue Aug 15 19:57:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713802 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968452wrp; Tue, 15 Aug 2023 12:59:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhmH85f1FfV102UjQMKsZFIO0bUtYavbvEQqkD2Lft97/1Op18IxghczdpVCTOwG6PpH27 X-Received: by 2002:a0c:b29a:0:b0:63c:a22e:ddaf with SMTP id r26-20020a0cb29a000000b0063ca22eddafmr14090594qve.16.1692129586398; Tue, 15 Aug 2023 12:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129586; cv=none; d=google.com; s=arc-20160816; b=ZYEjkH8QpO7wCBGLzbBO571swbUAdE7U1hYmxz1iJ0fRAgfHeTtUgKsCJ5BasKjDnR bPD+bfoDGfwV83VSy0l0o+l4KHfKMcA0TiJ1gFrIoAX3C2ea3EAMnRjiFwBrtekVSTUo u5FnwquzgZ3HGCVKrR3fobAvqy9p3XVciL1fKTn1mUzJ+Eq0G6wt9qe+0U0vA2u/rbqq WoWaUShQiCnYZxnKNl+fh0BBudVVra+d3mo7HvcMSD0C87bUQ/8VIU+tjasU1DdGQ7/h X1QqXENw+bx5v75ZHEH5KaP6A1f9xTSGN1vJ6LRT6hfKktv+7JP6akeKiL+nnldkgdcu shog== 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=kahnV3oB+xxgo9j/7zC+dhuzAxQlheFsZwXl/+I/CfE=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=XpKShbUx/o6/LXcJMdU0TerCqdV+JoL9TFDjsv2+KSLystay7SzhsXus24czjnb2n5 7Zn3ik39hKDkCvAMhJN93sxUty3LjisY9bdmFQvQ3sCuM863S3T38yYy4+OxLb9jV30e lOOGeRW+NwY5zqcgWjHn3U3BQvK8ZBx4EMbfDyyW3LALmyE1+kUivQgo5q39asvTOioq ikxan/UM2eyDxaWXazSP10VSoXMPbWfw4chU4WbgP6Wr/8g8oEBxL8Zq98HkSrt8SIVk 173e/gCmeprjEi2g8Fvz6PPf3gLB0u9Wcz9/8fM1YColFcipYMBWC483CCVlL7rep8e4 Oh0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R3EFotwk; 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 i1-20020a0cf101000000b00647fe073b5bsi135563qvl.532.2023.08.15.12.59.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 12:59:46 -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=R3EFotwk; 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 1qW0Az-0005Cv-4L; Tue, 15 Aug 2023 15:58: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 1qW0Ay-0005BS-1t for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:58:00 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Av-00016P-6W for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:57:59 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-564a0d2d35eso3327932a12.0 for ; Tue, 15 Aug 2023 12:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129475; x=1692734275; 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=kahnV3oB+xxgo9j/7zC+dhuzAxQlheFsZwXl/+I/CfE=; b=R3EFotwkR6BSUAtMW8tIt+pBNGSQu/lmggijPdd+gkjgjgqRqa08lln0dFUgJzni+f h4btbNxXKhgYJAUtf94abv+Qc/yKhB/Vp/c0/dHWW61efFciDpQFcuJ0LIfiLOWbkDY7 1MzlWX8584qi2CsuYm43mw0MXXvQIKawu98artJ4glDUBoTjfU2k3TyD0aaKymZ5q42z S4T08fHv6a3nRLLc3qm7SwzWtGvmlREmZJ/RDShyZQdkwKHVKoPUJRS1Um82p1CpWrbc sXtaY4w8hsKYy5e8tvUKlChoTHOuSh3YNss0diaJqyyji7YUGgOYSU65OsxBhzA9waPR G78g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129475; x=1692734275; 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=kahnV3oB+xxgo9j/7zC+dhuzAxQlheFsZwXl/+I/CfE=; b=K0EGhSxOAZSDLuylN0WJL4EgyRLroRx13xkhh9/ogQeu64tUs6Ld1u+JoZv3eERXbx PZlw3WPTwqVqoxe8aVyB2EFJX7yQv0PGaDcDjyPOS4cCD8p0w9f9BlTSya/vlo2Qgnr0 5LcWK1fwep5TnWgGnOcHDammjWtI+0R7SHjGuy9Dh7tUk0OUUU0VwQUyK0GszY5LZK7U XmfCFh5xpHz6ash+3Gkw01RvC2K3GYnBGgnXkz520lgG+yAPWVSZmAGQhDweQ9KOiwfs EMRC6bFIzaK1zViYlvNBPO++yJaB8AWYN7hYFEmPCRviLMk7DTxEuNwzUVYIGgpzxKpu 1vFg== X-Gm-Message-State: AOJu0Yz0IrNwjMzMcUb4owZaLRYQN4g6uKtjEa6IFfZuqfo/NG/RQtac Gefx1OkAz+1ljvrmam1u8/XLVOifC+BC2ht8PJA= X-Received: by 2002:a05:6a20:3d8e:b0:13e:b58a:e3e4 with SMTP id s14-20020a056a203d8e00b0013eb58ae3e4mr13717294pzi.7.1692129475667; Tue, 15 Aug 2023 12:57:55 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 13/14] tcg/ppc: Use PLD in tcg_out_goto_tb Date: Tue, 15 Aug 2023 12:57:40 -0700 Message-Id: <20230815195741.8325-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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 0cdb7ef37a..20aaa90af2 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2708,6 +2708,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 Tue Aug 15 19:57:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 713804 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1968828wrp; Tue, 15 Aug 2023 13:00:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGliuLcTWVHIUUmTZqLL42zvkNzEdRxOyI3larN4JoRl9ub2fjLbpQRjpy62tvsaBe4SEWg X-Received: by 2002:a05:620a:2452:b0:76c:cf97:51a4 with SMTP id h18-20020a05620a245200b0076ccf9751a4mr3759182qkn.18.1692129632845; Tue, 15 Aug 2023 13:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692129632; cv=none; d=google.com; s=arc-20160816; b=pYwIQ6kheTjTkISnr1Y3QB84gmljkvvDHiarU3fAXKj5F72imYWEH1TTl/ujHFUhTS q8qfCvWshvJtzuXin3rlqZovELZA5ufFjio4+SjKE+BHgADXrfcTd6DYBl8S8YGyAaRc nHpu4EpCoMoFBcseC8MHbixRevtzfjWls6ybuzEeHiJfR02ZbQQpzdej48moaAh59rQO mAc+BUwyYFWhVcnVU27zT49y86FRJ7iDfDjgnlkcSQnfNrXmAkhfgeXu/OSNOWUM9ShL c6tPSN0fFPvG1QIPjh5LoKypiQYSWex3pmsjuRL4sXSDgX27qZ2FZg+VYXxRJmjn40qV pkOw== 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=7pWJR/i0qFrHbOc7VrOLRnKZxmQspNrgrC7qAbkO0lE=; fh=1LlI9qg4dDC6jzYzk4mr2RaPQDh8MKMNLXu5CCRW41Q=; b=z1sx6Ixfg8yFVGzNIUPk+FE2gNMdsQlRAI15w7bQ6sKMn/mS5JD5E9GbrCmNICqv6Z ktuG5oSeTO81ZKKYageDcx4bEt3aG9oqXju0zTZktPJIVVcqZCpMJ72Q66FnTbFK0g3X kkGf4mxIL0oEddkTWq/pVBerDcChN/zv24w+SPVlZj2gODw7I5E4ZlbhRviDZe/p4WAU s2JpAHkykkO6ZO+mTHpcVo6Xl6ouC0rJKrYCyFC9ctyW+c2wqEsKjf06UOzQGIoj33os GpXMOR13mY7p8IOaK9uBrvlJEtgRWHhFKTFKvbuqndHdMlYqWibnOYslBnbAc1VaNfoX SJHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DTMYnhgO; 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 ra4-20020a05620a8c8400b00768096eaabdsi7237346qkn.24.2023.08.15.13.00.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 13:00:32 -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=DTMYnhgO; 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 1qW0B0-0005Dy-CU; Tue, 15 Aug 2023 15:58: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 1qW0Ay-0005CZ-SS for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:58:00 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Av-00016v-SL for qemu-devel@nongnu.org; Tue, 15 Aug 2023 15:58:00 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-686be3cbea0so4570598b3a.0 for ; Tue, 15 Aug 2023 12:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692129476; x=1692734276; 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=7pWJR/i0qFrHbOc7VrOLRnKZxmQspNrgrC7qAbkO0lE=; b=DTMYnhgOAiNDXW4Xth/rKNHm5oPoXmAj4BATxWHK6Vqp25vvq8JnbHJgk15+wQfmHu EnY7sGc7wOm5oyPv2HgpNDRMaquZPrqjlHLy4lE7rfRGgtxYNWLEhkA9MRtkIl8KsgbW UNAwFlPI38+X6OlOcuoLM8WK9/nwA2wQkPPOzVO7Z32nBYtukhOH4bfiZ4taq+9fMr7v kkjaopvFLgEXvRVXd6jKvZLskydXUdSQ8NkFXbtHF0QngaM8nKG/p1owRQ6HUPV69lhe VxIFfnyjmsLzBLmRT2gpCZVmTMFgXYubxdLz7lgD4DQjBTpjf1BbBn5WmEFqe0XvJuMy +TJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692129476; x=1692734276; 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=7pWJR/i0qFrHbOc7VrOLRnKZxmQspNrgrC7qAbkO0lE=; b=M7KZNHv4p+qiTNmsSN8sY31yfG/5Zn7OYMttUwkFkXVQLSXzhOWHt11Rp00THm1kqn G3aXm3jlIOTQqICsI5LYqHufFH4bmRpEX656Nzt98n08QSCm/DNruXcYMs61FDRIsTJL bynHJswNXctISPGjVSmmgmqDieaFl/0ESd3AkJEPkiBd2LvRXrGRDiUcJbQQ9wMiyVop iltjeLET4n5SoFGThtgxW9i8sTC7Uf3galphScbgyAJfP2CfNrr//ifkhoAqla83Rzx0 TYM2rYeQr3QV5WyKPC1zrWMHyOmc8IAYAG+yACa7s/oreKvFRXVVE4W2/r9+jAgjqbGP fTHw== X-Gm-Message-State: AOJu0Ywc23O+RqUi2+jjwgV7HtyIr+/HQgVAhW0sC6iQBv6bfSkTl+5a 6Df6MGJaJ2SBLxq5Mx8iWwoWjmN9cVRUoH1ZKF4= X-Received: by 2002:a05:6a21:3295:b0:12e:caac:f263 with SMTP id yt21-20020a056a21329500b0012ecaacf263mr3594015pzb.20.1692129476627; Tue, 15 Aug 2023 12:57:56 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:8d06:f27b:d26c:91c1]) by smtp.gmail.com with ESMTPSA id n7-20020a62e507000000b00686b649cdd0sm9667699pff.86.2023.08.15.12.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:57:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, jniethe5@gmail.com Subject: [PATCH v3 14/14] RFC tcg/ppc: Disable TCG_REG_TB for Power9/Power10 Date: Tue, 15 Aug 2023 12:57:41 -0700 Message-Id: <20230815195741.8325-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815195741.8325-1-richard.henderson@linaro.org> References: <20230815195741.8325-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 may or may not improve performance. It appears to result in slightly larger code, but perhaps not enough to matter. 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 20aaa90af2..c1e0efb498 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 *))