From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsKeh-0000Cw-HO for qemu-devel@nongnu.org; Mon, 28 Sep 2009 14:08:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsKec-00008x-Kj for qemu-devel@nongnu.org; Mon, 28 Sep 2009 14:08:59 -0400 Received: from [199.232.76.173] (port=43770 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsKec-00008o-ET for qemu-devel@nongnu.org; Mon, 28 Sep 2009 14:08:54 -0400 Received: from mail-bw0-f211.google.com ([209.85.218.211]:39818) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsKeb-0002ac-RY for qemu-devel@nongnu.org; Mon, 28 Sep 2009 14:08:54 -0400 Received: by bwz7 with SMTP id 7so487065bwz.34 for ; Mon, 28 Sep 2009 11:08:52 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20090928091208.GB22663@hall.aurel32.net> References: <20090928091208.GB22663@hall.aurel32.net> From: Blue Swirl Date: Mon, 28 Sep 2009 21:08:32 +0300 Message-ID: Subject: Re: [Qemu-devel] [RFC] tcg: store constants without using registers when possible Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: qemu-devel@nongnu.org On Mon, Sep 28, 2009 at 12:12 PM, Aurelien Jarno wro= te: > 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? > --- 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, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 tcg_out_ldst(s, arg, arg1, arg2, STX); > =C2=A0} > > +static inline int tcg_out_sti(TCGContext *s, TCGType type, tcg_target_lo= ng val, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int arg1, tcg_target_long arg2) > +{ > + =C2=A0 =C2=A0/* movl */ > + =C2=A0 =C2=A0tcg_out_modrm_offset(s, 0xc7, 0, arg1, arg2); > + =C2=A0 =C2=A0tcg_out32(s, val); > + =C2=A0 =C2=A0return 1; > +} > + Sparc doesn't have store immediate ops, except for val =3D=3D 0 case: static inline int tcg_out_sti(TCGContext *s, TCGType type, tcg_target_long = val, int arg1, tcg_target_long arg2) { if (val !=3D 0) { return 0; } /* clr/clrx */ tcg_out_st(s, type, TCG_REG_G0, arg1, arg2); return 1; }