From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvDIR-0007Yl-Qv for qemu-devel@nongnu.org; Fri, 26 Mar 2010 13:26:11 -0400 Received: from [140.186.70.92] (port=47889 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvDIP-0007VQ-Th for qemu-devel@nongnu.org; Fri, 26 Mar 2010 13:26:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvDIO-00019a-Fj for qemu-devel@nongnu.org; Fri, 26 Mar 2010 13:26:09 -0400 Received: from mx20.gnu.org ([199.232.41.8]:59440) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvDIO-00019W-Dx for qemu-devel@nongnu.org; Fri, 26 Mar 2010 13:26:08 -0400 Received: from mail.codesourcery.com ([38.113.113.100]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NvDIN-000260-DG for qemu-devel@nongnu.org; Fri, 26 Mar 2010 13:26:08 -0400 Date: Fri, 26 Mar 2010 10:26:05 -0700 From: Nathan Froyd Subject: Re: [Qemu-devel] [PATCH 38/48] target-arm: fix neon vrshl instruction Message-ID: <20100326172604.GF16726@codesourcery.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: Riku Voipio Cc: Riku Voipio , Juha =?iso-8859-1?Q?Riihim=E4ki?= , qemu-devel@nongnu.org On Fri, Mar 26, 2010 at 04:06:58PM +0000, Riku Voipio wrote: > +uint32_t HELPER(neon_rshl_u32)(uint32_t val, uint32_t shiftop) > +{ > + int8_t shift = (int8_t)shiftop; > + if (shift >= 32 || shift < -32) { > + val = 0; > + } else if (shift == -32) { > + val >>= shift - 1; ^^^^^^^^^^^^^^^^^ This looks wrong. Compare the equivalent case for 64-bit: > uint64_t HELPER(neon_rshl_u64)(uint64_t val, uint64_t shiftop) > } else if (shift == -64) { > /* Rounding a 1-bit result just preserves that bit. */ > val >>= 63; Bonus points for factoring out the duplicated 32/64-bit code. -Nathan