From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37328 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdIzR-0005tm-LO for qemu-devel@nongnu.org; Thu, 13 Jan 2011 03:57:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdIz2-0003DJ-Jw for qemu-devel@nongnu.org; Thu, 13 Jan 2011 03:57:05 -0500 Received: from mail-ww0-f53.google.com ([74.125.82.53]:57984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdIz2-0003Cp-Fc for qemu-devel@nongnu.org; Thu, 13 Jan 2011 03:56:40 -0500 Received: by wwi18 with SMTP id 18so1432169wwi.10 for ; Thu, 13 Jan 2011 00:56:39 -0800 (PST) Date: Thu, 13 Jan 2011 09:56:35 +0100 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] tcg shift ops and magnitudes larger than register size Message-ID: <20110113085635.GA7296@edde.se.axis.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mike Frysinger Cc: qemu-devel@nongnu.org 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. > i have a 32bit register with the value of 0x1230002 and when i attempt > to do a sari with a value >=32, it gives me 0x918001 (a single shift > right has been done). i would have expected the value to be 0 (as > that is what my architecture does). 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. Cheers