Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCbo0-0001AJ-8O for qemu-devel@nongnu.org; Tue, 16 Dec 2008 10:25:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCbny-00019Q-NQ for qemu-devel@nongnu.org; Tue, 16 Dec 2008 10:25:51 -0500 Received: from [199.232.76.173] (port=38153 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCbny-00019K-FH for qemu-devel@nongnu.org; Tue, 16 Dec 2008 10:25:50 -0500 Received: from hall.aurel32.net ([88.191.82.174]:36221) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCbny-0003N4-3z for qemu-devel@nongnu.org; Tue, 16 Dec 2008 10:25:50 -0500 Message-ID: <4947C876.3080203@aurel32.net> Date: Tue, 16 Dec 2008 16:25:42 +0100 From: Aurelien Jarno MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 02/42] target-ppc: add helper macros for later patches. References: <1229307315-16807-1-git-send-email-froydnj@codesourcery.com> <1229307315-16807-3-git-send-email-froydnj@codesourcery.com> In-Reply-To: <1229307315-16807-3-git-send-email-froydnj@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nathan Froyd Cc: qemu-devel@nongnu.org Nathan Froyd a écrit : > Signed-off-by: Nathan Froyd > --- > target-ppc/op_helper.c | 33 +++++++++++++++++++++++++++++++++ > 1 files changed, 33 insertions(+), 0 deletions(-) > > diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c > index 2d665e8..c597632 100644 > --- a/target-ppc/op_helper.c > +++ b/target-ppc/op_helper.c > @@ -2007,6 +2007,39 @@ target_ulong helper_dlmzb (target_ulong high, target_ulong low, uint32_t update_ > } > > /*****************************************************************************/ > +/* Altivec extension helpers */ > +#if defined(WORDS_BIGENDIAN) > +#define HI_IDX 0 > +#define LO_IDX 1 > +#else > +#define HI_IDX 1 > +#define LO_IDX 0 > +#endif > + > +#define N_ELEMS(element) (sizeof (r->element) / sizeof (r->element[0])) Note that the ARRAY_SIZE macro from osdep.h does almost the same. > +#define VECTOR_FOR(element) \ > + int i; \ > + VECTOR_FOR_I(i, element) > + > +#define VECTOR_FOR_I(index, element) \ > + for (index = 0; index < N_ELEMS(element); index++) > + > +#if defined(WORDS_BIGENDIAN) > +#define VECTOR_FOR_INORDER_I(index, element) VECTOR_FOR_I(index, element) > +#else > +#define VECTOR_FOR_INORDER_I(index, element) \ > + for (index = N_ELEMS(element)-1; index >= 0; index--) > +#endif > + > +#undef VECTOR_FOR > +#undef VECTOR_FOR_I > +#undef VECTOR_FOR_INORDER_I > +#undef N_ELEMS > +#undef HI_IDX > +#undef LO_IDX > + > +/*****************************************************************************/ > /* SPE extension helpers */ > /* Use a table to make this quicker */ > static uint8_t hbrev[16] = { -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net