Received: from eggs.gnu.org ([2001:4830:134:3::10]:37648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDLkC-0001m7-IX for qemu-devel@nongnu.org; Sat, 03 Dec 2016 20:37:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDLkB-0005ax-RU for qemu-devel@nongnu.org; Sat, 03 Dec 2016 20:37:32 -0500 Sender: Richard Henderson References: <1480741206-32737-1-git-send-email-joserz@linux.vnet.ibm.com> <1480741206-32737-3-git-send-email-joserz@linux.vnet.ibm.com> From: Richard Henderson Message-ID: Date: Sat, 3 Dec 2016 17:37:27 -0800 MIME-Version: 1.0 In-Reply-To: <1480741206-32737-3-git-send-email-joserz@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/7] target-ppc: Implement unsigned quadword left/right shift and unit tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jose Ricardo Ziviani , qemu-ppc@nongnu.org Cc: bharata@linux.vnet.ibm.com, qemu-devel@nongnu.org, nikunj@linux.vnet.ibm.com, david@gibson.dropbear.id.au On 12/02/2016 09:00 PM, Jose Ricardo Ziviani wrote: > +++ b/include/qemu/host-utils.h > @@ -29,6 +29,33 @@ > #include "qemu/bswap.h" > > #ifdef CONFIG_INT128 > +static inline void urshift(uint64_t *plow, uint64_t *phigh, uint32_t shift) > +{ > + __uint128_t val = ((__uint128_t)*phigh << 64) | *plow; > + val >>= (shift & 127); > + *phigh = val >> 64; > + *plow = val & 0xffffffffffffffff; > +} > + > +static inline void ulshift(uint64_t *plow, uint64_t *phigh, > + uint32_t shift, bool *overflow) > +{ > + __uint128_t val = ((__uint128_t)*phigh << 64) | *plow; > + > + if (shift == 0) { > + return; > + } > + > + if (shift > 127 || (val >> (128 - (shift & 127))) != 0) { > + *overflow = true; > + } > + > + val <<= (shift & 127); > + > + *phigh = val >> 64; > + *plow = val & 0xffffffffffffffff; > +} > + This belongs in qemu/int128.h, not here. And certainly not predicated on CONFIG_INT128. r~