From nobody Mon Feb 9 18:19:09 2026 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 1493107145736580.8052680638551; Tue, 25 Apr 2017 00:59:05 -0700 (PDT) Received: from localhost ([::1]:47578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vNI-0003hr-DN for importer@patchew.org; Tue, 25 Apr 2017 03:59:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIq-0008Rc-AV for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000pL-Rs for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59993) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hR-ID; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4480F21E75; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E622D7E962; Tue, 25 Apr 2017 03:54:04 -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=V/Y rpO6/2k9TxnQVe3ZEh+k90S/i4+cXXfTugLLV4XE=; b=oPJJUYOCN1V5WeuzsDo UZGK0qlutyATOCeYJeDLU7Q5QGuJSLgjwVsHMnwd+gPVjy0reogr/6SjCv/XGexi 1U2OqGAYQKq1NN4/tQ8LMqC1IVRAyPSGmMoyDY4o1G465H3WePGuCorXH7et2ti9 G6YY5EtNb2gPfNNlq+7i+43c= 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=V/YrpO6/2k9TxnQVe3ZEh+k90S/i4+cXXfTugLLV4 XE=; b=nbWDKyZ/1aOEAhZZZF/xbxtxoNTbDp1LYkqYhZrJl5Ee+tYCxocVinHfx 3sYAN8Tkq+WtawHaoNIEC1rR1BiFPo4Xdo+YddgVoYHycR6AdkAgT8BnPKY7jNtY QHtDaY0Axsv2XRkcbpwUeLx3tD1IsasM93BMau2qx6fEA4SgwiSxfe2fnovxmeHg lcwQFjpaTSMvwWL/kSbT3Lq8TQXA+2pZrPpzG4/mJVFEL2ntWDgxLihyCuTWYvYw xkJrl1ckABUJaVRRPrXL7aU3q75Q3JDd8SrfpZRc1NC01RPymvi2Kj8pmLO+FC6x 532wDQkLOxRw+Utov1E8/xxQzgJUg== X-ME-Sender: X-Sasl-enc: McDudosGJtTogGV9zCdR3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:55 -0400 Message-Id: <1493106839-10438-10-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-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 v2 09/13] target/arm: optimize indirect branches with TCG's 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" Speed up indirect branches by directly jumping to the target if it is valid, i.e. if it is found in tb_jmp_cache. 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 boot+shutdown time | stddev | |---------------+-------------------------------+--------| | v2.9.0 | 10.35 | 0.07 | | +cross+inline | 10.32 | 0.03 | | +jr+inline | 10.59 | 0.20 | - NBench, arm-softmmu (debian jessie guest). Hos= t: Intel i7-4790K @ 4.00GHz 1.25x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | +++ = | | | cross+inline #### = | | 1.2x +cross+jr+inline.........................................#++#......#= ###.........................................+-+ | +++# # #= | # | | +++ +++ **** # #= | # +++ | | | #### * * # #= ++# | | 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/528aS76 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 574cf70..d5296b1 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_ptr ptr =3D tcg_temp_new_ptr(); + + gen_jr =3D false; + gen_helper_lookup_tb_ptr(ptr, cpu_env, cpu_R[15]); + tcg_gen_goto_ptr(ptr); + tcg_temp_free_ptr(ptr); + 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