From patchwork Sun Dec 11 15:27:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 633082 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1993082pvb; Sun, 11 Dec 2022 07:33:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf7OpbuIW+I4uU5oVZovvYF9phufaCqedMIbravukk/lMycIVYOqYiSI316sIGos8UZEzIlB X-Received: by 2002:ac8:4a11:0:b0:3a7:f599:1d2c with SMTP id x17-20020ac84a11000000b003a7f5991d2cmr19687380qtq.63.1670772800843; Sun, 11 Dec 2022 07:33:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670772800; cv=none; d=google.com; s=arc-20160816; b=zsUpw70FmNU8P3SJA8etq8tIyua23F3auYHYTJXvEHjcTiPnhU/wSgBoX4/6IF9a/G ADc5lIIJGZbYFbOCIkzN4B5ItCtv86YoCuehNqo5+fvZFmT0T9BfEonMZuvauXIHwx0b oxXo3yHqzFjXpUP21Fns3W/wAwIdjI45TERs/jxaE1kx51BY0jxykQhSC9EuJn+pVCdn H+YcnycUKzC1WQMHlcDytcK9NPBTcB9JXPiauEfbD6tYVWq0qgifDhT8k5f+0b7P+Fi9 jo/ETaqRoMVCGda2ksee+VOxU3irtLJ9R1jOECiX/edsrOARHErD/+e8o3bczTdITkFt r8CA== 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=H8MpUEpMQiUpwtCPeAM5pmeXAHWrn/qz8xIsZr0JfzE=; b=Z1j66EqNu0GRVNPjnxXRELT3vKReqwXOMcGp1o4QB97tUbTOp2Zzn1zLpE4saC2kwS BchNI4cWxO1+CoVp5kcwrymY6VpGAe0fW0EcJjZ74/0+44HTjogdnYXBcbEbS8D+awyo GYA88msPzEoDENcaxSVQSj2lilGwBe3KBk6lwQHFbOU2yqREbK7i80zRKmyIEmkoZ7eB X/M/4lmwbJ0mr/QWPT/IW+NPrkNmcGeapNbz/qGJQOBxUQc5qfONbpGzvi4eKeSAoVnV j0ba45m27gvUDF0C9LqXk0INulYhF1EXostXPYoCxGv8sP8D+GZE5s1+4Y4IuFeMZ1Mg ZsfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ix7+Cxdz; 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 15-20020a370b0f000000b006f9b019034bsi2759265qkl.259.2022.12.11.07.33.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Dec 2022 07:33:20 -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=Ix7+Cxdz; 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 1p4OG6-0006Zi-Ib; Sun, 11 Dec 2022 10:28:54 -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 1p4OFp-0006TF-RN for qemu-devel@nongnu.org; Sun, 11 Dec 2022 10:28:37 -0500 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4OFh-0007tI-D3 for qemu-devel@nongnu.org; Sun, 11 Dec 2022 10:28:37 -0500 Received: by mail-ot1-x332.google.com with SMTP id db10-20020a0568306b0a00b0066d43e80118so5859237otb.1 for ; Sun, 11 Dec 2022 07:28:28 -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=H8MpUEpMQiUpwtCPeAM5pmeXAHWrn/qz8xIsZr0JfzE=; b=Ix7+CxdzxAQxolytdhWBYHYSWyNwomrlSHwC6rqluphKWlrhBHKmKu6Nhu1975U67g 6wyOuDE7j6Xq0fXTYisJAPDJwQ9yA97bg/dNwm71vV6ONBYryjAWBdIcoXNnh0HFFzQM slvg+LzwTfcMR0dpiTOwePuPHVmmj90WsoZcfzkeoGr5WrjRzEGl/mif8y0YU7Pl1k6y dHJduMJmm9IKBtbYcrS/sdYsc3Y5PzC4CkiFwu4kOdG8RhSHWxpw+gwdtjqOIGsNI3D2 BJN6QOkDfY3OiMLT6yAo4F1tvjBSS5eLJgDuitedE7gC4rBBzpVQMk593CUl9BDv0BRr utLQ== 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=H8MpUEpMQiUpwtCPeAM5pmeXAHWrn/qz8xIsZr0JfzE=; b=f7narUV9BtEmuZva95stBQoHh+U1VAr5ZYBN3DBYe8Z5CCqfWG+H0PcVeK53Hrsd5J IwpXO2yEtndPpYRGqLFd6Csx0LR+Vyw5AAZkUKzbgAOj0WiHxsudoixhwDWaCNB5TkAQ EXiTzq5hVQdspx3hn9hCY/W14cSVovShPetked+1pLxjTUOENPlKxnsEcyooWP9kGhrR vEQIzF9Z5l9Btrfc6+oRHzxFFcuWyqqR8i9ONF6qCEVkbC0VeO2mOMZs/W4vL7iHNfRw /cbkvZJHMrl5xUG4q011WF0STxrT+Aie812saHTIjM/T0bB9gXDT+CPgRwSJJqCwFcak iDQg== X-Gm-Message-State: ANoB5pkYb8fKsMud5QzmPUeHWkQh2CHtScxZtPLZICdtoJ2WLUND4l9Z L8zAWpe/MXs7E331JyyP04WypfnodJJkLLNMXDE= X-Received: by 2002:a9d:1ad:0:b0:670:583a:467e with SMTP id e42-20020a9d01ad000000b00670583a467emr7634743ote.13.1670772508293; Sun, 11 Dec 2022 07:28:28 -0800 (PST) Received: from stoup.. ([2806:102e:18:2efc:7b4f:f28b:eca6:b583]) by smtp.gmail.com with ESMTPSA id q24-20020a056830233800b006708d2cd8bcsm938140otg.65.2022.12.11.07.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Dec 2022 07:28:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v2 20/27] target/s390x: Split per_branch Date: Sun, 11 Dec 2022 09:27:55 -0600 Message-Id: <20221211152802.923900-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221211152802.923900-1-richard.henderson@linaro.org> References: <20221211152802.923900-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- 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 7506eff4b0..1192024f3e 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; }