From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60123 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbM3N-0003X8-Fw for qemu-devel@nongnu.org; Fri, 07 Jan 2011 18:49:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbM3M-0007Ub-2H for qemu-devel@nongnu.org; Fri, 07 Jan 2011 18:49:05 -0500 Received: from a.painless.aaisp.net.uk ([81.187.30.51]:41822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbM3L-0007UX-Rn for qemu-devel@nongnu.org; Fri, 07 Jan 2011 18:49:04 -0500 Date: Fri, 7 Jan 2011 23:48:56 +0000 From: Stuart Brady Subject: Re: [Qemu-devel] [PATCH 1/7] tcg: Define "deposit" as an optional operation. Message-ID: <20110107234856.GA20900@zubnet.me.uk> References: <1294440183-885-1-git-send-email-rth@twiddle.net> <1294440183-885-2-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1294440183-885-2-git-send-email-rth@twiddle.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, Aurelien Jarno , Alexander Graf On Fri, Jan 07, 2011 at 02:42:57PM -0800, Richard Henderson wrote: > Signed-off-by: Richard Henderson > --- > tcg/README | 14 ++++++++++++++ > tcg/tcg-op.h | 40 ++++++++++++++++++++++++++++++++++++++++ > tcg/tcg-opc.h | 6 ++++++ > tcg/tcg.c | 13 +++++++++++++ > 4 files changed, 73 insertions(+), 0 deletions(-) > > diff --git a/tcg/README b/tcg/README > index 68d27ff..ef59070 100644 > --- a/tcg/README > +++ b/tcg/README > @@ -285,6 +285,20 @@ the four high order bytes are set to zero. > Indicate that the value of t0 won't be used later. It is useful to > force dead code elimination. > > +* deposit_i32/i64 dest, t1, t2, loc > + > +Deposit T2 as a bitfield into T1, placing the result in DEST. > +The bitfield is described by LOC, an immediate value: > + > + bits 0:7 - the length of the bitfield > + bits 8:15 - the position of the first bit > + > +For example, 0x101 indicates a 1-bit field at bit 1. > +This operation would be equivalent to > + > + dest = (t1 & ~2) | ((t2 << 1) & 2) I'm being rather picky, but would something like this be better? :- For example, 0x804 indicates a 4-bit field starting from bit 8. This operation would be equivalent to: dest = (t1 & ~(0xf << 8)) | ((t2 << 8) & (0xf << 8)) OTOH, the code in your version was simpler... so maybe 0x201 or 0x102 as a compromise? I suppose it's unlikely that anyone's really going to need the example though, so I'm probably fussing too much. :-) Cheers, -- Stuart Brady