qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chad <chad.page@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] load-store experiment...
Date: Tue, 10 Nov 2009 23:51:18 -0800	[thread overview]
Message-ID: <f784f5260911102351g2353d8ddj70c2cc8f49890e9b@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2009-11-11  7:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  7:51 Chad [this message]
2009-11-11 15:41 ` [Qemu-devel] load-store experiment Laurent Desnogues
2009-11-12  6:01   ` Chad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f784f5260911102351g2353d8ddj70c2cc8f49890e9b@mail.gmail.com \
    --to=chad.page@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).