From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38148 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbLRv-0002Tz-F9 for qemu-devel@nongnu.org; Fri, 07 Jan 2011 18:10:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbLRr-0000tV-8O for qemu-devel@nongnu.org; Fri, 07 Jan 2011 18:10:22 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:40136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbLRr-0000st-32 for qemu-devel@nongnu.org; Fri, 07 Jan 2011 18:10:19 -0500 Received: by wyg36 with SMTP id 36so19605638wyg.4 for ; Fri, 07 Jan 2011 15:10:17 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1294440183-885-1-git-send-email-rth@twiddle.net> References: <1294440183-885-1-git-send-email-rth@twiddle.net> Date: Fri, 7 Jan 2011 23:10:17 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 7 January 2011 22:42, Richard Henderson wrote: > Emulating i386 -- particularly in 16-bit mode -- requires quite a few > bitfield insert operations, to handle byte and word stores into the > dword registers. =C2=A0On several hosts, this can be done natively, witho= ut > resorting to a sequence of and and or instructions. +* 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 =3D (t1 & ~2) | ((t2 << 1) & 2) Unless I've missed something, deposit_i32 is basically the same as the ARM BFI instruction, so for ARM we could use deposit_i32 in the implementation of BFI (and conversely implement deposit_i32 using BFI when we're generating for an ARMv6T2 or better host.) -- PMM