From patchwork Wed Jun 5 21:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 801651 Delivered-To: patch@linaro.org Received: by 2002:a5d:5610:0:b0:35b:5a80:51b4 with SMTP id l16csp48219wrv; Wed, 5 Jun 2024 14:58:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtk3oaGFw+OhQEp+xs5C0V8mRNYXi+ywPh4tJgBbDpxihpD8ZdJoGpL/m1DylSIzn0zMMpDvVDiM8gMheXxrhr X-Google-Smtp-Source: AGHT+IFfcDYKjta3gfaXykSiC4OzzwfKnfxyJTcDSqCC3yK1+FfiEnF2To4gz5RB2Bfi0QfEThNI X-Received: by 2002:a05:6870:65a0:b0:244:c312:4c84 with SMTP id 586e51a60fabf-251225d0706mr4454903fac.7.1717624716007; Wed, 05 Jun 2024 14:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717624715; cv=none; d=google.com; s=arc-20160816; b=SJNHrxLxedf/eHwyXV+6zoFDjJPomZ8FOXOD/nbldi8vg7kSIDC+un4KsjEfSJ1+2v Mka6cg/b7mOrI2LFJ7bNnZ0FPTicsDecQvapbK4P8EMx/mWq29G6mWbi0iNOyU1dVtmd 6MRYZyLALRTcpAjnjFvWMkU5eT7+52icgS7XMQf+LrBJd8pu29srUfL52mInudrbJmNW l+4qYOLYtsp6g8Tw95dMyETXewa4Hf73Zp+YWf35nyc1Nm5GlW8d9EniqG6jOOL+WbXq SnNoi3dLfdgL8g3c6Hl+26mbquKeArCCbWlxu+9nmYP3V04+vW6eFsamv5kYzeL2htsN ihvw== 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=R2yO0OdwYwim1ELk61/r9M0BgP3RevAymtCd4BW+mUg=; fh=NRM9GxiQu7lgoFWAiJmbRZwW47I3s36PXFnyEXFStLk=; b=Z5bZ7Wo4vtRNvb89pe0Xbg1SBZN7e8nXEQhYF2qf56sPdB3wy40lZ712vyQb2mqyhX kWQ2NTYJDTnzyHfmA3RQJQAFS8mO8kT7lCKkLp1SqgMrY83gTbROj1FMCfDRPNhtAJK6 W+ZiTn9I1IycylETBvZU2nq+sp+GjMVfTDuKu9LgvywCOczzX1ywOjk0k98Nscfm1hR/ jAL/5wORgcntswFnjZiKyHmpqNzRVEPvk1NMhn7HhQo+Ovq+qAHOfR+TO6+Zb0QNIyj6 LeU+HV4D1P9fUw8lpKJ3l2M1hoG8De/aDO8qlvfL1xtGj+dYU2JcyIUwYddacq3WwT6L Wmng==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C5sXjkJr; 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 af79cd13be357-79518c3ae7asi479298185a.307.2024.06.05.14.58.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2024 14:58:35 -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=C5sXjkJr; 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 1sEydf-0001hb-Au; Wed, 05 Jun 2024 17:57:47 -0400 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 1sEydd-0001gh-Sw for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:57:46 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEydb-0003pQ-8F for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:57:45 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-70257104b4dso253683b3a.1 for ; Wed, 05 Jun 2024 14:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717624662; x=1718229462; darn=nongnu.org; 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=R2yO0OdwYwim1ELk61/r9M0BgP3RevAymtCd4BW+mUg=; b=C5sXjkJrHcGgFk6Iy9VsTm/Rzk0ZOoOLfp/5lI4l/W7kD8W2gn3xgbqG0i9ikgICGY zyoa27+xf3ON8UAAquVUiZa4gPY+iinpd8CuTz3w8xoSKEZq4mXyUdit8ZSCVWpoQ+YR krhopU2TEZ/ejlfx9Dv7Qnfxxz0Wg0IyeWkmXDdRN0ysbUEywFRQFQvaS+1aGTZqxqzp Y3VApKcKJ8euT8vEnqkOo/FL8bDNYv3tLgkoScdlj+uyOtvgJPJjvpu1MD8mkEpWcAAS wdct4NjoREsPM5t01VpsgoWJn+47ug6ttvl87knbsG+SV7Ij+PGF0wULUuSmu5v9SlBL bosA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717624662; x=1718229462; 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=R2yO0OdwYwim1ELk61/r9M0BgP3RevAymtCd4BW+mUg=; b=nvKr7wY4F57gWuknqR2X+Y4K95T8CEJUlLwr87kYbo59jc+Jt/rIl3Awnq2lmWwfVO +X1X3jW4UzlBnekr7MXG6xqT/A213YkZOT2FKnn3ObrmkucWC4N5H/Ha/ushVy8tF1Xy jDYD1DydCllp8i2uMCjftyAG9N/yaV4GXuFQRnTY2H7Ki4OiZxwPqH77xzuUxyl6BQbT wh6btsMVG8HDN0oXf+e02vWmjSvqmsM+vR6M61aDjM1qwSXEeiUKWQiwUIyOSoqYZg72 MsEOe0okI79U+vXaa9oNA4jSg5Lqo/jFyh/dQ21uHPeb0ngxX0u8EAEI/6USYzf6CUR9 GW7g== X-Gm-Message-State: AOJu0YynYNSnYbX1MGBXGf68gLL2OuH+Rh1j5pb0buKY1zC0Y7FP+sVr 0uPFPAOYfZHW1Ludj0FJFYV6rBfCODaZjmHnVF4sE0a+dWUC1c/zOSFk2Upsv+4l4bj5wPrP5fP r X-Received: by 2002:a05:6a00:228e:b0:6f8:e3ed:d299 with SMTP id d2e1a72fcca58-703e59e799emr4495840b3a.27.1717624661643; Wed, 05 Jun 2024 14:57:41 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242b2ff9dsm9091509b3a.212.2024.06.05.14.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:57:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v2 01/10] target/s390x: Change help_goto_direct to work on displacements Date: Wed, 5 Jun 2024 14:57:30 -0700 Message-Id: <20240605215739.4758-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605215739.4758-1-richard.henderson@linaro.org> References: <20240605215739.4758-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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-bounces+patch=linaro.org@nongnu.org In preparation for CF_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 c81e035dea..f25ae02a4e 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1073,13 +1073,15 @@ 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; + update_cc_op(s); per_breaking_event(s); per_branch(s, tcg_constant_i64(dest)); - if (dest == s->pc_tmp) { + if (disp == s->ilen) { return DISAS_NEXT; } if (use_goto_tb(s, dest)) { @@ -1105,7 +1107,8 @@ static DisasJumpType help_goto_indirect(DisasContext *s, TCGv_i64 dest) static DisasJumpType help_branch(DisasContext *s, DisasCompare *c, bool is_imm, int imm, TCGv_i64 cdest) { - 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. */ @@ -1120,7 +1123,7 @@ static DisasJumpType help_branch(DisasContext *s, DisasCompare *c, if (c->cond == TCG_COND_ALWAYS || (dest == s->pc_tmp && !(s->base.tb->flags & FLAG_MASK_PER_BRANCH))) { - return help_goto_direct(s, dest); + return help_goto_direct(s, disp); } } else { if (!cdest) {