From patchwork Mon Jan 9 20:08:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 640698 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2341427pvb; Mon, 9 Jan 2023 12:25:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXthhF4GBFqMrqlAJMU/gtX3mmxQZgOxYA7d8woRZFis4DwsREM5Kx1oDciPXSu+Mb1vTxAY X-Received: by 2002:ac8:4e16:0:b0:3a9:8c90:dcec with SMTP id c22-20020ac84e16000000b003a98c90dcecmr77926579qtw.68.1673295937764; Mon, 09 Jan 2023 12:25:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673295937; cv=none; d=google.com; s=arc-20160816; b=Q1QECI2W3STGEhQN01ii/AoS4oJnnnmv5YktI5eVbqWBkWDe6zl6MtRSO9h6nBQq8j GVj0jIP1YqMjWY99cEnJph/Q2ZIyd74IaNSGRU/LGtNaI/OxzO4o39IwwcXjcdAnNtTl 9+YAxaZx5isohJkNcycyFQm9ayK4tVToVfzUFBIbE1ui7fQA8U0CPgGXvNLdPSWSQXdL skQQ4wrWQ7YLil6jTdWxFvBaLLTMsCUhd6MbnMXHF8+yk1E2D6ak0gKxFVUywnTESEWt slaPCCCI+55Y+wFfBJEny5V9lph0KrKSxqkPZWwS6JDRT97sh0zqL7AqaYgBIn3jaikQ FNvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y50Lp3m9kvjNtC3mDiVU9iejxX6y2luF3bPL5MUhbdU=; b=bmyjp7F4py7SY/K+85+RXTqXvnkw95SjUS0kTsFE+bH6U5g0y/N/HHG7VF/GXczGGv CJZD7LylluAeJ2rb6yO/y3goi0F9+j/Iwu0XM41eutYRpHWOSDOT1RsLpU0wDw5Bwa2F ZKdZE0Akn7Sg3sgKcYHizDflK4eO8Yhp259WXDmj+dJ1khXd+McCpgPJDK8edohnOOp+ mfWQti6QdH3cX9fC28be8VcUUN+aX0jqBAZjV7kVa/w7n6wfbns1zlbrAHkWwh0WkO2+ QCYMsXsLtRQabXKRJL0zyXticHp9EDLlIozxFfqu4UTluBen32Eixd52+vDwkZZqIBqV F+Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ltRRooQv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q14-20020a37f70e000000b006ea90816130si4941839qkj.624.2023.01.09.12.25.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 12:25:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ltRRooQv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRu-0003KX-8x; Mon, 09 Jan 2023 15:08:50 -0500 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 1pEyRq-0003D0-Ft for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:46 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRo-0007NH-RS for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:46 -0500 Received: by mail-pl1-x636.google.com with SMTP id jn22so10737032plb.13 for ; Mon, 09 Jan 2023 12:08:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Y50Lp3m9kvjNtC3mDiVU9iejxX6y2luF3bPL5MUhbdU=; b=ltRRooQv5yEuV+slonl/WThJ6As1kH+qXAG8GW8nrGo/8fQOab3HSPslZjBnUR1Ajg 3dE7zeGj+ZX/uF7UmMVmx+1tVT+VLQas/6pSd7YuvjtkUVYUk5f3PJzvUrMB5STXOBlU /QXuc1N46LSiRPeirNz/u3HpJlD7hjI7o6HXFfZ8RV3HHfTXG1gjWp467MskjwSMRDmo I5XZ5AsYIcLQk/MDJT2b6Zu+WOmo0/gaN6Ip8uXrTFaZLL2F11y0VVpCOOpTr6TqZD92 JxrxLHT916q8sin7Zq8lGb+r3mSNgIMU8B0AMI75/U8l93u6QvN9NtdnWNmKb/EuXHYb 5ZmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Y50Lp3m9kvjNtC3mDiVU9iejxX6y2luF3bPL5MUhbdU=; b=dr0k746v9gm+5gaRiGDhdqk7Kdq3O3nAe7zwJYp+ghTiWGaFrNAHkJIhLRLPxKppTw 2CYczDp/qzHh4UkBgGa3tDVBR7HVak9BrdcCkilM2QwkU2bfPNVj5IQbnPZBE/zlhQ24 lUfNI/VN27qx/sbJgzzX7stq9TjKDSQc23WqEIz+0rqCYf0/lmr/i+dwOpU4CqSA+La8 nNf48G0FH0geRaLmWKPX7Grr4BiT/eIcU958yEzmOlE9Bm49BI9QjqiPdI2uBKvg0GoV oqXGVqGbVQ6pCczEyQ+Y9wMKjNiLC/QLSLtyvKAtpCWMK1zjiQ8H8N3duaYiC8WrmYL0 IgSA== X-Gm-Message-State: AFqh2koeia7yBTgE3bkeu1pFAoofH03gDZzMaPIJs5HpzhuBDv5LzF8F 3uGXrjWYjTMyDvOL/6v7O3a02UPvOwEe/SgL X-Received: by 2002:a17:90a:fe89:b0:226:e59a:f869 with SMTP id co9-20020a17090afe8900b00226e59af869mr12647703pjb.43.1673294923928; Mon, 09 Jan 2023 12:08:43 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 20/27] target/s390x: Split per_branch Date: Mon, 9 Jan 2023 12:08:12 -0800 Message-Id: <20230109200819.3916395-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Split into per_branch_dest and per_branch_disp, which can be used for direct and indirect. In preperation for TARGET_TB_PCREL, call per_branch_* before indirect branches. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/s390x/tcg/translate.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index dd3bd9531b..e3855f6e09 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -350,21 +350,25 @@ static inline bool per_enabled(DisasContext *s) #endif } -static void per_branch(DisasContext *s, bool to_next) +static void per_branch_dest(DisasContext *s, TCGv_i64 dest) { #ifndef CONFIG_USER_ONLY gen_psw_addr_disp(s, gbea, 0); - if (per_enabled(s)) { - if (to_next) { - TCGv_i64 next_pc = tcg_temp_new_i64(); + gen_helper_per_branch(cpu_env, gbea, dest); + } +#endif +} - gen_psw_addr_disp(s, next_pc, s->ilen); - gen_helper_per_branch(cpu_env, gbea, next_pc); - tcg_temp_free_i64(next_pc); - } else { - gen_helper_per_branch(cpu_env, gbea, psw_addr); - } +static void per_branch_disp(DisasContext *s, int64_t disp) +{ +#ifndef CONFIG_USER_ONLY + gen_psw_addr_disp(s, gbea, 0); + if (per_enabled(s)) { + TCGv_i64 dest = tcg_temp_new_i64(); + gen_psw_addr_disp(s, dest, disp); + gen_helper_per_branch(cpu_env, gbea, dest); + tcg_temp_free_i64(dest); } #endif } @@ -1172,7 +1176,7 @@ struct DisasInsn { static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) { if (disp == s->ilen) { - per_branch(s, true); + per_branch_disp(s, disp); return DISAS_NEXT; } if (use_goto_tb(s, s->base.pc_next + disp)) { @@ -1184,7 +1188,7 @@ static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) return DISAS_NORETURN; } else { update_psw_addr_disp(s, disp); - per_branch(s, false); + per_branch_dest(s, psw_addr); return DISAS_PC_UPDATED; } } @@ -1192,7 +1196,7 @@ static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) static DisasJumpType help_goto_indirect(DisasContext *s, TCGv_i64 dest) { tcg_gen_mov_i64(psw_addr, dest); - per_branch(s, false); + per_branch_dest(s, psw_addr); return DISAS_PC_UPDATED; }