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

2011-01-20 Thread Edgar E. Iglesias
On Mon, Jan 10, 2011 at 07:23:41PM -0800, Richard Henderson wrote:
> Changes since v1:
>   * No attempt to pack pos+len into one operand.  Updated backends
> to match this change.
> 
>   * Example in the README is a bit more complex.
> 
>   * Define an official tcg_scratch_alloc routine, used by the i386
> target for the case in which we need a scratch register.  I had
> said that triggering this wasn't possible with mainline, but I
> was wrong.  The rlwimi example I posted in the other thread hits
> this case.
> 
> Aurelien suggested using a shorter name like "dep", but I think that
> would be more confusing than not.  This opcode is not really used
> enough to warrent cropping 4 characters, in my opinion.

Thanks Richard. In agreement with Aurelien I've applied patch 1 and 6
as a first step. I've also applied a follow-up patch to fix the
copy-pastos in the README (loc -> len).

Hopefully as more acks come in, we'll apply the rest.

Cheers



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

2011-01-11 Thread Aurelien Jarno
On Mon, Jan 10, 2011 at 07:23:41PM -0800, Richard Henderson wrote:
> Changes since v1:
>   * No attempt to pack pos+len into one operand.  Updated backends
> to match this change.
> 
>   * Example in the README is a bit more complex.
> 
>   * Define an official tcg_scratch_alloc routine, used by the i386
> target for the case in which we need a scratch register.  I had
> said that triggering this wasn't possible with mainline, but I
> was wrong.  The rlwimi example I posted in the other thread hits
> this case.
> 
> Aurelien suggested using a shorter name like "dep", but I think that
> would be more confusing than not.  This opcode is not really used
> enough to warrent cropping 4 characters, in my opinion.
> 

It was just a suggestion, I am also fine with "deposit".

The implementation of the deposit op (that is the first patch) looks 
fine to me, and I am convince this new op is useful. It's probably going
to be useful for the s390 target, that tried to solve the same problem 
with a sync op.

To go further, I think we should split the patch series into two (no
need to resend it), the op itself, and the implementation/usage in
various host/targets. The latter can go part by part, so the various
persons can review them separately. The whole series is still useful 
anyway to see the potential of such a new op.

Even if the code for the new op is quite simple, adding a new op has
some consequences (the main one being is that it's difficult to remove 
it latter), so I propose that it is reviewed/acked by a few persons
before being committed. People, please do that or send your comments.

-- 
Aurelien Jarno  GPG: 1024D/F1BCDB73
[email protected] http://www.aurel32.net



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

2011-01-07 Thread Richard Henderson
On 01/07/2011 03:10 PM, Peter Maydell wrote:
> 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.)

That's correct.

I'll admit to not knowing the arm/thumb variants very well.  While
I can see that gcc sometimes implements its similar "insv" operation
with BFC and BFI, knowing under what conditions those are available
is ... slightly complex to say the least.


r~



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

2011-01-07 Thread Peter Maydell
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.  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