From patchwork Mon Feb 20 18:40:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 655105 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1551683wrc; Mon, 20 Feb 2023 10:43:25 -0800 (PST) X-Google-Smtp-Source: AK7set/1XIM++qKeAwCN43iADClCFn1lDk6kRE9tVIHlnb5RhR9zHTvJ2fBCuu4S6B3M90vUqSlz X-Received: by 2002:a05:622a:346:b0:3bd:140c:91fc with SMTP id r6-20020a05622a034600b003bd140c91fcmr23146218qtw.47.1676918605811; Mon, 20 Feb 2023 10:43:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676918605; cv=none; d=google.com; s=arc-20160816; b=QNU8idci90XgAp9hSvgRitHRWyMyhitpa2z4sfrNufhWqob2G0/3kp7aWnNqLlF5Rk MxVY3M/ByAjp3qojp3CzjKsy5v8SgtfUrSPRvdud2oD4fu0t2VXHFN6OawD7+aqxmysQ i+1264qH8ps5+32hUZRAb3TffK+WBRcHcG/KLFnAO8Y7RXnft8Zy1Rw5QK5Vm7BzhEAM UtibmdKUQUFh5+dHUnXM0HNrkedLGXVP0fSZazxd8we5evB091e3IwHGDB3HwfwVtIpg mv4Qor//SQbvqrwhw/tEoVLzWUU7L/V51xvSnyAZKhJ2WkUfmeDsdwaF8b5HqRVv3duY cM/A== 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=FVcoN5if0V8Us809c/xVyI5a/NDqYw35Cn85wK50aSY=; b=wHdqNu+/B686P/YmO2V7g1h90aIrtFyFDqtzFPXYtoA+y2BWm/WPECdxdkOxgMcUEJ 4yvgcSSXMd+Nt2w1t3yrJtk2nazM7baiB90yRR5LE7HBFVt2/JJ1Q75qQxrWD+3HvvbR mi+CDBxhl9eCife/E0rJ/m98F6f3+Fi+vNp/DLdG/lDrmK+iJEakNJCA/8nAg93tDqR9 2rloOUZp20g9l8XOGBR4bpg609N6ZRtB9NELzsPwIp1M2xX4qrGK1RtJm40LOUD91+NS O9oJOWyehvwK9tuWb7DwxOxGZ2bcK3xEI7n2UJVQ2UdwkZ3Roy2gbZ8pZZpcIUof+uVM 9TnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zv9ZHg0E; 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 bk42-20020a05620a1a2a00b0072c8c425119si310316qkb.630.2023.02.20.10.43.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 10:43:25 -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=Zv9ZHg0E; 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 1pUB82-0005UB-7Y; Mon, 20 Feb 2023 13:43:12 -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 1pUB6X-0004Xu-34 for qemu-devel@nongnu.org; Mon, 20 Feb 2023 13:41:40 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUB6L-00046G-Cv for qemu-devel@nongnu.org; Mon, 20 Feb 2023 13:41:32 -0500 Received: by mail-pj1-x1035.google.com with SMTP id 99so2302524pjz.4 for ; Mon, 20 Feb 2023 10:41:10 -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=FVcoN5if0V8Us809c/xVyI5a/NDqYw35Cn85wK50aSY=; b=Zv9ZHg0Eo5+8mAeI7KLlyGbW5acH+U4uy4af/FZYiYoXq4kPDoad+fpFbbD6kHjRC3 L/2bKVfOBE3+ymupUMIgNwKXmqNdsSRHT0V8uh1e+0ZsVrVER2f+VjbA7X+W/KuVCbPZ gqKfu1sK62JEcbeVnqwxBD1UtoGw42r+xoeETxwnE4ScRMmP1GbB0iuMgeMhb+jF/Hwy zV7AADwgsD9b+Sll/4SPeOtUsQOyyqFkppYt2NknxCW8mAmz4mcOg8x4LWYx9LWiGiLy E/R3N8bAuNk4pPF+HnBC7rBp0fHomo05gaEGxj/fPszC0AB5xl9t+Qb728aSRSTcof3r sT1A== 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=FVcoN5if0V8Us809c/xVyI5a/NDqYw35Cn85wK50aSY=; b=4XGFtToxrJGd6gFmjqDCGpmn/5DNhtynf/E+LH0bkcLQNUqzolrXCJVrTTb9LEqrmZ Q8MlKW7KL5TKFk97AA3m2hep3u9NPoOXI5frEMCj5TcST3/PP91Ad947+5quK1EumXbp d2tRVwG8oGVC77biyZdjgQ71a+OIlb6UArTI+zCDSx4d17NrlZhN4mb3J0smEqvMKqQM YaYnrGkCQgXrkd9GVAmdgMywXBGgD/2fLvzGF2Lf5s1BDb0y96Ey7HJAd2Q+9EqvjfzX xzmTDq72DcwoyaTvp+nKuaJ+zpUfjtAVKThCktR8zi33A4gY3jL2bCPWNZu/ROBD3HhJ I7dg== X-Gm-Message-State: AO0yUKWEF6O3nmgNuaZIMzV7xNwf2KYabTN0ay+CNUtePueCxpk0R7IB oEz12/qKxB2Cc3Ykvm/DnVx1DpsDI0O9eLrjKOs= X-Received: by 2002:a17:903:1ca:b0:199:41a5:1085 with SMTP id e10-20020a17090301ca00b0019941a51085mr4213559plh.33.1676918469944; Mon, 20 Feb 2023 10:41:09 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id jk20-20020a170903331400b0019258bcf3ffsm1911676plb.56.2023.02.20.10.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 10:41:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, qemu-s390x@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v4 07/27] target/s390x: Change help_goto_direct to work on displacements Date: Mon, 20 Feb 2023 08:40:32 -1000 Message-Id: <20230220184052.163465-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230220184052.163465-1-richard.henderson@linaro.org> References: <20230220184052.163465-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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 In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index faa6f737ba..bd7f644f83 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1161,8 +1161,10 @@ struct DisasInsn { /* ====================================================================== */ /* Miscellaneous helpers, used by several operations. */ -static DisasJumpType help_goto_direct(DisasContext *s, uint64_t dest) +static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) { + uint64_t dest = s->base.pc_next + disp; + if (dest == s->pc_tmp) { per_branch(s, true); return DISAS_NEXT; @@ -1185,7 +1187,8 @@ static DisasJumpType help_branch(DisasContext *s, DisasCompare *c, bool is_imm, int imm, TCGv_i64 cdest) { DisasJumpType ret; - uint64_t dest = s->base.pc_next + (int64_t)imm * 2; + int64_t disp = (int64_t)imm * 2; + uint64_t dest = s->base.pc_next + disp; TCGLabel *lab; /* Take care of the special cases first. */ @@ -1201,7 +1204,7 @@ static DisasJumpType help_branch(DisasContext *s, DisasCompare *c, goto egress; } if (c->cond == TCG_COND_ALWAYS) { - ret = help_goto_direct(s, dest); + ret = help_goto_direct(s, disp); goto egress; } } else { @@ -1573,7 +1576,7 @@ static DisasJumpType op_bal(DisasContext *s, DisasOps *o) static DisasJumpType op_basi(DisasContext *s, DisasOps *o) { pc_to_link_info(o->out, s, s->pc_tmp); - return help_goto_direct(s, s->base.pc_next + (int64_t)get_field(s, i2) * 2); + return help_goto_direct(s, (int64_t)get_field(s, i2) * 2); } static DisasJumpType op_bc(DisasContext *s, DisasOps *o)