On Fri, Jan 07, 2011 at 02:42:57PM -0800, Richard Henderson wrote: > Signed-off-by: Richard Henderson <r...@twiddle.net> > --- > 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