Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUiFA-0006qS-9d for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUiF9-0006ph-CB for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:43 -0500 Received: from [199.232.76.173] (port=45171 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUiF9-0006pZ-3N for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:43 -0500 Received: from hall.aurel32.net ([88.191.82.174]:39352) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LUiF8-0001zc-8o for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:42 -0500 Date: Wed, 4 Feb 2009 14:56:40 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 14/14] Add vrsqrtefp instruction Message-ID: <20090204135640.GV25125@hall.aurel32.net> References: <1232657054-30100-1-git-send-email-froydnj@codesourcery.com> <1232657054-30100-15-git-send-email-froydnj@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1232657054-30100-15-git-send-email-froydnj@codesourcery.com> Sender: Aurelien Jarno Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Nathan Froyd On Thu, Jan 22, 2009 at 12:44:14PM -0800, Nathan Froyd wrote: > > Signed-off-by: Nathan Froyd > --- > target-ppc/helper.h | 1 + > target-ppc/op_helper.c | 28 ++++++++++++++++++++++++++++ > target-ppc/translate.c | 1 + > 3 files changed, 30 insertions(+), 0 deletions(-) > > diff --git a/target-ppc/helper.h b/target-ppc/helper.h > index 516cee0..179f077 100644 > --- a/target-ppc/helper.h > +++ b/target-ppc/helper.h > @@ -245,6 +245,7 @@ DEF_HELPER_3(vsubfp, void, avr, avr, avr) > DEF_HELPER_3(vmaxfp, void, avr, avr, avr) > DEF_HELPER_3(vminfp, void, avr, avr, avr) > DEF_HELPER_2(vrefp, void, avr, avr) > +DEF_HELPER_2(vrsqrtefp, void, avr, avr) > DEF_HELPER_2(vrfim, void, avr, avr) > DEF_HELPER_2(vrfin, void, avr, avr) > DEF_HELPER_2(vrfip, void, avr, avr) > diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c > index 8055e1a..4ef0b1c 100644 > --- a/target-ppc/op_helper.c > +++ b/target-ppc/op_helper.c > @@ -2756,6 +2756,34 @@ VROTATE(h, u16) > VROTATE(w, u32) > #undef VROTATE > > +void helper_vrsqrtefp (ppc_avr_t *r, ppc_avr_t *b) > +{ > + int i; > + for (i = 0; i < ARRAY_SIZE(r->f); i++) { > + HANDLE_NAN1(r->f[i], b->f[i]) { > + if (float32_is_zero(b->f[i])) { > + if (float32_is_neg(b->f[i])) { > + /* Negative infinity */ > + r->u32[i] = 0xff800000; > + } else { > + /* Positive infinity */ > + r->u32[i] = 0x7f800000; > + } > + } else if (float32_is_neg(b->f[i])) { > + /* Canonical QNaN */ > + r->u32[i] = 0x7fc00000; > + } else if (float32_is_infinity(b->f[i])) { > + /* Negative infinity handled earlier */ > + r->f[i] = float32_zero; > + } else { > + float32 one = int32_to_float32(1, &env->vec_status); > + float32 t = float32_sqrt(b->f[i], &env->vec_status); > + r->f[i] = float32_div(one, t, &env->vec_status); The same comments as on the vrefp patch applies here. > + } > + } > + } > +} > + > void helper_vsel (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) > { > r->u64[0] = (a->u64[0] & ~c->u64[0]) | (b->u64[0] & c->u64[0]); > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index 01a4f11..1c44c59 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -6477,6 +6477,7 @@ GEN_VXFORM_NOA(vupklsh, 7, 11); > GEN_VXFORM_NOA(vupkhpx, 7, 13); > GEN_VXFORM_NOA(vupklpx, 7, 15); > GEN_VXFORM_NOA(vrefp, 5, 4); > +GEN_VXFORM_NOA(vrsqrtefp, 5, 5); > GEN_VXFORM_NOA(vrfim, 5, 8); > GEN_VXFORM_NOA(vrfin, 5, 9); > GEN_VXFORM_NOA(vrfip, 5, 10); > -- > 1.6.0.5 > > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net