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: 1821530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=n0Z6Cu6Z; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMYC259xz1yfb for ; Wed, 16 Aug 2023 05:59:27 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IGukj38lkHvHU+zGwDyy8mP5ioY1yQbpHjotJHn5raXFUoKiNWSiGqH5M03NzZRs3LQQW/9jQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=AYYBe0lf; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMZ00M0lz1yf2 for ; Wed, 16 Aug 2023 06:00:08 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IFAjbW0smhHsPKx8ZFkmLZCrJ7kaWjwsplXYPKG8f8Q0sAHANvPg2VPJ84LKwLcJp6JYseFSA== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=N1rwoCLA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMXT4JsKz1yfb for ; Wed, 16 Aug 2023 05:58:49 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IHZib8IuC9nI61INci0AIgBLbg743/dbiv7LnPGv44cVSstcdLeCxzk6tT38zy3PbFPI0g9NQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=aaXR0WkJ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMYS6GGQz1yfS for ; Wed, 16 Aug 2023 05:59:40 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IE3uXH3yvrzTXQDuPntwAtZzw8hrxilut/VqemE2gPVeC/8YhZv1p5BEVm+wADHihOpL/nNbA== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821528 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=SLLKOxFh; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMY10GGHz1yfS for ; Wed, 16 Aug 2023 05:59:17 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IHWnmUryb0NElaSyPWB1k2J1sqWTrDuKjPgqjcANuUnc/7bYbUIIi7jdN5XP2tzJ75zx6Ismw== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=h5CL47Fi; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMXx0Phvz1yfS for ; Wed, 16 Aug 2023 05:59:13 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IHEr1qGnuFuy98LMxQO6hfC8XAlMa2EW0jNgFXoAq1QXhJv48BawK2YiwGEdkZEs8jlFc8/sQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=KkdJjxmP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMZj11Cxz1yf2 for ; Wed, 16 Aug 2023 06:00:45 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IHIhI7VmVhk3kkyvqBKothXLGqeCknbaLhFRHR6LM2XX6uqaDeXWoKIpsQjOGIT1sYHkOG0NQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=glcOeLGm; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMY5659Mz1yfS for ; Wed, 16 Aug 2023 05:59:21 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IEhybxdv4IEQf/HGShZ7x99/DkHed6uKyJln8jaAkszcM0ffnEHdlBzJjuQrY9hBgzpiPtH2w== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YjELarhX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMZs3r6Nz1yf2 for ; Wed, 16 Aug 2023 06:00:53 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IFpxqFJrhKk6a4hnsSQNnBJ3s2roGPqX1B2zc9yb+rY4iNV7RCz3ox2BJgTi3fp28ns4GZNmQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821523 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Iph7fDMS; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMXT6dvkz1yfS for ; Wed, 16 Aug 2023 05:58:49 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IGGAX6z3G07PO5zgZM9KKODvOBEVjri7RFbhKcyOtI7D+bFdCw7j0HYnXH38iwsofs+MRtjdA== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=PQS7Veyx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMb64MSKz1yf2 for ; Wed, 16 Aug 2023 06:01:06 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IEG+SWmRzhBdd5c+he4JPYFCn4esQdgUKhlpOjD/tv0BnfWOvnWuaeCjPBvv5FgAdm9M8MeYA== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=jepb0RVI; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMXT4zt2z1ygB for ; Wed, 16 Aug 2023 05:58:49 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IFKCkyWHFZSQorB8ZBayO8CBkuq0ekqoY5oMv/yRBC+bjf0U4CH6DTujJNemwiEpZtJBJaRvQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=R3EFotwk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMYb25stz1yfS for ; Wed, 16 Aug 2023 05:59:47 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IHj57XEpJ+46+q5/aOzspp7zZuA3rlQpSLAnnAfHW9iZsomWok67+CCsfz0K64+Hz5SZg2VpQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: 1821542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=DTMYnhgO; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQMZT6V3zz1yf2 for ; Wed, 16 Aug 2023 06:00:33 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IFhWrjPFkRgHZ/HsHtjaf2Aa/OZ8HfEAsvbvwQq/IJlOTvUDqCFDrEdSjs6ps9iKly3j7QlDw== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 *))