All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] load-store experiment...
@ 2009-11-11  7:51 Chad
  2009-11-11 15:41 ` Laurent Desnogues
  0 siblings, 1 reply; 3+ messages in thread
From: Chad @ 2009-11-11  7:51 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

(this is mostly to get some ideas going rather than trying to get anything
upstream... yet!)

This version of tcg_out_mov for i386's tcg-target.c filters out the

mov %ebx, %edx
mov %ebx, [some index]
mov %edx, %ebx

I don't have benchmarks, but it does remove a few mov's and qemu can still
load and run a linux kernel ;)

It'd be easier to do more optimizations if qemu recorded output at the
assembly instruction level.

---

static uint8_t *lmovloc = 0;
static int lmovret = -1, lmovarg = -1;
static inline void tcg_out_mov(TCGContext *s, int ret, int arg)
{
    int ldiff, nowrite = 0;

    if (arg != ret) {
        /* Check for a mov, mov->x, mov pattern */
        ldiff = s->code_ptr - lmovloc;
        if (((ldiff == 8) || (ldiff == 5)) &&
                   (*(lmovloc + 2) == 0x89) &&
                   ((lmovret == ret) && (lmovarg == arg))) nowrite = 1;
        /* Write */
        lmovloc = s->code_ptr;
        if (!nowrite) {
                tcg_out_modrm(s, 0x8b, ret, arg);
        } else {
                qemu_log("removed\n");
        }
        lmovret = arg; lmovarg = ret;
    }
}

[-- Attachment #2: Type: text/html, Size: 1286 bytes --]

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

* Re: [Qemu-devel] load-store experiment...
  2009-11-11  7:51 [Qemu-devel] load-store experiment Chad
@ 2009-11-11 15:41 ` Laurent Desnogues
  2009-11-12  6:01   ` Chad
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Desnogues @ 2009-11-11 15:41 UTC (permalink / raw)
  To: Chad; +Cc: qemu-devel

On Wed, Nov 11, 2009 at 8:51 AM, Chad <chad.page@gmail.com> wrote:
> (this is mostly to get some ideas going rather than trying to get anything
> upstream... yet!)
>
> This version of tcg_out_mov for i386's tcg-target.c filters out the
>
> mov %ebx, %edx
> mov %ebx, [some index]
> mov %edx, %ebx

The question is:  what TCG sequence produces this kind of code?


Laurent

> I don't have benchmarks, but it does remove a few mov's and qemu can still
> load and run a linux kernel ;)
>
> It'd be easier to do more optimizations if qemu recorded output at the
> assembly instruction level.
>
> ---
>
> static uint8_t *lmovloc = 0;
> static int lmovret = -1, lmovarg = -1;
> static inline void tcg_out_mov(TCGContext *s, int ret, int arg)
> {
>     int ldiff, nowrite = 0;
>
>     if (arg != ret) {
>         /* Check for a mov, mov->x, mov pattern */
>         ldiff = s->code_ptr - lmovloc;
>         if (((ldiff == 8) || (ldiff == 5)) &&
>                    (*(lmovloc + 2) == 0x89) &&
>                    ((lmovret == ret) && (lmovarg == arg))) nowrite = 1;
>         /* Write */
>         lmovloc = s->code_ptr;
>         if (!nowrite) {
>                 tcg_out_modrm(s, 0x8b, ret, arg);
>         } else {
>                 qemu_log("removed\n");
>         }
>         lmovret = arg; lmovarg = ret;
>     }
> }
>

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

* Re: [Qemu-devel] load-store experiment...
  2009-11-11 15:41 ` Laurent Desnogues
@ 2009-11-12  6:01   ` Chad
  0 siblings, 0 replies; 3+ messages in thread
From: Chad @ 2009-11-12  6:01 UTC (permalink / raw)
  To: Laurent Desnogues; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

On Wed, Nov 11, 2009 at 7:41 AM, Laurent Desnogues <
laurent.desnogues@gmail.com> wrote:

>
> > This version of tcg_out_mov for i386's tcg-target.c filters out the
> >
> > mov %ebx, %edx
> > mov %ebx, [some index]
> > mov %edx, %ebx
>
> The question is:  what TCG sequence produces this kind of code?
>
> I added register and instruction dumps - every case is related to
qemu_[ld/st], which makes sense since it's output is outside of tcg's
regular register tracking...

- Chad

[-- Attachment #2: Type: text/html, Size: 857 bytes --]

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

end of thread, other threads:[~2009-11-12  6:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-11  7:51 [Qemu-devel] load-store experiment Chad
2009-11-11 15:41 ` Laurent Desnogues
2009-11-12  6:01   ` Chad

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.