From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46322 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pp2Xu-0005sf-Uy for qemu-devel@nongnu.org; Mon, 14 Feb 2011 12:49:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pp2Xs-0000qk-Qr for qemu-devel@nongnu.org; Mon, 14 Feb 2011 12:49:09 -0500 Received: from mail-iw0-f173.google.com ([209.85.214.173]:33339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pp2Xs-0000qM-Hu for qemu-devel@nongnu.org; Mon, 14 Feb 2011 12:49:08 -0500 Received: by iwc10 with SMTP id 10so5490141iwc.4 for ; Mon, 14 Feb 2011 09:49:07 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1297437062-6118-1-git-send-email-christophe.lyon@st.com> <1297437062-6118-5-git-send-email-christophe.lyon@st.com> Date: Mon, 14 Feb 2011 17:49:07 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 4/6] target-arm: fix saturated values for Neon right shifts. From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: christophe.lyon@st.com Cc: qemu-devel@nongnu.org On 14 February 2011 17:46, Peter Maydell wrote: > On 11 February 2011 15:11, =C2=A0 wrote: >> =C2=A0NEON_VOP_ENV(qrshl_s8, neon_s8, 4) >> @@ -924,7 +924,11 @@ uint32_t HELPER(neon_qrshl_s32)(CPUState *env, uint= 32_t valop, uint32_t shiftop) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 dest =3D val << shift; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((dest >> shift) !=3D val) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SET_QC(); >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dest =3D (uint32_t)(1 << (siz= eof(val) * 8 - 1)) - (val > 0 ? 1 : 0); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (val < 0) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dest =3D INT32_= MIN; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dest =3D INT32_= MAX; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > Again, right answers but the way most of the rest of the code > forces a 32 bit value to signed saturation is > =C2=A0 dest =3D (val >> 31) ^ ~SIGNBIT; ...and also this is patching a function newly introduced in patch 1/6 -- better to just have 1/6 have the correct code. -- PMM