From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493188102048565.6230969860393; Tue, 25 Apr 2017 23:28:22 -0700 (PDT) Received: from localhost ([::1]:52896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GR3-0004R9-1b for importer@patchew.org; Wed, 26 Apr 2017 02:28:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMT-0000ds-F5 for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMS-0000OG-48 for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:49951) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMN-0000JT-51; Wed, 26 Apr 2017 02:23:31 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9905321CBE; Wed, 26 Apr 2017 02:23:30 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:30 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D2237E43A; Wed, 26 Apr 2017 02:23:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=znh YymT2jwNXO2D7r87K+U4zrPFbSFp/JZ1A9bvCotM=; b=c1tId1mGfxrAe5rO/KD 3kFIRo/Qr5MXJzX72QNsqpJhunp2KwrfLYctY4Enp7XhN/XNK0g0SoOEPLxYftle GNX8ij33hnk6nnE1mSULEez0J4rqmbX7QW9p1vfPwiRkp+LwxCQVv1sFm0KSOdQe Jx9RynmSL5dwF9qYcVQhG1V0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=znhYymT2jwNXO2D7r87K+U4zrPFbSFp/JZ1A9bvCo tM=; b=q8dSz76fwBPYWFQGchP8aaZG1jjRzWOO2FkQIYC2dahx2B33yZ0MjToe5 WM8SHVdXKCkPUQgsn7Ox36iIRmivvA/b/kBSK9FDnylaVamuzkJIUn7Asns8n5i7 BJVAd6P6L2E1oUJYRMTeXeJe4ugixurO3d3JSofU+LNYw/ifoNvx83lhGF3d9tDh v+VD7snya9rOswXAKJwf/M1rCe/POxdYryL4+kCGLzIQ+iPoTcI3aLrckRvQWNr9 2ufPDMe7/YNuikUvAu6qdGVflYaBYsrXqzODFIqvUdRMivyhMH1eAAnL1FmDqzFK sZSQk2NutaJrm3WM3MM5aXNS3qe6Q== X-ME-Sender: X-Sasl-enc: Se0gEdV2ewrGP02Vx4YcbnkOWoRYLQKgCXwdP7MdiM1v 1493187810 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:14 -0400 Message-Id: <1493187803-4510-2-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 01/10] tcg-runtime: add lookup_tb_ptr helper 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This paves the way for upcoming work. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Benn=C3=A9e --- tcg-runtime.c | 21 +++++++++++++++++++++ tcg/tcg-runtime.h | 2 ++ tcg/tcg.h | 1 + 3 files changed, 24 insertions(+) diff --git a/tcg-runtime.c b/tcg-runtime.c index 4c60c96..90d2d4b 100644 --- a/tcg-runtime.c +++ b/tcg-runtime.c @@ -27,6 +27,7 @@ #include "exec/helper-proto.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" +#include "exec/tb-hash.h" =20 /* 32-bit helpers */ =20 @@ -141,6 +142,26 @@ uint64_t HELPER(ctpop_i64)(uint64_t arg) return ctpop64(arg); } =20 +void *HELPER(lookup_tb_ptr)(CPUArchState *env, target_ulong addr) +{ + CPUState *cpu =3D ENV_GET_CPU(env); + TranslationBlock *tb; + target_ulong cs_base, pc; + uint32_t flags; + + if (unlikely(atomic_read(&cpu->exit_request))) { + goto out_epilogue; + } + cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(addr)= ]); + if (likely(tb && tb->pc =3D=3D addr && tb->cs_base =3D=3D cs_base && + tb->flags =3D=3D flags)) { + return tb->tc_ptr; + } + out_epilogue: + return tcg_ctx.code_gen_epilogue; +} + void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(ENV_GET_CPU(env), GETPC()); diff --git a/tcg/tcg-runtime.h b/tcg/tcg-runtime.h index 114ea6f..c41d38a 100644 --- a/tcg/tcg-runtime.h +++ b/tcg/tcg-runtime.h @@ -24,6 +24,8 @@ DEF_HELPER_FLAGS_1(clrsb_i64, TCG_CALL_NO_RWG_SE, i64, i6= 4) DEF_HELPER_FLAGS_1(ctpop_i32, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i64) =20 +DEF_HELPER_FLAGS_2(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr, env, tl) + DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) =20 #ifdef CONFIG_SOFTMMU diff --git a/tcg/tcg.h b/tcg/tcg.h index 6c216bb..5ec48d1 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -699,6 +699,7 @@ struct TCGContext { extension that allows arithmetic on void*. */ int code_gen_max_blocks; void *code_gen_prologue; + void *code_gen_epilogue; void *code_gen_buffer; size_t code_gen_buffer_size; void *code_gen_ptr; --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493188208583124.81210371549184; Tue, 25 Apr 2017 23:30:08 -0700 (PDT) Received: from localhost ([::1]:52905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GSl-0005mI-HA for importer@patchew.org; Wed, 26 Apr 2017 02:30:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMU-0000eM-0s for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMS-0000PP-Hf for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:55477) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMN-0000JW-HA; Wed, 26 Apr 2017 02:23:31 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CCCE021C9D; Wed, 26 Apr 2017 02:23:30 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:30 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 881582469B; Wed, 26 Apr 2017 02:23:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=pKp S0yuDSSVlyo9EsBzA2VP7+IDzwZtAiCNNJZ78iCU=; b=xHmKK47ALDb18XjBscM p+HZZ6gPCBF5i7VkMJasULs1YAxNjn+tYQ7VJCB7Z0Rt05Jc3VXVV8JyVMm19KSo MxnNdo1AoDeFZTDRV9q9WrP3MxvgHXR2K5isz88MKoTUSoYZUW+fHEX1mzJaZnTv r4nIbWtR++iObWTEKnZ+xvmk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=pKpS0yuDSSVlyo9EsBzA2VP7+IDzwZtAiCNNJZ78i CU=; b=eweRhM8BCjYJ06gQz2rSR4xtcGgky65daY3CJlOEdCc3B247X4gMz+jfB 0bF4aL4N1qZixc94ii/ETOirYqF4v1XeDOVn+e+hRoqIQG2haUX2jpYjvJKkCJGP BmxU4xUoYQR4UddkwQNyFXuv2YnSzlkLOenzguLkS4bQiFSMBxYEFUB5/MZj3mnq tneNAKvbgRqPVyz5lYsGv9mRRFK8z6a2MjdEyVsi1rIUjwx6b+l7vLEzWLjH1aBp Uqf0jLuRbgswSTxrpu3TWHqklM/Y0vY/adTLooopQ7MQ3mwVCsg1kSr4yIjxXVEv Bf9AFzt4+aHuBel5i/C1gMf+Ywgtw== X-ME-Sender: X-Sasl-enc: Se0tF91jbA/YNE+V2YocbnkOWoRYLQKgCXwdP7MdiM1v 1493187810 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:15 -0400 Message-Id: <1493187803-4510-3-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 02/10] tcg: introduce goto_ptr opcode 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: 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: Emilio G. Cota Reviewed-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 1 + tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/ia64/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/s390/tcg-target.h | 1 + tcg/sparc/tcg-target.h | 1 + tcg/tcg-opc.h | 1 + tcg/tci/tcg-target.h | 1 + 10 files changed, 10 insertions(+) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 1a5ea23..b82eac4 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -77,6 +77,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 09a19c6..2f3ecfd 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -123,6 +123,7 @@ extern bool use_idiv_instructions; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_div_i32 use_idiv_instructions #define TCG_TARGET_HAS_rem_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 enum { TCG_AREG0 =3D TCG_REG_R6, diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 4275787..59d9835 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -107,6 +107,7 @@ extern bool have_popcnt; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 diff --git a/tcg/ia64/tcg-target.h b/tcg/ia64/tcg-target.h index 42aea03..901bb75 100644 --- a/tcg/ia64/tcg-target.h +++ b/tcg/ia64/tcg-target.h @@ -173,6 +173,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i64 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_deposit_i32_valid(ofs, len) ((len) <=3D 16) #define TCG_TARGET_deposit_i64_valid(ofs, len) ((len) <=3D 16) diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index f46d64a..e3240cf 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -130,6 +130,7 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_add2_i32 0 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index abd8b3d..a9aa974 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -82,6 +82,7 @@ extern bool have_isa_3_00; #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_add2_i32 0 diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index cbdd2a6..6b7bcfb 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -92,6 +92,7 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_div2_i64 1 #define TCG_TARGET_HAS_rot_i64 1 diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index b8b74f9..9348ddd 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -123,6 +123,7 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_extrl_i64_i32 1 #define TCG_TARGET_HAS_extrh_i64_i32 1 diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h index f06f894..c64b994 100644 --- a/tcg/tcg-opc.h +++ b/tcg/tcg-opc.h @@ -193,6 +193,7 @@ DEF(insn_start, 0, 0, TLADDR_ARGS * TARGET_INSN_START_W= ORDS, TCG_OPF_NOT_PRESENT) DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_END) DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_END) +DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_END) =20 DEF(qemu_ld_i32, 1, TLADDR_ARGS, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 838bf3a..0696328 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -85,6 +85,7 @@ #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493187971423215.31212062299858; Tue, 25 Apr 2017 23:26:11 -0700 (PDT) Received: from localhost ([::1]:52885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GOu-0002Qr-QT for importer@patchew.org; Wed, 26 Apr 2017 02:26:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMT-0000dv-IL for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMS-0000PJ-GX for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:44035) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMN-0000JZ-FO; Wed, 26 Apr 2017 02:23:31 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2D79821C9F; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:31 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id BD2A67E0A4; Wed, 26 Apr 2017 02:23:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=cqt 4P12yd8eMB0Cc/rCpxhrES6uXYFxJNF0pVOpZJPM=; b=pHisjKcvWn+t3OYLGmj c6HuyTC/nPIP59cQpLU/04MInudjWksAtccZNbk8hMm7H7Q3vIDz6nOxUHnGZHCr nV+c34/Gh/UIj1nBMUfqL8Rz6BWCi0cZ5C8qaWR26nitBjYnhiPd2rq4S0HWwkOO 64P7qjzWJmPFrSzpg59cUhdE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=cqt4P12yd8eMB0Cc/rCpxhrES6uXYFxJNF0pVOpZJ PM=; b=qFzFupocXj3GqAs2E1Wgm6EntaAJ3GzqCDaURgjiP29gYf37Uoos/n96/ +IQcstgt4mVxuMhjJ8xIL0z9QiTYf0x20++0UgvZpTMjQewoGbsb2l6DlCDJIYNJ Xmph1NyVX/jVYMEn1qe/gop5o1eVP82la0pFmaMs6Puq+UzrhOI4h8bN7fjGDJv5 Rl4BSRkkwQeuf2W82uLQiJQj0R3U+kmmajR82AMNjj3htuSJBRCzEZh8FN2jp1ZL d1c4gOn/5wi7tyTehYbd2EZ8SW9Dd97Gpvpvk20NiFvWxkfiXeIkefakfHYkayXk P7s4Uabzio08g8RQxMfk4aCByNomw== X-ME-Sender: X-Sasl-enc: Se0nGs1zfgbQMVqH2YMcbnkOWoRYLQKgCXwdP7MdiM1v 1493187810 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:16 -0400 Message-Id: <1493187803-4510-4-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 03/10] tcg: export 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of exporting goto_ptr directly to TCG frontends, export tcg_gen_lookup_and_goto_ptr(), which calls goto_ptr with the pointer returned by the lookup_tb_ptr() helper. This is the only use case we have for goto_ptr and lookup_tb_ptr, so having this function is very convenient. Furthermore, it trivially allows us to avoid calling the lookup helper if goto_ptr is not implemented by the backend. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- tcg/README | 8 ++++++++ tcg/tcg-op.c | 13 +++++++++++++ tcg/tcg-op.h | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/tcg/README b/tcg/README index a9858c2..bf49e82 100644 --- a/tcg/README +++ b/tcg/README @@ -477,6 +477,14 @@ current TB was linked to this TB. Otherwise execute th= e next instructions. Only indices 0 and 1 are valid and tcg_gen_goto_tb may be is= sued at most once with each slot index per TB. =20 +* lookup_and_goto_ptr tb_addr + +Look up a TB address ('tb_addr') and jump to it if valid. If not valid, +jump to the TCG epilogue to go back to the exec loop. + +This operation is optional. If the TCG backend does not implement the +goto_ptr opcode, emitting this op is equivalent to emitting exit_tb(0). + * qemu_ld_i32/i64 t0, t1, flags, memidx * qemu_st_i32/i64 t0, t1, flags, memidx =20 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 95a39b7..8ff1eaf 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2587,6 +2587,19 @@ void tcg_gen_goto_tb(unsigned idx) tcg_gen_op1i(INDEX_op_goto_tb, idx); } =20 +void tcg_gen_lookup_and_goto_ptr(TCGv addr) +{ + if (TCG_TARGET_HAS_goto_ptr) { + TCGv_ptr ptr =3D tcg_temp_new_ptr(); + + gen_helper_lookup_tb_ptr(ptr, tcg_ctx.tcg_env, addr); + tcg_gen_op1i(INDEX_op_goto_ptr, GET_TCGV_PTR(ptr)); + tcg_temp_free_ptr(ptr); + } else { + tcg_gen_exit_tb(0); + } +} + static inline TCGMemOp tcg_canonicalize_memop(TCGMemOp op, bool is64, bool= st) { /* Trigger the asserts within as early as possible. */ diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index c68e300..5d3278f 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -796,6 +796,17 @@ static inline void tcg_gen_exit_tb(uintptr_t val) */ void tcg_gen_goto_tb(unsigned idx); =20 +/** + * tcg_gen_lookup_and_goto_ptr() - look up a TB and jump to it if valid + * @addr: Guest address of the target TB + * + * If the TB is not valid, jump to the epilogue. + * + * This operation is optional. If the TCG backend does not implement goto_= ptr, + * this op is equivalent to calling tcg_gen_exit_tb() with 0 as the argume= nt. + */ +void tcg_gen_lookup_and_goto_ptr(TCGv addr); + #if TARGET_LONG_BITS =3D=3D 32 #define tcg_temp_new() tcg_temp_new_i32() #define tcg_global_reg_new tcg_global_reg_new_i32 --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493187968169756.5520983650418; Tue, 25 Apr 2017 23:26:08 -0700 (PDT) Received: from localhost ([::1]:52884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GOs-0002PD-Pi for importer@patchew.org; Wed, 26 Apr 2017 02:26:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMT-0000e6-MT for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMS-0000PB-Fz for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:35167) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMN-0000Jn-Ii; Wed, 26 Apr 2017 02:23:31 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4BC5121CBB; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:31 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 12AEE2469B; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=EWZ rYG7mC7qPXiCvjz63O26RuSAtS9/om+ve/xeprWo=; b=F+R60YvZrRufxglFZwZ aGzL/eKWgNuaXC4XV3oT4KGlsYUfw7KFBFWM8GsQ/IKUQW1Hh+N3Q0WsCSeJCTvZ VurBYw2kANfol0O2yjEIBiSvckJquFYfN23xhBL2SkiJTWZObvm341byLi/7qUoY ff2fdT4PAZ5b0Q8xF3X1BAY4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=EWZrYG7mC7qPXiCvjz63O26RuSAtS9/om+ve/xepr Wo=; b=Q3Ef+vkXYoM+g1HsouepMrAMzMm9uRGDp3mlgVSF1Z939QjTYUGs+Ao+6 QXduD6F5VSWhD4RLzL2JaH0xgfxDAAmPdSqEzRorWP+M0OfpMKtDHYblgKK9eSRt FFRL8osQfQ19HUZJDQ1zYC3Cpy0wPBGvqBxswzxqMirm9MgIav1OSancLhlnhNJJ 4B9jXN7B+hxsRNVKoP/L3vzeiXXHk+n9C1DwQdzJgTAN1Htha+iN9uh8ntcRYp9T rOJyf4O1dupSVv6FYcUhZVW9UQokqDlc5mZ+TYekOY1r08EmLBHhyf3rrxcVPl9w wp8WYcQaAh34Ib+jRw2YYNIks4Nmg== X-ME-Sender: X-Sasl-enc: TrZ+qsa97cSYr3ANx29dw7aYyJCDSOdJuuB+x2HTqFCJ 1493187811 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:17 -0400 Message-Id: <1493187803-4510-5-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 04/10] tcg/i386: implement goto_ptr op 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: 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: Emilio G. Cota Reviewed-by: Richard Henderson --- tcg/i386/tcg-target.h | 2 +- tcg/i386/tcg-target.inc.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 59d9835..73a15f7 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -107,7 +107,7 @@ extern bool have_popcnt; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 5918008..d0bf53a 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -1906,6 +1906,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpco= de opc, } s->tb_jmp_reset_offset[a0] =3D tcg_current_code_size(s); break; + case INDEX_op_goto_ptr: + /* jmp to the given host address (could be epilogue) */ + tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, a0); + break; case INDEX_op_br: tcg_out_jxx(s, JCC_JMP, arg_label(a0), 0); break; @@ -2277,6 +2281,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, =20 static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) { + static const TCGTargetOpDef r =3D { .args_ct_str =3D { "r" } }; static const TCGTargetOpDef ri_r =3D { .args_ct_str =3D { "ri", "r" } = }; static const TCGTargetOpDef re_r =3D { .args_ct_str =3D { "re", "r" } = }; static const TCGTargetOpDef qi_r =3D { .args_ct_str =3D { "qi", "r" } = }; @@ -2299,6 +2304,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpc= ode op) =3D { .args_ct_str =3D { "L", "L", "L", "L" } }; =20 switch (op) { + case INDEX_op_goto_ptr: + return &r; + case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: case INDEX_op_ld8s_i32: @@ -2567,6 +2575,13 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, tcg_target_call_iarg_regs[1]); #endif =20 + /* + * Return path for goto_ptr. Set return value to 0, a-la exit_tb, + * and fall through to the rest of the epilogue. + */ + s->code_gen_epilogue =3D s->code_ptr; + tcg_out_movi(s, TCG_TYPE_REG, TCG_REG_EAX, 0); + /* TB epilogue */ tb_ret_addr =3D s->code_ptr; =20 --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493188376072993.5160709359866; Tue, 25 Apr 2017 23:32:56 -0700 (PDT) Received: from localhost ([::1]:52921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GVT-0007tO-0d for importer@patchew.org; Wed, 26 Apr 2017 02:32:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMU-0000fg-Qt for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMT-0000Q6-Kq for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:38 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:42011) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMN-0000Jy-SG; Wed, 26 Apr 2017 02:23:31 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 75D3B21CD1; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:31 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 358BB7E320; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=I30 QR1pXFPanFJV5oHtvxtoNKLtMGRWno9wckulFwbE=; b=HZ7poXczArSfMyT2n14 EOo5AtsukAg4pWJwYM8W2L9e0M4rlp+XGrKiS9DQIwSfKT3TB+IFxS8OTZl9ZznX X6RhvuaCno4mvcS0AcS4VojBLHoX1x0DjwIJpPfpIeo1ymtM/BPa5KrUp7D3XQ1A S391mAZBZSgtAcks4QCk5Gok= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=I30QR1pXFPanFJV5oHtvxtoNKLtMGRWno9wckulFw bE=; b=dzgNBBS6331hrUscDfgO54X/o5bMwoMXjAdTGR/vPvztA+yL1soKT1mz7 Apf+8b1Ljrw8EG1S2vwwNJ48ze8W5P4hH0epqNKwYZsqBOfkYV71LCzwMTwR6yRP K14prKd026RKND1tyIEZDmGh38RIdSj+wzEU3mX4rKWqdiHEC9Cq8x0vv0S4aPcS F3vLzled2CbD9ZSgyIBfm+2yiX056+QH5nmu2t0gryffNWfj0jYASW8abjV254tX 46Q/M3/zCvhITdEdeQeu+iOJ/kyJ06BXy6LfiZxT0O1ZMuTIzzRWWwpudxMYW1Mm cYOjHHFkmLHJCfYGK1Aj9k6P6K2xw== X-ME-Sender: X-Sasl-enc: TrZ+tcSl4MWDuGwI3H1dw7aYyJCDSOdJuuB+x2HTqFCJ 1493187811 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:18 -0400 Message-Id: <1493187803-4510-6-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 05/10] target/arm: optimize cross-page direct jumps in softmmu 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of unconditionally exiting to the exec loop, use the lookup_and_goto_ptr helper to jump to the target if it is valid. Perf impact: see next commit's log. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/arm/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index e32e38c..02cad96 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4085,8 +4085,12 @@ static inline void gen_goto_tb(DisasContext *s, int = n, target_ulong dest) gen_set_pc_im(s, dest); tcg_gen_exit_tb((uintptr_t)s->tb + n); } else { + TCGv addr =3D tcg_temp_new(); + gen_set_pc_im(s, dest); - tcg_gen_exit_tb(0); + tcg_gen_extu_i32_tl(addr, cpu_R[15]); + tcg_gen_lookup_and_goto_ptr(addr); + tcg_temp_free(addr); } } =20 --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493188095015220.69419814418688; Tue, 25 Apr 2017 23:28:15 -0700 (PDT) Received: from localhost ([::1]:52894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GQv-0004LV-R4 for importer@patchew.org; Wed, 26 Apr 2017 02:28:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMT-0000e7-NA for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMS-0000P5-ET for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:42469) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMN-0000KF-U5; Wed, 26 Apr 2017 02:23:31 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A49D021B5E; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:31 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 61B2E2469B; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=HTp BlSlL5TZyfZs7+MQhmAvEDjDeaC+wTIDguSRj2sA=; b=mhxE/9Js0jaDGwW+0ea aDFgQBcWzbVZvhSq6UPP72QkC1F3pnMbdsSI65dW8XKVKKQtEbjopU4VnKwShFTA Q+fdOUlpUEj+4mmt983+HwRIFdTH6PoQJLHGi2ftsPPNZu1j8pcqbk1p4H1mHRJ/ B5d3hcuNT5N8YHZL3B2YFDhI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=HTpBlSlL5TZyfZs7+MQhmAvEDjDeaC+wTIDguSRj2 sA=; b=dCqRhHiEKpxhxlTPVH/RzmveJmtH31AmYHEQA5DnC9323myeZxh9OwnYW n/ObsRjz66ETF5n5rLrvP+9PI6v7oL/kcoom1zKlCZp22glCklKmmFHQ+O2t5eLo +PItcmaUoAf2jJ4pYPnoaZB7KdjysfRPFwmHiRdbWWIOCu43XO9zWCH+bwQ4qZ85 l/g0imi0WT2BQGkzl1cNrQJAnZYSGAaJNLbdbOdj/Uh2TPnzZ+AEE1PPmbzeun/8 IPX1xCJ/yMiW9OQ8GiIVYFG6P/gZrNuWVjZ1JB4ASKFqqsVkBBfyK3eLoF+HFZ+G KQasTcJbMuy7oztMSxg4+3AcGMgyg== X-ME-Sender: X-Sasl-enc: TrZ8uM6h9cGYsGUY12Vdw7aYyJCDSOdJuuB+x2HTqFCJ 1493187811 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:19 -0400 Message-Id: <1493187803-4510-7-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 06/10] target/arm: optimize indirect branches 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Speed up indirect branches by jumping to the target if it is valid. Softmmu measurements (see later commit for user-mode results): Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - Impact on Boot time | setup | ARM debian jessie boot+shutdown time | stddev | |--------+--------------------------------------+--------| | v2.9.0 | 8.84 | 0.07 | | +cross | 8.85 | 0.03 | | +jr | 8.83 | 0.06 | - NBench, arm-softmmu (debian jessie guest). Hos= t: Intel i7-4790K @ 4.00GHz 1.3x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | = | | cross #= ### | 1.25x +cross+jr..........................................................#= ++#.........................................+-+ | #### #= # | | +++# # #= # | | +++ **** # #= # | 1.2x +-+...................................####............*..*..#......#= ..#.........................................+-+ | **** # * * # #= # #### | | * * # * * # #= # # # | 1.15x +-+................................*..*..#............*..*..#......#= ..#.....#..#................................+-+ | * * # * * # #= # # # | | * * # #### * * # #= # # # | | * * # # # * * # #= # # # #### | 1.1x +-+................................*..*..#......#..#..*..*..#......#= ..#.....#..#.........................#..#...+-+ | * * # # # * * # #= # # # # # | | * * # # # * * # #= # # # # # | 1.05x +-+..........................####..*..*..#......#..#..*..*..#......#= ..#.....#..#......+++............*****..#...+-+ | ***** # * * # # # * * # *****= # # # +++ | ****### * * # | | *+++* # * * # # # * * # *+++*= # **** # *****### * * # * * # | | *****### +++#### * * # * * # ***** # * * # * *= # * * # * | *++# * * # * * # | 1x +-++-+*+++*-+#++****++#++*+-+*++#+-*++*++#-+*+++*-+#++*++*++#++*+-+*= ++#+-*++*++#-+*+++*-+#++*++*++#++*+-+*++#+-++-+ | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.95x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/eOLmZNR NB. 'cross' represents the previous commit. Signed-off-by: Emilio G. Cota --- target/arm/translate.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/arm/translate.c b/target/arm/translate.c index 02cad96..73595b4 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -65,6 +65,7 @@ static TCGv_i32 cpu_R[16]; TCGv_i32 cpu_CF, cpu_NF, cpu_VF, cpu_ZF; TCGv_i64 cpu_exclusive_addr; TCGv_i64 cpu_exclusive_val; +static bool gen_jr; =20 /* FIXME: These should be removed. */ static TCGv_i32 cpu_F0s, cpu_F1s; @@ -221,6 +222,7 @@ static void store_reg(DisasContext *s, int reg, TCGv_i3= 2 var) */ tcg_gen_andi_i32(var, var, s->thumb ? ~1 : ~3); s->is_jmp =3D DISAS_JUMP; + gen_jr =3D true; } tcg_gen_mov_i32(cpu_R[reg], var); tcg_temp_free_i32(var); @@ -893,6 +895,7 @@ static inline void gen_bx_im(DisasContext *s, uint32_t = addr) tcg_temp_free_i32(tmp); } tcg_gen_movi_i32(cpu_R[15], addr & ~1); + gen_jr =3D true; } =20 /* Set PC and Thumb state from var. var is marked as dead. */ @@ -902,6 +905,7 @@ static inline void gen_bx(DisasContext *s, TCGv_i32 var) tcg_gen_andi_i32(cpu_R[15], var, ~1); tcg_gen_andi_i32(var, var, 1); store_cpu_field(var, thumb); + gen_jr =3D true; } =20 /* Variant of store_reg which uses branch&exchange logic when storing @@ -12034,6 +12038,16 @@ void gen_intermediate_code(CPUARMState *env, Trans= lationBlock *tb) gen_set_pc_im(dc, dc->pc); /* fall through */ case DISAS_JUMP: + if (gen_jr) { + TCGv addr =3D tcg_temp_new(); + + gen_jr =3D false; + tcg_gen_extu_i32_tl(addr, cpu_R[15]); + tcg_gen_lookup_and_goto_ptr(addr); + tcg_temp_free(addr); + break; + } + /* fall through */ default: /* indicate that the hash table must be used to find the next = TB */ tcg_gen_exit_tb(0); --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493188099212621.4456820307798; Tue, 25 Apr 2017 23:28:19 -0700 (PDT) Received: from localhost ([::1]:52895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GQz-0004Ot-RJ for importer@patchew.org; Wed, 26 Apr 2017 02:28:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMT-0000eA-PQ for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMS-0000Oz-D6 for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:60045) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMO-0000KI-4C; Wed, 26 Apr 2017 02:23:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D5FEA21CBF; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:31 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 903507E0A4; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=R9X 3lAuvB9xwUxAWmrMmjFimkUEqhTrqz984HNSgbVs=; b=SVgGzcb67bFLYl6qiTa sIkKRKWLIAfELv6FxTZ81ujC3vwDK76stk+betJmJdJ9WeXyQCcCxwyWqDKDNeFb S+tYUn2et9+ngcHuhMXOWeGabU0kS08qECwsTDe6LXy3sx3xztNY4F5F7dE8MWTt 95ORu2QzEgdnYxULn2HE3p2Y= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=R9X3lAuvB9xwUxAWmrMmjFimkUEqhTrqz984HNSgb Vs=; b=AdKprwP6Kz3ssuzZdQ+Y983tB+4mmSfXDgOv4czpEW+5qFH0JGqeGDNwW YwAqT/naFqOHo2LqAFkSeMe+iglhkOr5RdJHEJprsl22RI7LDZVxgCgOM8GB1WaM o39LEmSv1GD2PEnrdz0zf33oznmB/mcf+9JF1UMnEK4USQo+SXcwR+XzG2BQ4New mjkStoMmdWLTNG27XiXOs2z8sLYJdUgilY1MHZDOYW4/jkZlETyjZff3O3VA/+OC JU2a+ks7QeLP8jfr7ttE66fp9WRbuuSMREYKUyrlOlIAU8sLF0S3zd2GEfU2Jyvh ZgcfQhOpJMbfxMoK+DgQwBsNYIXNA== X-ME-Sender: X-Sasl-enc: TrZ+rd65+MWConwM0Gldw7aYyJCDSOdJuuB+x2HTqFCJ 1493187811 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:20 -0400 Message-Id: <1493187803-4510-8-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 07/10] target/i386: introduce gen_jr helper to generate 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This helper will be used by subsequent changes. Signed-off-by: Emilio G. Cota --- target/i386/translate.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 1d1372f..59f6eaa 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -141,6 +141,7 @@ typedef struct DisasContext { } DisasContext; =20 static void gen_eob(DisasContext *s); +static void gen_jr(DisasContext *s, TCGv dest); static void gen_jmp(DisasContext *s, target_ulong eip); static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num); static void gen_op(DisasContext *s1, int op, TCGMemOp ot, int d); @@ -2509,7 +2510,8 @@ static void gen_bnd_jmp(DisasContext *s) If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. If RECHECK_TF, emit a rechecking helper for #DB, ignoring the state of S->TF. This is used by the syscall/sysret insns. */ -static void gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf) +static void +gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr) { gen_update_cc_op(s); =20 @@ -2530,6 +2532,13 @@ static void gen_eob_worker(DisasContext *s, bool inh= ibit, bool recheck_tf) tcg_gen_exit_tb(0); } else if (s->tf) { gen_helper_single_step(cpu_env); + } else if (jr) { + TCGv vaddr =3D tcg_temp_new(); + + tcg_gen_ld_tl(vaddr, cpu_env, offsetof(CPUX86State, segs[R_CS].bas= e)); + tcg_gen_add_tl(vaddr, vaddr, jr); + tcg_gen_lookup_and_goto_ptr(vaddr); + tcg_temp_free(vaddr); } else { tcg_gen_exit_tb(0); } @@ -2540,13 +2549,19 @@ static void gen_eob_worker(DisasContext *s, bool in= hibit, bool recheck_tf) If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. */ static void gen_eob_inhibit_irq(DisasContext *s, bool inhibit) { - gen_eob_worker(s, inhibit, false); + gen_eob_worker(s, inhibit, false, NULL); } =20 /* End of block, resetting the inhibit irq flag. */ static void gen_eob(DisasContext *s) { - gen_eob_worker(s, false, false); + gen_eob_worker(s, false, false, NULL); +} + +/* Jump to register */ +static void gen_jr(DisasContext *s, TCGv dest) +{ + gen_eob_worker(s, false, false, dest); } =20 /* generate a jump to eip. No segment change must happen before as a @@ -7131,7 +7146,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* TF handling for the syscall insn is different. The TF bit is c= hecked after the syscall insn completes. This allows #DB to not be generated after one has entered CPL0 if TF is set in FMASK. */ - gen_eob_worker(s, false, true); + gen_eob_worker(s, false, true, NULL); break; case 0x107: /* sysret */ if (!s->pe) { @@ -7146,7 +7161,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, checked after the sysret insn completes. This allows #DB to= be generated "as if" the syscall insn in userspace has just completed. */ - gen_eob_worker(s, false, true); + gen_eob_worker(s, false, true, NULL); } break; #endif --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493187965877684.9763068428135; Tue, 25 Apr 2017 23:26:05 -0700 (PDT) Received: from localhost ([::1]:52883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GOq-0002N5-NN for importer@patchew.org; Wed, 26 Apr 2017 02:26:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMT-0000dk-8n for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMR-0000Nh-QZ for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:43171) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMO-0000Kb-Az; Wed, 26 Apr 2017 02:23:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 075AF21CD6; Wed, 26 Apr 2017 02:23:32 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:32 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id BBE672469B; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=2dp ptLB1W1NDv1yVu4MCEKiQCYy2LkFN80wG8qbd2A0=; b=tJubQ8+MqlFaWfTQET5 0oExMfqUSVkczew+jbrvPgAD5meWXVetYafJuzz6iHf3Orj4/nt34t+L/GaDu8PJ tQrI2HQ9kJwqJK4f0BT2gVSBIKbIUuIsGY5MD6qH5JykCTUvOHCdGNJXAmnjcEDg Tou6xKPcW5otX/OR+LfLl/XQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=2dpptLB1W1NDv1yVu4MCEKiQCYy2LkFN80wG8qbd2 A0=; b=q5KATvrZvXdjkDEejkjJM3EAowGLirN3EAAV5tvQKgf4dl8I3cpnq8fWv jeF2UvOiQbWXOZZf2qLCrcpsjpVR7N9nUanRPXQaMmI4noORAgGorn524mqdVqKS pX7qLm1xAH5RDTTpRrur90RK1unUGfmFrBkv5cgYd6O6tbMKD5piTpO6e5OjknEW tdRqq8SlerfHhnIRprgNZj0c7+RD7/L/OofI9A8tXB828rrGGPAX7G6fHi8zYDCw D+CnIeB6BjAEOMtNkE2o5Ff9WqfLgtvNH+trk+1qj+X4m0Jm1+egX69tZjfZKK/g NrJbq1Q0VxL3jzKBAffyksITeuMUQ== X-ME-Sender: X-Sasl-enc: TrZ0t8ar9MuGpGkP3Wddw7aYyJCDSOdJuuB+x2HTqFCJ 1493187811 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:21 -0400 Message-Id: <1493187803-4510-9-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 08/10] target/i386: optimize cross-page direct jumps in softmmu 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of unconditionally exiting to the exec loop, use the gen_jr helper to jump to the target if it is valid. Perf impact: see next commit's log. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/i386/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 59f6eaa..a065271 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -2154,9 +2154,9 @@ static inline void gen_goto_tb(DisasContext *s, int t= b_num, target_ulong eip) gen_jmp_im(eip); tcg_gen_exit_tb((uintptr_t)s->tb + tb_num); } else { - /* jump to another page: currently not optimized */ + /* jump to another page */ gen_jmp_im(eip); - gen_eob(s); + gen_jr(s, cpu_tmp0); } } =20 --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493188315811225.87757284105157; Tue, 25 Apr 2017 23:31:55 -0700 (PDT) Received: from localhost ([::1]:52916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GUU-00071g-4L for importer@patchew.org; Wed, 26 Apr 2017 02:31:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMU-0000em-7M for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMS-0000Oq-Bj for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:38 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46587) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMO-0000Kv-HV; Wed, 26 Apr 2017 02:23:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4275821CCE; Wed, 26 Apr 2017 02:23:32 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:32 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id EB4BF7E0A4; Wed, 26 Apr 2017 02:23:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=15o sJEsGDnVzxhqZFHkOUQS7uBrU2al87S0YPknkkVM=; b=mzNkJp+FExFSZkUZL2Q 9Jf0v4xWd30rb2uIt/0EOwQq9+VIY1U+ZJW5hj3nbmfZNvWxf0EFULiUKS+rhbSJ TGCtVEV9veLrrlpk+knkPipP1OzNp6w2PB+5F0Nt02Qrnm5h0FLqTBfc4LjNeaZ+ Nb5hItvtLZhccO7Q4FGRZ1K0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=15osJEsGDnVzxhqZFHkOUQS7uBrU2al87S0YPknkk VM=; b=B8JXkCIpNe9x4TqSx6MBLW1HSmmTcv8kjAwcYKSQbJ4DGpOUmgBhm/XM2 fUSKfqsYKMoZSBaqyVcHhlyXYUh3eT7UGgF8/6+JxmejPEL6TikiavXL59wOCOvx CGYhYgRY6SSsS7RF2oqQ9qJBB0iqK/02wuyhDQJ0yIBcn75fimYsof6+Kh6mlvkG HDa43MWgo7FjdssFXdZbvh2QYN3JgzPk1J0R7er8a6BGWW9bLIgme4npbyyq7tcv RAVaqOi4p2nt7J3xyA2nseMruKqxeHJP1m1jdNGh+3ehbQ/ouNDbNTd0y8tZFlyH HHJqMw6o1NMoDGlG5fNzfGq9mfHZw== X-ME-Sender: X-Sasl-enc: TrZoq9ih4dSSs3gR1W5dw7aYyJCDSOdJuuB+x2HTqFCJ 1493187811 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:22 -0400 Message-Id: <1493187803-4510-10-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 09/10] target/i386: optimize indirect branches 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Speed up indirect branches by jumping to the target if it is valid. Softmmu measurements (see later commit for user-mode numbers): Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - SPECint06 (test set), x86_64-softmmu (Ubuntu 16.04 guest= ). Host: Intel i7-4790K @ 4.00GHz 2.4x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = | | cross = | 2.2x +cross+jr............................................................= ..............+++...........................+-+ | = | | | = +++ | | 2x +-+..................................................................= ............|..|............................+-+ | = | | | | = | | | 1.8x +-+..................................................................= ............|####...........................+-+ | = |# |# | | = **** |# | 1.6x +-+..................................................................= ..........*.|*.|#...........................+-+ | = * |* |# | | = * |* |# | 1.4x +-+..................................................................= .....+++..*.|*.|#...........................+-+ | ++++++ = #### * |*++# +++ | | +++ | | = #++# *++* # +++ | | 1.2x +-+......................###.....####....+++............|..|.........= ..****..#.*..*..#....####...|.###.....####..+-+ | +++ **** # **** # #### ***### = *++* # * * # #++# ****|# +++#++# | | ****### +++ *++* # *++* # ++# # #### *|* |# +++= * * # * * # *** # *| *|# **** # | 1x +-++-*++*++#++***###++*++*+#++*+-*++#+****++#++***++#+-*+*++#-+****##= ++*++*-+#+*++*-+#++*+*++#++*-+*+#++*++*++#-++-+ | * * # * * # * * # * * # * * # * * # *|* |# *++* #= * * # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # *+*++# * * #= * * # * * # * * # * * # * * # | 0.8x +-+--****###--***###--****##--****###-****###--***###--***###--****##= --****###-****###--***###--****##--****###--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/DU36YFU NB. 'cross' represents the previous commit. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/i386/translate.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index a065271..3bd80c0 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -4988,7 +4988,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_push_v(s, cpu_T1); gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 3: /* lcall Ev */ gen_op_ld_v(s, ot, cpu_T1, cpu_A0); @@ -5006,7 +5006,8 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, tcg_const_i32(dflag - 1), tcg_const_i32(s->pc - s->cs_base)); } - gen_eob(s); + tcg_gen_ld_tl(cpu_tmp4, cpu_env, offsetof(CPUX86State, eip)); + gen_jr(s, cpu_tmp4); break; case 4: /* jmp Ev */ if (dflag =3D=3D MO_16) { @@ -5014,7 +5015,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, } gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 5: /* ljmp Ev */ gen_op_ld_v(s, ot, cpu_T1, cpu_A0); @@ -5029,7 +5030,8 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_op_movl_seg_T0_vm(R_CS); gen_op_jmp_v(cpu_T1); } - gen_eob(s); + tcg_gen_ld_tl(cpu_tmp4, cpu_env, offsetof(CPUX86State, eip)); + gen_jr(s, cpu_tmp4); break; case 6: /* push Ev */ gen_push_v(s, cpu_T0); @@ -6409,7 +6411,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* Note that gen_pop_T0 uses a zero-extending load. */ gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 0xc3: /* ret */ ot =3D gen_pop_T0(s); @@ -6417,7 +6419,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* Note that gen_pop_T0 uses a zero-extending load. */ gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 0xca: /* lret im */ val =3D cpu_ldsw_code(env, s->pc); --=20 2.7.4 From nobody Thu May 2 08:28:00 2024 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.zoho.com; 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 1493188443853991.068471167796; Tue, 25 Apr 2017 23:34:03 -0700 (PDT) Received: from localhost ([::1]:52923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GWY-0008Pn-NK for importer@patchew.org; Wed, 26 Apr 2017 02:34:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3GMV-0000h8-Rs for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3GMT-0000Pp-Ca for qemu-devel@nongnu.org; Wed, 26 Apr 2017 02:23:39 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46705) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3GMO-0000LD-LX; Wed, 26 Apr 2017 02:23:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 67A4321B49; Wed, 26 Apr 2017 02:23:32 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 26 Apr 2017 02:23:32 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 267C82469B; Wed, 26 Apr 2017 02:23:32 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=FA+ e3Xv5AjO7YH2WX0VOsBB3hIAwoqYtkldFYtYp9nk=; b=afa0eokhX4S3N7prWwF 9YvVD3m4YvaF2/F7zK8IrBsI7JbDXc+75vJev7kcloVduIL5weZvjpg0LrDOWVtl q7BF+a4+jvcW64KXIb1iA9Fvks/Kj0GHLj9DTbC8ziKoPec8R6xTa17yvNpsyPfS /6cwiHJo46gYbItlKPrDpX/s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=FA+e3Xv5AjO7YH2WX0VOsBB3hIAwoqYtkldFYtYp9 nk=; b=fE6p0AfbU4vLHU5fdWHsWUFlbzCbvRNmayiBuE66e3cmVJwHpKQqP2IQI 74EKY5R3yOyFOtEaNWSn56WzD8RIsqN0ZYE6w/JAAPClaWGfn4YolFwLlJqUxB1Y zmx3pLzZ6WuXKwsTW0J5sm9ILe3ldPJEH1C25mVtj793zolY82BBllGA5/fUYVUY bF5FqszUD5NeqJhtFMq6+lI/7SHf/VObT3U93T41wxqan3fef2NskS6Tx6EEY0JJ o8qkvVCr0//lNZWVFofrTIoYIyXEljdapT2WQkJl/uz4YRNeqJR4qv8Vf9KwwLx7 BXxtwURq+APBpCnjhbZtJSkyByTdA== X-ME-Sender: X-Sasl-enc: Zd1KxaOa7TbcVsY6SE7Kpg6aFgUTn+iC/4o4p4QXtsOo 1493187812 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 26 Apr 2017 02:23:23 -0400 Message-Id: <1493187803-4510-11-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493187803-4510-1-git-send-email-cota@braap.org> References: <1493187803-4510-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v3 10/10] tb-hash: improve tb_jmp_cache hash function in user mode 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Optimizations to cross-page chaining and indirect branches make performance more sensitive to the hit rate of tb_jmp_cache. The constraint of reserving some bits for the page number lowers the achievable quality of the hashing function. However, user-mode does not have this requirement. Thus, with this change we use for user-mode a hashing function that is both faster and of better quality than the previous one. Measurements: Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - SPECint06 (test set), x86_64-linux-user. Host: = Intel i7-6700K @ 4.00GHz 2.2x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = | | jr = | 2x +jr+multhash +................................................= ....+++++...................................+-+ | jr+hash = |$$$ | | = |$+$ | | = ### $ | 1.8x +-+..................................................................= ....#|#.$...................................+-+ | = ++#+# $ | | = |# # $ | 1.6x +-+..................................................................= ..***.#.$....................++$$$..........+-+ | $$$ = *+* # $ |$+$ | | ++$$$ ### $ = * * # $ +++|$ $ | | ++###+$ # # $ = * * # $ ### ****## $ | 1.4x +-+...................***+#.$.........***.#.$........................= ..*.*.#.$...........#+#$$.*++*|#.$..........+-+ | *+* # $ * * # $ = * * # $ # # $ * *+# $ | | * * # $ +++++ * * # $ = * * # $ *** # $ * * # $ ###$$ | 1.2x +-+...................*.*.#.$.***##$$.*.*.#.$........................= ..*.*.#.$.........*.*.#.$.*..*.#.$.***+#+$..+-+ | * * # $ *+* # $ * * # $ +++ = * * # $ ++###$$ * * # $ * * # $ * * # $ | | ***##$$ * * # $ * * # $ * * # $ ***##$$ ++### = * * # $ *** #+$ * * # $ * * # $ * * # $ | | *+*+#+$ ***##$$$ * * # $ * * # $ * * # $ *+* # $ ++####$$ ***+# = * * # $ * * # $ * * # $ * * # $ * * # $ | 1x +-++-*+*+#+$+*+*+#-+$+*+*-#+$+*+*+#+$+*+*+#+$+*-*+#+$+***++#+$+*+*+#$= $+*+*+#+$+*+*+#+$+*+*-#+$+*+-*+#+$+*+*+#+$-++-+ | * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # = $ * * # $ * * # $ * * # $ * * # $ * * # $ | | * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # = $ * * # $ * * # $ * * # $ * * # $ * * # $ | 0.8x +-+--***##$$-***##$$$-***##$$-***##$$-***##$$-***##$$-***###$$-***##$= $-***##$$-***##$$-***##$$-****##$$-***##$$--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/4UXTrEc Here I also tried the hash function suggested by Paolo ("multhash"): return ((uint64_t) (pc * 2654435761) >> 32) & (TB_JMP_CACHE_SIZE - 1); As you can see it is just as good as the other new function ("hash"), which is what I ended up going with. - SPECint06 (train set), x86_64-linux-user. Host: = Intel i7-6700K @ 4.00GHz 2.6x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = | | jr = ### | 2.4x +jr+hash.............................................................= ..............................#.#...........+-+ | = # # | | = # # | 2.2x +-+..................................................................= ..............................#.#...........+-+ | = # # | | = # # | 2x +-+..................................................................= ..............................#.#...........+-+ | = **** # | | = * * # | 1.8x +-+..................................................................= ...........................*..*.#...........+-+ | = +++ * * # | | = #### #### * * # | 1.6x +-+......................................####........................= .....#..#.****..#..........*..*.#...........+-+ | +++ #++# = **** # * * # #### * * # | | ### # # = * * # * * # # # * * # | 1.4x +-+...................****+#..........****..#........................= ..*..*..#.*..*..#....#..#..*..*.#...........+-+ | *++* # * * # = * * # * * # *** # * * # #### | | * * # #### * * # = * * # * * # * * # * * # **** # | 1.2x +-+...................*..*.#..****++#.*..*..#........................= ..*..*..#.*..*..#..*.*..#..*..*.#..*..*..#..+-+ | ****### * * # * * # * * # = * * # * * # * * # * * # * * # | | * * # ***### * * # * * # * * # ****##= * * # * * # * * # * * # * * # | 1x +-+--****###--***###--****##--****###-****###--***###--***###--****##= --****###-****###--***###--****##--****###--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/ArCbHqo - NBench, x86_64-linux-user. Host: Intel= i7-6700K @ 4.00GHz 1.12x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | = | | jr += ++ | 1.1x +jr+hash...........................................................#= ###.........................................+-+ | +++#= | # | | | #= ++# | 1.08x +-+................................+++................+++.+++..*****= ..#.........................................+-+ | | +++ | | * | *= # | | | | | | *+++*= # | 1.06x +-+................................****###.............|...|...*...*= ..#.........................+++.............+-+ | *| * |# ****### * *= # | | | *| *++# *| * |# * *= # #### | 1.04x +-+................................*++*..#............*|.*.|#..*...*= ..#........................#.|#.............+-+ | * * # *++*++# * *= # +++#++# | | * * # * * # * *= # | # # +++#### | 1.02x +-+................................*..*..#......+++...*..*..#..*...*= ..#.....................****..#..*****++#...+-+ | +++ * * # +++ | * * # * *= # +++ *| * # *+++* # | | +++ | +++ +++ ++++++ * * # *****### * * # * *= # | +++ ++++++ *++* # * * # | 1x +-++-+++++####++****###++++-+####+-*++*++#-+*+++*-+#++*++*++#++*+-+*= ++#+-+++####-+*****###++*++*++#++*+-+*++#+-++-+ | *****| # *++* |# *****| # * * # * *++# * * # * *= # **** |# * * # * * # * * # | | * | *| # * *++# * | *++# * * # * * # * * # * *= # *| *++# * * # * * # * * # | 0.98x +-+...*.|.*++#..*..*..#..*+++*..#..*..*..#..*...*..#..*..*..#..*...*= ..#..*++*..#..*...*..#..*..*..#..*...*..#...+-+ | *+++* # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.96x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/ZXFX0hJ - NBench, arm-linux-user. Host: Intel i7-= 4790K @ 4.00GHz 1.3x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | #### = | | jr # # = +++ | 1.25x +jr+hash.....................#..#...................................= ........####................................+-+ | # # = # # | | # # = # # | 1.2x +-+..........................#..#...................................= ........#..#................................+-+ | # # = # # | | # # = # # | 1.15x +-+..........................#..#...................................= ........#..#................................+-+ | # # #= ### # # | | # # #= # # # | 1.1x +-+..........................#..#..................................#= ..#.....#..#................................+-+ | # # #= # # # +++ | | # # #### #= # # # #### | 1.05x +-+..........................#..#...............#..#.....####......#= ..#.....#..#.........................#..#...+-+ | # # # # # # #= # # # +++ # # | | +++ ***** # #### ***** # # # +++#= # **** # ****### # # | 1x +-++-+*****###++****+++++*+-+*++#+-****++#-+*+++*-+#+++++#++#++*****= ++#+-*++*++#-+*****-++++*++*++#++*****++#+-++-+ | * * # * * | * * # * * # * * # **** # * *= # * * # * *### * *++# * * # | | * * # * *### * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.95x +-+...*...*..#..*..*.|#..*...*..#..*..*..#..*...*..#..*..*..#..*...*= ..#..*..*..#..*...*..#..*..*..#..*...*..#...+-+ | * * # * * |# * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * |# * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.9x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/FfD27ey Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- include/exec/tb-hash.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h index 2c27490..b1fe2d0 100644 --- a/include/exec/tb-hash.h +++ b/include/exec/tb-hash.h @@ -22,6 +22,8 @@ =20 #include "exec/tb-hash-xx.h" =20 +#ifdef CONFIG_SOFTMMU + /* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for addresses on the same page. The top bits are the same. This allows TLB invalidation to quickly clear a subset of the hash table. */ @@ -45,6 +47,16 @@ static inline unsigned int tb_jmp_cache_hash_func(target= _ulong pc) | (tmp & TB_JMP_ADDR_MASK)); } =20 +#else + +/* In user-mode we can get better hashing because we do not have a TLB */ +static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) +{ + return (pc ^ (pc >> TB_JMP_CACHE_BITS)) & (TB_JMP_CACHE_SIZE - 1); +} + +#endif /* CONFIG_SOFTMMU */ + static inline uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t fl= ags) { --=20 2.7.4