Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUiEt-0006gO-IP for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUiEs-0006ff-HF for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:26 -0500 Received: from [199.232.76.173] (port=45157 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUiEs-0006fO-4C for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:26 -0500 Received: from hall.aurel32.net ([88.191.82.174]:39272) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LUiEr-0001xK-HO for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:56:25 -0500 Date: Wed, 4 Feb 2009 14:56:24 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 13/14] Add vrefp instruction Message-ID: <20090204135624.GU25125@hall.aurel32.net> References: <1232657054-30100-1-git-send-email-froydnj@codesourcery.com> <1232657054-30100-14-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-14-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:13PM -0800, Nathan Froyd wrote: > > Signed-off-by: Nathan Froyd > --- > target-ppc/helper.h | 1 + > target-ppc/op_helper.c | 27 +++++++++++++++++++++++++++ > target-ppc/translate.c | 1 + > 3 files changed, 29 insertions(+), 0 deletions(-) > > diff --git a/target-ppc/helper.h b/target-ppc/helper.h > index a463787..516cee0 100644 > --- a/target-ppc/helper.h > +++ b/target-ppc/helper.h > @@ -244,6 +244,7 @@ DEF_HELPER_3(vaddfp, void, avr, avr, avr) > 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(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 e1022ab..8055e1a 100644 > --- a/target-ppc/op_helper.c > +++ b/target-ppc/op_helper.c > @@ -2696,6 +2696,33 @@ VPK(uwum, u32, u16, I, 0) > #undef VPK > #undef PKBIG > > +void helper_vrefp (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_infinity(b->f[i])) { > + if (float32_is_neg(b->f[i])) { > + r->f[i] = float32_chs(float32_zero); > + } else { > + r->f[i] = float32_zero; > + } > + } else 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 { All those cases should be already handled by the softfloat code. > + float32 one = int32_to_float32(1, &env->vec_status); I don't really like doing a live conversion each time the conversion is used. Please use the new float32_one instead. > + r->f[i] = float32_div(one, b->f[i], &env->vec_status); > + } > + } > + } > +} > + > #define VRFI(suffix, rounding) \ > void helper_vrfi##suffix (ppc_avr_t *r, ppc_avr_t *b) \ > { \ > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index 81011a2..01a4f11 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -6476,6 +6476,7 @@ GEN_VXFORM_NOA(vupklsb, 7, 10); > 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(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