qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation
Date: Fri, 7 Jan 2011 23:10:17 +0000

On 7 January 2011 22:42, Richard Henderson <address@hidden> 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.  On several hosts, this can be done natively, without
> 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 = (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]