From patchwork Tue Sep 6 10:17:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 603033 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp4457461mae; Tue, 6 Sep 2022 04:59:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ntV0VkHVhTX2SUiyP9jauB/36vc8Qn2WsEOCRRlZM9+BC4mM13S7xkNhrfExTg6GlpXnE X-Received: by 2002:a05:6214:b66:b0:49d:6afb:6572 with SMTP id ey6-20020a0562140b6600b0049d6afb6572mr12220918qvb.78.1662465599540; Tue, 06 Sep 2022 04:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662465599; cv=none; d=google.com; s=arc-20160816; b=Z7KA8hcqHtF2njJvaid6ybbaWQdSaS3kVBUxOrtE/26MkAXEgHTQBB9sg8OhE7nFoV Y3dP166mtQ58PDpqgIZ3MqhQ/o2T84pfrAYaS+6p1E/NEjqDUQVQ6PgVxuy2D6hXCdF5 WMCWDmvchxMzs8RLymewfopOxklaTS6URFn3fP4nSCKNlgg8KjXDv/FeMqBDMPdmBgMD 2EsML81ddPQqgY/FVZlrGNrW2CcSG1HVBgabEd/yRWUv4v7c1IDwjf6e+fLkjKW6ELMY njK+GYAwtjHWNRIi7ebSNVr7Wyfvu2/j+cD+g58CbZbBRUv6+37RCeGzhyxdfz2wi9hj 2N6A== 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=Bbwp22d5AGWQeWSVLpDnhdg4mWtYLlB2ggSsBRzk5I8OrJFyWrgNacxCTiKzEY7zXl IRH6CT9bWkYdhXDxyc/RztirCLgkZf7r1wLYk3tf14IW8gJ/WZBBat3sNw3zCQmbnIRB kB/Tx9wtD9o9b5gQnG8Gkuyrf/tby+YOKhy1hTgJZEzX6WkjIWHVN28tDuMX+P/7ULPj 3RtyX1izfnVJD7LOgVR7P2axDliGomwqV/jFSJLVLCeQWt4DwyjFNQWSJWZWq0UAXCKy zr2JnM5ZStOh2vv1KkxgwUY6Mp6Lw/mTSj/x9/TbO0P7ZcR+eRVWtLA2GVNVYOZt4U1A NMBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v/WboH7n"; 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 o20-20020ac85554000000b003430481ae0bsi6353132qtr.72.2022.09.06.04.59.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Sep 2022 04:59:59 -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="v/WboH7n"; 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]:55804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVXFH-00063W-5o for patch@linaro.org; Tue, 06 Sep 2022 07:59:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVVeX-0003Fo-K9 for qemu-devel@nongnu.org; Tue, 06 Sep 2022 06:17:57 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVVeU-0005Bj-Nl for qemu-devel@nongnu.org; Tue, 06 Sep 2022 06:17:57 -0400 Received: by mail-wr1-x42b.google.com with SMTP id bq9so1787697wrb.4 for ; Tue, 06 Sep 2022 03:17:54 -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=v/WboH7nf7YgTog6IrOBVtOYE62pxS/CyMkZrAqDIbNgFuXqogDjumtOUJL//DLgY9 o9Ny1g1ie23aRIKcnHH1RgvhAJkG9NRQCx/cAfZ2T+w5m0iywroVlmTZp5ekTkU8dPhR QZUensN4+VyWG5YuGQu1n56VLpQMP9rC24x+871XlPZd0B5JdzM8nXQp1/pPjFP/jrgJ fUu3tQJBIru8kCUMTSJG0kYKpVUDMWWECH0rbgdpawlzIW3Ijymo/t0MnJcEMQ7HEEgr tLVTheVSHQNpf9NwY/O45d/Ok/C63yGI7peVRFMmM8nxJA2zMTk115wjAk5uBKdRuaZ8 k+DA== 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=7bHQpc3PhkvKh2h3xuhT0lbHxa+T3YnItRdG19fMv9dLY4QQiSb65Zwh+6uEPnNjCw 791nyr+AxkNe6YCU13XPVhVVKhmjmQHxucdsy6t66gxc+MoPcU/qvZHTS27ElUK5KWuN hvACo3qUem5yWs0bzYe5HOVnUFpYUDXy1wub7ibSV70WubGodM3n4vFS00hWs+AkBRQ8 IC/Qbl+AcJOMX4Wd/uYCVkBrbicgZGL+ZbwRGaVR7ZjzugxY1S7znt25V1AF/aAEtwXH ywLqvhXIh0aaYXqjjPqilFcLZngptVKHhCInExnZzd77GqWVVQdStEcotd47E5z1R/Hc 43kA== X-Gm-Message-State: ACgBeo2vtvKhNq5TNX/8lRRpEVDPSg7acEYUZvyg6CFamPSQWpDKN+bx X+UD9F+x1m/mX5kekRBDE+w9flFgv6Hpi1Kl X-Received: by 2002:a5d:4707:0:b0:226:f89a:ca3e with SMTP id y7-20020a5d4707000000b00226f89aca3emr13875130wrq.454.1662459473308; Tue, 06 Sep 2022 03:17:53 -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.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 03:17:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org Subject: [PATCH v1 05/26] target/s390x: Change help_goto_direct to work on displacements Date: Tue, 6 Sep 2022 11:17:26 +0100 Message-Id: <20220906101747.344559-6-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::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.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=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" In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. 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 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)