From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N1kVb-0003CE-1h for qemu-devel@nongnu.org; Sat, 24 Oct 2009 13:34:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N1kVa-0003Bt-N2 for qemu-devel@nongnu.org; Sat, 24 Oct 2009 13:34:30 -0400 Received: from [199.232.76.173] (port=58377 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N1kVa-0003Bl-Cx for qemu-devel@nongnu.org; Sat, 24 Oct 2009 13:34:30 -0400 Received: from fg-out-1718.google.com ([72.14.220.153]:6716) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N1kVa-0007IL-0R for qemu-devel@nongnu.org; Sat, 24 Oct 2009 13:34:30 -0400 Received: by fg-out-1718.google.com with SMTP id d23so3786388fga.10 for ; Sat, 24 Oct 2009 10:34:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1256386749-85299-9-git-send-email-juha.riihimaki@nokia.com> References: <1256386749-85299-1-git-send-email-juha.riihimaki@nokia.com> <1256386749-85299-9-git-send-email-juha.riihimaki@nokia.com> Date: Sat, 24 Oct 2009 19:34:29 +0200 Message-ID: <761ea48b0910241034s4902b795y2bdc22cd03ced404@mail.gmail.com> Subject: Re: [Qemu-devel] [PATCH v2 08/10] target-arm: optimize thumb push/pop ops From: Laurent Desnogues Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: juha.riihimaki@nokia.com Cc: qemu-devel@nongnu.org On Sat, Oct 24, 2009 at 2:19 PM, wrote: > From: Juha Riihim=E4ki > > 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=E4ki Acked-by: Laurent Desnogues Laurent > --- > =A0target-arm/translate.c | =A0 =A06 ++++-- > =A01 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) > =A0 =A0 =A0 =A0 =A0 =A0 if ((insn & (1 << 11)) =3D=3D 0) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tcg_gen_addi_i32(addr, addr, -offset); > =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0tmp2 =3D tcg_const_i32(4); > =A0 =A0 =A0 =A0 =A0 =A0 for (i =3D 0; i < 8; i++) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (insn & (1 << i)) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (insn & (1 << 11)) { > @@ -8608,7 +8609,7 @@ static void disas_thumb_insn(CPUState *env, DisasCo= ntext *s) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gen_st32(tmp, addr, IS_US= ER(s)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* advance to the next address. = =A0*/ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tcg_gen_addi_i32(addr, addr, 4); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tcg_gen_add_i32(addr, addr, tmp2= ); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 TCGV_UNUSED(tmp); > @@ -8623,8 +8624,9 @@ static void disas_thumb_insn(CPUState *env, DisasCo= ntext *s) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmp =3D load_reg(s, 14); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gen_st32(tmp, addr, IS_USER(s)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tcg_gen_addi_i32(addr, addr, 4); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tcg_gen_add_i32(addr, addr, tmp2); > =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0tcg_temp_free_i32(tmp2); > =A0 =A0 =A0 =A0 =A0 =A0 if ((insn & (1 << 11)) =3D=3D 0) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tcg_gen_addi_i32(addr, addr, -offset); > =A0 =A0 =A0 =A0 =A0 =A0 } > -- > 1.6.5 > > > >