From patchwork Thu Oct 6 03:44:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 612874 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1205548pvb; Wed, 5 Oct 2022 20:56:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oMWdajZqWmeVfH5tuEzEqIxpA6dEqzNWJNtWeMetf/G8ZKN9j/KQxmB9u6n9XnF/P2qXa X-Received: by 2002:ad4:5bc5:0:b0:4af:b73f:1914 with SMTP id t5-20020ad45bc5000000b004afb73f1914mr2302721qvt.117.1665028583163; Wed, 05 Oct 2022 20:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665028583; cv=none; d=google.com; s=arc-20160816; b=YSPbaoKMuQLUIpd8MwMUcLLhxM0k6j3UhmVQr4EaY7P25jSynJuxqrR5CwIG5V3k5z alVDb67UWnAPiGgiYSgSS5eMtgzNnMu9X5Uj2Kd6kkCXzBADQ3pFnMSvFDXT8b4RxMIM 5HUnj1gTEUygAcH05KXZAnygpGEbYHZCuHEcmKu97XiVwRCJPnwdMIDodr3Go/ugKd8h KUk9BPZ166eMjJCCx0mJj2m+uk3xw4e4hLcgIQaL8DG8TMBowdvgemcMZ8FrOTmgtDqO nlRJ+66I1pMRkdk8rWmwhn+pTnQnjc53N4Uz1ETKkIwNn1TO0ktaV7tafgpaL4Q1NQzF tjzA== 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=/5fBWGcV8KP0yYWYzeZW+deZNVZGvo9JuykELaazvaY=; b=RJI0wbiVuru2QvSZzi1GjQWRQdOU7uL6Qy2i2nuSERYIA4TPlny90uOLvbI85GRPre 6hPQCYmEBWBqJ0VwcRbOSHbW0+SjRKpSY6yaoQjWL/GNtWxIk+YEO9cIMwHqqBr2OGzJ zaJCaST4No7Dh1o7aKYNLsRh3N8BS+x3WpZsEezHOWrhDg1vxkFMJoWIl09RPV3tni/c Dmwz4ng13q6iy1KRU9doXBsUkmx5KiVrYZsI8GE2QKbEckzVsacA3zWKJHQ3lfVWhl7J 8C1Etcxf98v28rCQkgVadN3EMXK9UVYInGhlPD/j77htedVh7/4mwB2hQzR0lHNFFS6l rtIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kCCBVhY4; 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 cn3-20020ad44a63000000b0049b876cf102si2533100qvb.100.2022.10.05.20.56.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Oct 2022 20:56:23 -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=kCCBVhY4; 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]:59542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogHzi-0006nN-Ks for patch@linaro.org; Wed, 05 Oct 2022 23:56:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogHoG-000479-IF for qemu-devel@nongnu.org; Wed, 05 Oct 2022 23:44:32 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:45967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogHoD-0003sB-Eq for qemu-devel@nongnu.org; Wed, 05 Oct 2022 23:44:32 -0400 Received: by mail-pg1-x531.google.com with SMTP id r18so722587pgr.12 for ; Wed, 05 Oct 2022 20:44:28 -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=/5fBWGcV8KP0yYWYzeZW+deZNVZGvo9JuykELaazvaY=; b=kCCBVhY4u60tCjWzPJfBi/qatrJHdcQBfBNK5eEd7XZ24yJf45rMoD7/6Jb6rg4Bry cYMg1ctfNz3EL0RC5lek/2o4iGMrr/Y2uuFtPCz8gBpQ4fgG6szNX188xUDwj8u9qljh bj0QcKGZbRlkrI30fiVJFRPTM9w1FEsHksTCw+ByV05LZXQorunqjA3NZScofNvLdqcw bGwFv7z/q6Y9ie+Rr4NWdFD2j//8alMHT8sYJsuSQEKI/8WKQclUh/Pc/hc6u/M5+4to C8e0kTfoyNT/PS59hck04UK/8wVvnmZ9j9w+5pjF2hkNRn5FER3CVcqzqpsVVTMaLhXh FPLw== 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=/5fBWGcV8KP0yYWYzeZW+deZNVZGvo9JuykELaazvaY=; b=rU32ToT7U1zQcNz0aeD70WoqthtCSFHUn4mEgXe+vbYcoRiwiJclyLAKWOBB/AdjJX RCC0nVUst6UPF+LocPPonck1o915hO5oCTZYoEyKW+iItSM59VH+7LeZxsMowk4AvFHX CjUAtEloDOmLTogdCQp2nyrJ+oPks72QjRyqy7OpYj/IC4b445tGS9bd3RbbaXWZhsqo KPhM2AKVugSVg5yw0k36V1kEcg6D55YMtnEKZVigFKLuPrAHjm7rO62hF71XU9iFrDo6 I0RtJG7jPC7FCnUBxdYSN4JG0IQ9b9Dp+fmUOSRk5v+wGMhE/x9mwH2Rtd2Zer+D+2EH 9rww== X-Gm-Message-State: ACrzQf1WR42gH9G3NZ7K4z0lY31RaH+d9P9Up/Lcimgx3Rb5wxFRd/R4 gc2GqxI488t3ZC0+goQryJznxXLj0kcRRA== X-Received: by 2002:a63:e14c:0:b0:439:2e24:e014 with SMTP id h12-20020a63e14c000000b004392e24e014mr2588822pgk.173.1665027867956; Wed, 05 Oct 2022 20:44:27 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:9ad0:4307:7d39:bb61]) by smtp.gmail.com with ESMTPSA id y6-20020a17090ad0c600b00205f4f7a3b3sm1905086pjw.21.2022.10.05.20.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 20:44:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org Subject: [PATCH 05/26] target/s390x: Change help_goto_direct to work on displacements Date: Wed, 5 Oct 2022 20:44:00 -0700 Message-Id: <20221006034421.1179141-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006034421.1179141-1-richard.henderson@linaro.org> References: <20221006034421.1179141-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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" In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- 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 f8cfddc181..b6e4005670 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1145,8 +1145,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; @@ -1169,7 +1171,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. */ @@ -1185,7 +1188,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 { @@ -1558,7 +1561,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)