From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N1fcP-0000vu-7v for qemu-devel@nongnu.org; Sat, 24 Oct 2009 08:21:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N1fcK-0000tm-G8 for qemu-devel@nongnu.org; Sat, 24 Oct 2009 08:21:12 -0400 Received: from [199.232.76.173] (port=54434 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N1fcK-0000ti-CI for qemu-devel@nongnu.org; Sat, 24 Oct 2009 08:21:08 -0400 Received: from smtp.nokia.com ([192.100.105.134]:50622 helo=mgw-mx09.nokia.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N1fcJ-0004an-7s for qemu-devel@nongnu.org; Sat, 24 Oct 2009 08:21:07 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9OCJC9u008660 for ; Sat, 24 Oct 2009 07:21:05 -0500 Received: from localhost.localdomain (essapo-nirac252105.europe.nokia.com [10.162.252.105]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9OCJ8qE022164 for ; Sat, 24 Oct 2009 15:19:19 +0300 From: juha.riihimaki@nokia.com Date: Sat, 24 Oct 2009 15:19:07 +0300 Message-Id: <1256386749-85299-9-git-send-email-juha.riihimaki@nokia.com> In-Reply-To: <1256386749-85299-1-git-send-email-juha.riihimaki@nokia.com> References: <1256386749-85299-1-git-send-email-juha.riihimaki@nokia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 08/10] target-arm: optimize thumb push/pop ops List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Juha Riihim=C3=A4ki Thumb push/pop instructions can be slightly optimized by loading the register offset constant into a variable outside the register loop and using the preloaded variable inside the loop instead of reloading the offset value to a temporary variable on each loop iteration. This causes less TCG ops to be generated for a Thumb push/pop instruction if there are more than one register accessed, otherwise the amount of generated TCG ops is the same. Signed-off-by: Juha Riihim=C3=A4ki --- target-arm/translate.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target-arm/translate.c b/target-arm/translate.c index 353f638..f262758 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -8596,6 +8596,7 @@ static void disas_thumb_insn(CPUState *env, DisasCo= ntext *s) if ((insn & (1 << 11)) =3D=3D 0) { tcg_gen_addi_i32(addr, addr, -offset); } + tmp2 =3D tcg_const_i32(4); for (i =3D 0; i < 8; i++) { if (insn & (1 << i)) { if (insn & (1 << 11)) { @@ -8608,7 +8609,7 @@ static void disas_thumb_insn(CPUState *env, DisasCo= ntext *s) gen_st32(tmp, addr, IS_USER(s)); } /* advance to the next address. */ - tcg_gen_addi_i32(addr, addr, 4); + tcg_gen_add_i32(addr, addr, tmp2); } } TCGV_UNUSED(tmp); @@ -8623,8 +8624,9 @@ static void disas_thumb_insn(CPUState *env, DisasCo= ntext *s) tmp =3D load_reg(s, 14); gen_st32(tmp, addr, IS_USER(s)); } - tcg_gen_addi_i32(addr, addr, 4); + tcg_gen_add_i32(addr, addr, tmp2); } + tcg_temp_free_i32(tmp2); if ((insn & (1 << 11)) =3D=3D 0) { tcg_gen_addi_i32(addr, addr, -offset); } --=20 1.6.5