All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation, v2
@ 2011-01-11  3:23 Richard Henderson
  2011-01-11  3:23 ` [Qemu-devel] [PATCH 1/7] tcg: Define "deposit" as an optional operation Richard Henderson
                   ` (8 more replies)
  0 siblings, 9 replies; 41+ messages in thread
From: Richard Henderson @ 2011-01-11  3:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: agraf, aurelien

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.


r~


Richard Henderson (7):
  tcg: Define "deposit" as an optional operation.
  tcg-ppc: Implement deposit operation.
  tcg-hppa: Implement deposit operation.
  tcg-ia64: Implement deposit operation.
  tcg-i386: Implement deposit operation.
  target-i386: Use deposit operation.
  target-ppc: Use deposit operation.

 target-i386/translate.c |   34 +++-----------
 target-ppc/translate.c  |   10 ++++
 tcg/README              |   14 ++++++
 tcg/hppa/tcg-target.c   |   58 +++++++++++++++++++++---
 tcg/hppa/tcg-target.h   |    1 +
 tcg/i386/tcg-target.c   |   67 ++++++++++++++++++++++++++-
 tcg/i386/tcg-target.h   |    2 +
 tcg/ia64/tcg-target.c   |  115 +++++++++++++++++++++++++++++++++++++++++++++++
 tcg/ia64/tcg-target.h   |    2 +
 tcg/ppc/tcg-target.c    |   17 +++++++-
 tcg/ppc/tcg-target.h    |    1 +
 tcg/tcg-op.h            |   64 ++++++++++++++++++++++++++
 tcg/tcg-opc.h           |    6 +++
 tcg/tcg.c               |   11 +++++
 14 files changed, 364 insertions(+), 38 deletions(-)

-- 
1.7.2.3

^ permalink raw reply	[flat|nested] 41+ messages in thread
* [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation
@ 2011-01-07 22:42 Richard Henderson
  2011-01-07 22:43 ` [Qemu-devel] [PATCH 5/7] tcg-i386: Implement deposit operation Richard Henderson
  0 siblings, 1 reply; 41+ messages in thread
From: Richard Henderson @ 2011-01-07 22:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, Aurelien Jarno

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.  Even i386 as a
host can do better than the naive approach, and not merely for the set
that's implementable with byte/word stores.

Examples from i386-on-amd64:

0x4080d274:  movzbw -0x1335(%ebx),%ax

	before:
	0x60219f5d:  movzbl 0x0(%r13),%ebp
	0x60219f62:  movzwl %bp,%ebp
	0x60219f65:  mov    (%r14),%ebx
	0x60219f68:  and    $0xffff0000,%ebx
	0x60219f6e:  or     %ebp,%ebx

	after:
	0x6021aa5d:  movzbl 0x0(%r13),%ebp
	0x6021aa62:  mov    (%r14),%ebx
	0x6021aa65:  mov    %bp,%bx

	Note that we were able to use the word store.

0x4080e259:  mov    %dl,%dh

	before:
	0x6021d035:  mov    %ebp,%ebx
	0x6021d037:  movzbl %bl,%ebx
	0x6021d03a:  shl    $0x8,%ebx
	0x6021d03d:  and    $0xffff00ff,%ebp
	0x6021d043:  or     %ebx,%ebp

	after:
	0x6021da95:  mov    %ebp,%ebx
	0x6021da97:  ror    $0x8,%ebp
	0x6021da9a:  shrd   $0x8,%ebx,%ebp
	0x6021da9e:  rol    $0x10,%ebp

	Note that the replacement is 1 insn and 4 bytes shorter.

Counts as seen in -d in_asm:
			   byte    word
	i386/ls:	    240      28
	fedora 12 boot:	  30938	  11459
	freedos boot:	   6936	  74803

Examples from ppc-on-amd64

0x4080add0:  rlwimi  r0,r25,30,0,1

	before:
	0x6027d886:  mov    0x64(%r14),%ebx
	0x6027d88a:  mov    %ebx,%r12d
	0x6027d88d:  rol    $0x1e,%r12d
	0x6027d891:  and    $0xc0000000,%r12d
	0x6027d898:  mov    (%r14),%r13d
	0x6027d89b:  and    $0x3fffffff,%r13d
	0x6027d8a2:  or     %r13d,%r12d

	after:
	0x6027e186:  mov    (%r14),%ebx
	0x6027e189:  mov    0x64(%r14),%r12d
	0x6027e18d:  ror    $0x1e,%ebx
	0x6027e190:  shrd   $0x2,%r12d,%ebx

Counts as seen in -d in_asm:
		  rlwimi
	ppc/ls:	       9
	(no ppc kernel in qemu.org downloads?)



r~



Richard Henderson (7):
  tcg: Define "deposit" as an optional operation.
  tcg-ppc: Implement deposit operation.
  tcg-hppa: Implement deposit operation.
  tcg-ia64: Implement deposit operation.
  tcg-i386: Implement deposit operation.
  target-i386: Use deposit operation.
  target-ppc: Use deposit operation.

 target-i386/translate.c |   34 +++--------------
 target-ppc/translate.c  |   10 +++++
 tcg/README              |   14 +++++++
 tcg/hppa/tcg-target.c   |   58 ++++++++++++++++++++++++++---
 tcg/hppa/tcg-target.h   |    1 +
 tcg/i386/tcg-target.c   |   68 +++++++++++++++++++++++++++++++++--
 tcg/i386/tcg-target.h   |    2 +
 tcg/ia64/tcg-target.c   |   92 +++++++++++++++++++++++++++++++++++++++++++++++
 tcg/ia64/tcg-target.h   |    2 +
 tcg/ppc/tcg-target.c    |   17 ++++++++-
 tcg/ppc/tcg-target.h    |    1 +
 tcg/tcg-op.h            |   40 ++++++++++++++++++++
 tcg/tcg-opc.h           |    6 +++
 tcg/tcg.c               |   15 ++++++++
 14 files changed, 322 insertions(+), 38 deletions(-)

-- 
1.7.2.3

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2011-02-09 17:24 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11  3:23 [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation, v2 Richard Henderson
2011-01-11  3:23 ` [Qemu-devel] [PATCH 1/7] tcg: Define "deposit" as an optional operation Richard Henderson
2011-01-11 23:45   ` Aurelien Jarno
2011-01-12 11:00   ` Edgar E. Iglesias
2011-01-11  3:23 ` [Qemu-devel] [PATCH 2/7] tcg-ppc: Implement deposit operation Richard Henderson
2011-01-11 12:40   ` [Qemu-devel] " malc
2011-01-11 16:32     ` Richard Henderson
2011-01-11 19:11       ` malc
2011-01-11  3:23 ` [Qemu-devel] [PATCH 3/7] tcg-hppa: " Richard Henderson
2011-01-11  3:23 ` [Qemu-devel] [PATCH 4/7] tcg-ia64: " Richard Henderson
2011-01-11  3:23 ` [Qemu-devel] [PATCH 5/7] tcg-i386: " Richard Henderson
2011-01-25 12:27   ` Edgar E. Iglesias
2011-01-25 16:13     ` Richard Henderson
2011-01-25 16:48       ` Edgar E. Iglesias
2011-01-25 22:07         ` Richard Henderson
2011-01-26  8:53           ` Edgar E. Iglesias
2011-01-26  9:23             ` Alexander Graf
2011-01-26 15:50               ` Richard Henderson
2011-01-26 16:00                 ` Alexander Graf
2011-01-26 16:34                   ` Avi Kivity
2011-01-26 16:40                   ` Richard Henderson
2011-01-26 16:50                     ` Alexander Graf
2011-01-26 18:21                       ` Richard Henderson
2011-01-26 18:27                         ` Alexander Graf
2011-01-26 18:55                           ` Richard Henderson
2011-01-26 19:01                             ` Alexander Graf
2011-01-26 19:05                               ` Richard Henderson
2011-01-26 19:09                                 ` Alexander Graf
2011-01-26 19:19                                   ` Richard Henderson
2011-01-26 19:27                                     ` Alexander Graf
2011-01-31  8:33     ` Aurelien Jarno
2011-02-08 18:05       ` Richard Henderson
2011-02-09  7:41         ` [Qemu-devel] " Paolo Bonzini
2011-02-09 17:24           ` Blue Swirl
2011-01-11  3:23 ` [Qemu-devel] [PATCH 6/7] target-i386: Use " Richard Henderson
2011-01-12 11:01   ` Edgar E. Iglesias
2011-01-20 11:06   ` Aurelien Jarno
2011-01-11  3:23 ` [Qemu-devel] [PATCH 7/7] target-ppc: " Richard Henderson
2011-01-11 23:45 ` [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation, v2 Aurelien Jarno
2011-01-20 11:31 ` Edgar E. Iglesias
  -- strict thread matches above, loose matches on Subject: below --
2011-01-07 22:42 [Qemu-devel] [PATCH 0/7] Define "deposit" tcg operation Richard Henderson
2011-01-07 22:43 ` [Qemu-devel] [PATCH 5/7] tcg-i386: Implement deposit operation Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.