From nobody Wed Nov 5 10:18:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499394891187530.1064450100873; Thu, 6 Jul 2017 19:34:51 -0700 (PDT) Received: from localhost ([::1]:54156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTJ6X-0003ZX-VM for importer@patchew.org; Thu, 06 Jul 2017 22:34:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTIxg-0004Ea-PH for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:25:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTIxg-0001jH-2T for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:25:40 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:34507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTIxf-0001j6-R7 for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:25:39 -0400 Received: by mail-qt0-x241.google.com with SMTP id m54so2718357qtb.1 for ; Thu, 06 Jul 2017 19:25:39 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id i85sm1407176qke.66.2017.07.06.19.25.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jul 2017 19:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=oQgSWlfb/A4jP/SrCT0DSoy/kNTz5ejPs1RH7YQBOG0=; b=BFNQxs7LkJ+hqpmBL+VjxdsSG9vG/931/QTBbrcYMjfVgktlhvOTy/9s/Opr848cX5 CJp4CF1xXGodM6IvRJxRv/mtXz+Xb4AXHpcPPKQTYBQzha0aXracOzl9OrkCf0SpNQ0v Fx8Jrwp79zz2ORaDaq4p/G4ZIPNhj6em6gyvb6LBhw0s31frVGjp/KMHoK8fJZhx/AV6 RJreCT+M9WiM8OA68vy4a/JbRmbFM0JJB7pOc6hIvlf/RcrL53D1Sp47DbkJTnnb19sy lJMEGCuGyAHksl+GqETNJ5O4DOhly23jPkbC67MOf/NR/Xw5V6/RXn3Kgo6/m3SC8kfL Cncg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=oQgSWlfb/A4jP/SrCT0DSoy/kNTz5ejPs1RH7YQBOG0=; b=nXlycjZA86YuLGFt5MRpImbPpMgPKo6PO5jQW3pNg6TXsflbXDsPIpJUAqNViF0kFT asIH3nP5ZUdhTTS4GDcxyF0rgpAFiLzf2I3dmSREudEbNh3MD0vCKskatODhvkGYJPnw mdeCmueatySqbzLIYamkyJDH+hkxLVwG4VOXs8OVHIxZOYj0HIDN3IifDAkUDlJOq2ft /in8LBFYys0Qi2NJeVrVPiz6eyzVC/q8yzbDNixMUZdVC37xSaLnlENTfh1Lij79tyMA ONKm9gt+IwnLDngfQzHMbuKPPve2NTWG63Fkbqz/8xfx7tSI8Jre7BCVxLSFXHKYG56l 3Wkg== X-Gm-Message-State: AIVw1110UlhCAyURZecpssd8QmftbrPM6mkn+JUKoZG+2xuz+qaiHWb1 0GexhuNDOGSVZeMExnQ= X-Received: by 10.237.60.80 with SMTP id u16mr40594087qte.100.1499394339185; Thu, 06 Jul 2017 19:25:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 6 Jul 2017 16:21:11 -1000 Message-Id: <20170707022111.21836-28-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170707022111.21836-1-rth@twiddle.net> References: <20170707022111.21836-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH v2 27/27] target/sh4: Use tcg_gen_lookup_and_goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bruno@clisp.org, laurent@vivier.eu, aurelien@aurel32.net, glaubitz@debian.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/sh4/translate.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 5fae872..7e80e10 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -235,12 +235,15 @@ static inline void gen_save_cpu_state(DisasContext *c= tx, bool save_pc) } } =20 +static inline bool use_exit_tb(DisasContext *ctx) +{ + return (ctx->tbflags & GUSA_EXCLUSIVE) !=3D 0; +} + static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest) { - if (unlikely(ctx->singlestep_enabled)) { - return false; - } - if (ctx->tbflags & GUSA_EXCLUSIVE) { + /* Use a direct jump if in same page and singlestep not enabled */ + if (unlikely(ctx->singlestep_enabled || use_exit_tb(ctx))) { return false; } #ifndef CONFIG_USER_ONLY @@ -253,28 +256,35 @@ static inline bool use_goto_tb(DisasContext *ctx, tar= get_ulong dest) static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) { if (use_goto_tb(ctx, dest)) { - /* Use a direct jump if in same page and singlestep not enabled */ tcg_gen_goto_tb(n); tcg_gen_movi_i32(cpu_pc, dest); tcg_gen_exit_tb((uintptr_t)ctx->tb + n); } else { tcg_gen_movi_i32(cpu_pc, dest); - if (ctx->singlestep_enabled) + if (ctx->singlestep_enabled) { gen_helper_debug(cpu_env); - tcg_gen_exit_tb(0); + } else if (use_exit_tb(ctx)) { + tcg_gen_exit_tb(0); + } else { + tcg_gen_lookup_and_goto_ptr(cpu_pc); + } } } =20 static void gen_jump(DisasContext * ctx) { - if (ctx->delayed_pc =3D=3D (uint32_t) - 1) { + if (ctx->delayed_pc =3D=3D -1) { /* Target is not statically known, it comes necessarily from a delayed jump as immediate jump are conditinal jumps */ tcg_gen_mov_i32(cpu_pc, cpu_delayed_pc); tcg_gen_discard_i32(cpu_delayed_pc); - if (ctx->singlestep_enabled) + if (ctx->singlestep_enabled) { gen_helper_debug(cpu_env); - tcg_gen_exit_tb(0); + } else if (use_exit_tb(ctx)) { + tcg_gen_exit_tb(0); + } else { + tcg_gen_lookup_and_goto_ptr(cpu_pc); + } } else { gen_goto_tb(ctx, 0, ctx->delayed_pc); } --=20 2.9.4