From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUR9A-000532-9t for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:41:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUR99-00052d-2H for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:41:23 -0500 Received: from [199.232.76.173] (port=33050 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUR98-00052a-UK for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:41:22 -0500 Received: from hall.aurel32.net ([88.191.82.174]:39454) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LUR98-00057d-Hk for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:41:22 -0500 Date: Tue, 3 Feb 2009 20:41:14 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 02/14] Add various NaN-handling macros Message-ID: <20090203194114.GA18984@volta.aurel32.net> References: <1232657054-30100-1-git-send-email-froydnj@codesourcery.com> <1232657054-30100-3-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-3-git-send-email-froydnj@codesourcery.com> 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:02PM -0800, Nathan Froyd wrote: > These simplify the implementation of the floating-point Altivec > instructions and reduce clutter. > > Signed-off-by: Nathan Froyd > --- > target-ppc/op_helper.c | 21 +++++++++++++++++++++ > 1 files changed, 21 insertions(+), 0 deletions(-) > > diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c > index d531dd8..9820040 100644 > --- a/target-ppc/op_helper.c > +++ b/target-ppc/op_helper.c > @@ -1965,6 +1965,23 @@ target_ulong helper_dlmzb (target_ulong high, target_ulong low, uint32_t update_ > for (index = ARRAY_SIZE(r->element)-1; index >= 0; index--) > #endif > > +/* If X is a NaN, store the corresponding QNaN into RESULT. Otherwise, > + * execute the following block. */ > +#define DO_HANDLE_NAN(result, x) \ > + if (float32_is_nan(x) || float32_is_signaling_nan(x)) { \ > + CPU_FloatU __f; \ > + __f.f = x; \ > + __f.l = __f.l | (1 << 22); /* Set QNaN bit. */ \ > + result = __f.f; \ > + } else > + > +#define HANDLE_NAN1(result, x) \ > + DO_HANDLE_NAN(result, x) > +#define HANDLE_NAN2(result, x, y) \ > + DO_HANDLE_NAN(result, x) DO_HANDLE_NAN(result, y) > +#define HANDLE_NAN3(result, x, y, z) \ > + DO_HANDLE_NAN(result, x) DO_HANDLE_NAN(result, y) DO_HANDLE_NAN(result, z) > + > /* Saturating arithmetic helpers. */ > #define SATCVT(from, to, from_type, to_type, min, max, use_min, use_max) \ > static always_inline to_type cvt##from##to (from_type x, int *sat) \ > @@ -2808,6 +2825,10 @@ VUPK(lsh, s32, s16, UPKLO) > #undef UPKHI > #undef UPKLO > > +#undef DO_HANDLE_NAN > +#undef HANDLE_NAN1 > +#undef HANDLE_NAN2 > +#undef HANDLE_NAN3 > #undef VECTOR_FOR_INORDER_I > #undef HI_IDX > #undef LO_IDX This is something already handled by the softfloat code. You should use set_default_nan_mode(1, &env->vec_status) to get this behavior. This could probably done directly in the init code. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net