Received: from eggs.gnu.org ([140.186.70.92]:38693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA6wg-0008J7-Il for qemu-devel@nongnu.org; Wed, 13 Apr 2011 16:45:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QA6wf-0006Kt-It for qemu-devel@nongnu.org; Wed, 13 Apr 2011 16:45:50 -0400 Received: from hall.aurel32.net ([88.191.126.93]:46420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA6wf-0006Kj-E5 for qemu-devel@nongnu.org; Wed, 13 Apr 2011 16:45:49 -0400 Date: Wed, 13 Apr 2011 22:45:46 +0200 From: Aurelien Jarno Message-ID: <20110413204546.GO4551@volta.aurel32.net> References: <1302535928-15901-1-git-send-email-peter.maydell@linaro.org> <20110412213215.GA14070@volta.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] target-arm: Don't overflow when calculating value for signed VABAL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, patches@linaro.org On Tue, Apr 12, 2011 at 11:31:20PM +0100, Peter Maydell wrote: > On 12 April 2011 22:32, Aurelien Jarno wrote: > > On Mon, Apr 11, 2011 at 04:32:08PM +0100, Peter Maydell wrote: > > >> @@ -1524,12 +1528,12 @@ uint64_t HELPER(neon_abdl_u16)(uint32_t a, uint32_t b) > >>  { > >>      uint64_t tmp; > >>      uint64_t result; > >> -    DO_ABD(result, a, b, uint8_t); > >> -    DO_ABD(tmp, a >> 8, b >> 8, uint8_t); > >> +    DO_ABD(result, a, b, uint8_t, uint32_t); > >> +    DO_ABD(tmp, a >> 8, b >> 8, uint8_t, uint32_t); > >>      result |= tmp << 16; > >> -    DO_ABD(tmp, a >> 16, b >> 16, uint8_t); > >> +    DO_ABD(tmp, a >> 16, b >> 16, uint8_t, uint32_t); > >>      result |= tmp << 32; > >> -    DO_ABD(tmp, a >> 24, b >> 24, uint8_t); > >> +    DO_ABD(tmp, a >> 24, b >> 24, uint8_t, uint32_t); > >>      result |= tmp << 48; > >>      return result; > >>  } > > > > Do we really need a 32-bit type for the computation here? > > No, anything wider than 8 will do, but my guess was that in > practice 32 bits would be fractionally more efficient than > unnecessarily forcing 16 bit arithmetic. For that matter I > guess we could just say "int" and "unsigned int" since C > guarantees us at least 16 bits there. My guess was that in 2011 a compiler can optimize that itself if it is faster, and so it should be presented the size that is really needed. It turns to be the case on x86_64, but not on arm or ia64. I have therefore applied this patch as is. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net