From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCLic-0003TS-Cf for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:15:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCLib-0003Sq-N0 for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:15:13 -0500 Received: from [199.232.76.173] (port=41245 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCLib-0003Sl-Fw for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:15:13 -0500 Received: from hall.aurel32.net ([88.191.82.174]:57242) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCLib-0000wQ-52 for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:15:13 -0500 Date: Mon, 15 Dec 2008 23:15:11 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 02/42] target-ppc: add helper macros for later patches. Message-ID: <20081215221511.GF8523@volta.aurel32.net> References: <1229307315-16807-1-git-send-email-froydnj@codesourcery.com> <1229307315-16807-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: <1229307315-16807-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: Nathan Froyd Cc: qemu-devel@nongnu.org On Sun, Dec 14, 2008 at 06:14:35PM -0800, Nathan Froyd wrote: > > 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])) > + > +#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] = { While I have nothing against those macros, I know some code like that has already been rejected in the past. If someone disagrees with this code, please shout *now* before I apply it to the SVN. -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net