From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsLoB-0003yP-DG for qemu-devel@nongnu.org; Mon, 28 Sep 2009 15:22:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsLoA-0003xC-1c for qemu-devel@nongnu.org; Mon, 28 Sep 2009 15:22:50 -0400 Received: from [199.232.76.173] (port=58803 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsLo9-0003x2-RQ for qemu-devel@nongnu.org; Mon, 28 Sep 2009 15:22:49 -0400 Received: from hall.aurel32.net ([88.191.82.174]:51108) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MsLo9-0006be-BF for qemu-devel@nongnu.org; Mon, 28 Sep 2009 15:22:49 -0400 Date: Mon, 28 Sep 2009 21:22:46 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [RFC] tcg: store constants without using registers when possible Message-ID: <20090928192246.GA6691@hall.aurel32.net> References: <20090928091208.GB22663@hall.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org On Mon, Sep 28, 2009 at 09:08:32PM +0300, Blue Swirl wrote: > On Mon, Sep 28, 2009 at 12:12 PM, Aurelien Jarno wrote: > > Currently only implemented for x86/x86_64. It may also be implemented > > for targets that keep one register for TCG internal use. > > Nice, but do you think the op will be used often? It is used each time a constant is written to a global TCG variable and written back to memory. A constant propagation patch like the ones Filip proposed a few months ago increase the number of those cases. > > --- a/tcg/sparc/tcg-target.c > > +++ b/tcg/sparc/tcg-target.c > > @@ -392,6 +392,15 @@ static inline void tcg_out_st(TCGContext *s, TCGType type, int arg, > >         tcg_out_ldst(s, arg, arg1, arg2, STX); > >  } > > > > +static inline int tcg_out_sti(TCGContext *s, TCGType type, tcg_target_long val, > > +                              int arg1, tcg_target_long arg2) > > +{ > > +    /* movl */ > > +    tcg_out_modrm_offset(s, 0xc7, 0, arg1, arg2); > > +    tcg_out32(s, val); > > +    return 1; > > +} > > + > > Sparc doesn't have store immediate ops, except for val == 0 case: > > static inline int tcg_out_sti(TCGContext *s, TCGType type, tcg_target_long val, > int arg1, tcg_target_long arg2) > { > if (val != 0) { > return 0; > } > /* clr/clrx */ > tcg_out_st(s, type, TCG_REG_G0, arg1, arg2); > return 1; > } > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net