From patchwork Tue Sep 6 10:17:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 603026 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp4448428mae; Tue, 6 Sep 2022 04:44:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR7iUoGsaGzRjAEfj1U4SqVDJDx4vKIGSHi2MRz3atK51xaYj2NH3jaqXutHmsZ/vUTlCPO/ X-Received: by 2002:ad4:5f8f:0:b0:4a9:b75a:e33c with SMTP id jp15-20020ad45f8f000000b004a9b75ae33cmr5199266qvb.82.1662464684729; Tue, 06 Sep 2022 04:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662464684; cv=none; d=google.com; s=arc-20160816; b=o2ytoJNAzsRp9Hwae1m/jolL1bT4v6xgFz6ewDbv6ZwJ1zmGldgtu1t95Jq49vKBOq rX7XDNjkdvYsbKmSWzgj+RpjlnDEWbmTAJEf9vk7AeTN8v8uZZjzmxiKYhKZPk2Frxtw FzePRz+wB5HvkFQjm6nIKAzhmeuTXpBzMUQDgWcTEk0xYt8pjv+fexv2b96wdcmLWd7U aj8/Fc9UlJ8PNgmsuKDLmdv7EfeXekUQ+ceRX+yEGMb5GUEUMoj/hJ6KIK6yJixnKUHN XjRo5TmXo89ERE26HldqEmLt27biA2HGG9K1FXzbeMKHMIaqoRlMHbRbPTbHVH2aRkYv RH4A== 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=OGKK8ii462fh2FYHuqVoO8HNQ7SQYpLXPO2c0Erkaco=; b=SWWxIe3AG5d6UfuSt9lNGHYacjpWEvVEFrSwPt2afJ+HO4XKKVssZ2/+7K85BqruKx Jb+Kt5yfHqX69LQP4B53kG2v+ubexfdERCcwbouTSSYKlq5mzhlLDEKOTIU1JVl3d+LD a+QDV+cFQHddrUkzShhooqL/CvDua0of7Kkip2f1chPzbvvQ4UwTLj12bbm1TKqG19c6 TlXD/mVaxv840Lbr6Uqn7sQpFTfDC8MhgzB7tcdPQVTNTlmWdXgNhSxMjNsU4bJ2MCaX tkHLZ/6KUBjwuRNzDaKXO0TbcYQa5Zx66XixEU84XEySnAWjva91uvbnPp9u9X3t+Wtx MhfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nzgLiAUR; 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 n16-20020ac85a10000000b0031f402c9688si7811003qta.653.2022.09.06.04.44.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Sep 2022 04:44:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nzgLiAUR; 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]:36858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVX0W-0000tA-7Z for patch@linaro.org; Tue, 06 Sep 2022 07:44:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVVeq-0003Ok-OP for qemu-devel@nongnu.org; Tue, 06 Sep 2022 06:18:17 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:54852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVVej-0005GY-7A for qemu-devel@nongnu.org; Tue, 06 Sep 2022 06:18:13 -0400 Received: by mail-wm1-x32e.google.com with SMTP id s23so6612870wmj.4 for ; Tue, 06 Sep 2022 03:18:08 -0700 (PDT) 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; bh=OGKK8ii462fh2FYHuqVoO8HNQ7SQYpLXPO2c0Erkaco=; b=nzgLiAURtWBJa6M/P/5R8CKZZT8hkCxWxG6BBTzCvbAO9EnqKeqtlt+jDdNycFfN0E g+OWKC8OHcmkF+ZLkfEkwWa4Pl8XNnGecRchsdN82zrh883CSQ804R2KJUv1rGK4Mvcl NIuKu2SKEx3MP0O3BC0aQHxhzT1WtfiYrlDq0EOkz3X/F8mw+A2D4vgx9NuwoQMVBNkj JJmlNRj0ETkWVjWm9fq5ygD6lKf4ex1s/Felg2Zb7z7HwUMA/cGboLkfBhHyVmFVQypz ZkBO14KJ4CuXeeN2brHhlJXQhmp0kdmMx84N+q5sUpBAXc019n7l2XemjHtFZYZE0rBg zrEw== 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; bh=OGKK8ii462fh2FYHuqVoO8HNQ7SQYpLXPO2c0Erkaco=; b=WeRHkhOZTNhnfoNmd7BlcOWx4+DJ6ig0Uqe9gcvkAGwVsL7h/9niSAzqR9UBuU7cSc uov3QyxdcRfFSNawprfyhA805WOqQajKBkWnRJsM1gRuOV0OSJgrTAGHxQDlYJU9KKjq lYpYarU+YaYHSUbHjWOwe03MN31mXHTC5FmkMROdxB7ItcdI/WQkFuCe+zxSHJNwPvk0 oZt5TEc1jsKHmkeO3OIlN1NLKuBUpWqWe6qbtGvj68CL73dmCJUZwtEftRLaB4Afn0cL BYWwTHR33Bz/DaruFLjj8MII2VktfrS3+zntFKxxThrAAhNgTboOJVGO7Y3UW2AZCKxW 22WA== X-Gm-Message-State: ACgBeo0d/sSfOgcVsFPgoQnfoiyJmUf5uLN74MiNhhdQBDVCiBB/h39t 57zN9z+/i5CxLuX94cQussCiVlq4FUt3Nujj X-Received: by 2002:a05:600c:25cd:b0:3a6:811f:3a0a with SMTP id 13-20020a05600c25cd00b003a6811f3a0amr13311461wml.53.1662459487747; Tue, 06 Sep 2022 03:18:07 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:ba98:3a71:8524:e0b1]) by smtp.gmail.com with ESMTPSA id y16-20020a05600c365000b003a62bc1735asm14094361wmq.9.2022.09.06.03.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 03:18:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org Subject: [PATCH v1 18/26] target/s390x: Split per_branch Date: Tue, 6 Sep 2022 11:17:39 +0100 Message-Id: <20220906101747.344559-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220906101747.344559-1-richard.henderson@linaro.org> References: <20220906101747.344559-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.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, T_SCC_BODY_TEXT_LINE=-0.01 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" 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. Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 712f6d5795..bd2ee1c96e 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 (s->base.tb->flags & FLAG_MASK_PER) { + gen_helper_per_branch(cpu_env, gbea, dest); + } +#endif +} - if (per_enabled(s)) { - if (to_next) { - TCGv_i64 next_pc = tcg_temp_new_i64(); - - 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 (s->base.tb->flags & FLAG_MASK_PER) { + 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; }