From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54796 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PeDES-0008EL-AM for qemu-devel@nongnu.org; Sat, 15 Jan 2011 16:00:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PeDER-00035u-FF for qemu-devel@nongnu.org; Sat, 15 Jan 2011 16:00:20 -0500 Received: from mail-ew0-f45.google.com ([209.85.215.45]:46399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PeDER-00035q-7l for qemu-devel@nongnu.org; Sat, 15 Jan 2011 16:00:19 -0500 Received: by ewy10 with SMTP id 10so2171049ewy.4 for ; Sat, 15 Jan 2011 13:00:18 -0800 (PST) Date: Sat, 15 Jan 2011 22:00:14 +0100 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] tcg shift ops and magnitudes larger than register size Message-ID: <20110115210014.GC24889@laped.lan> References: <20110113085635.GA7296@edde.se.axis.com> <20110114232621.GA5779@zubnet.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110114232621.GA5779@zubnet.me.uk> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stuart Brady Cc: qemu-devel@nongnu.org On Fri, Jan 14, 2011 at 11:26:21PM +0000, Stuart Brady wrote: > On Thu, Jan 13, 2011 at 09:56:35AM +0100, Edgar E. Iglesias wrote: > > On Wed, Jan 12, 2011 at 08:13:45PM -0500, Mike Frysinger wrote: > > > are there any rules with the tcg sar/shl/shr ops and their magnitudes > > > ? such as "magnitudes cannot be larger than the register size" ? > > > > Yes, the result is undefined in those cases. > > The result is also undefined if the magnitude is *equal* to the width of > the variable. > > > You need to handle it in the translator. CRIS has similar semantics > > as your arch. See target-cris/translate.c:t_gen_lsl() for one way > > of doing it. There might be better ways though. > > How widely used would a set of optional shift ops be, where the magnitude > may be equal to (or exceed?) the width? My guess is that they wouldn't be used very much. But they might deserve a helper call that emits a good sequence of tcg calls to do the job. > Are there other helpers or op sequences that are commonly shared between > targets that would be candidates for splitting out into common code? I'm sure there are. You just have to find them :) > I know that a proliferation of ops is to be avoided -- the not, neg, > andc, orc, eqv, nand and nor ops have been useful though, despite not > being strictly essential, and the same could be said for the ext*s, ext*z > and bswap ops. There are many more that aren't "strictly essential". IMO, adding helpers that emit frequently used sequences of tcg calls is mostly good. Adding tcg ops that get exposed to the middle and backend is a different matter. Cheers