All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Seward <jseward@acm.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] patch for qemu with newer gcc-3.4.x (support repz retq optimization for amd processors correctly)
Date: Thu, 10 Nov 2005 01:33:55 +0000	[thread overview]
Message-ID: <200511100133.55709.jseward@acm.org> (raw)
In-Reply-To: <4372532E.4090104@mail.ru>


The use of gcc to generate the back end in QEMU's early days was a 
clever way to get the project up and running quickly.  But surely
now it would be better to transition to a handwritten backend, so
as to be independent future changes in gcc, and generally more robust?

J

On Wednesday 09 November 2005 19:51, Igor Kovalenko wrote:
> Paul Brook wrote:
> >> Notice the 'repz mov' sequence, which seems to be undocumented
> >> instruction. It seems to work somehow but chokes valgrind decoder.
> >> The following patch (against current CVS) fixes this problem,
> >
> > This patch is incorrect.
> >
> > It could match any number of other instructions that happen to end in
> > 0xf3. eg
> >
> >    0:   c7 45 00 00 00 00 f3    movl   $0xf3000000,0x0(%ebp)
> >    7:   c3                      ret
> >
> > IIRC the "rep; ret" sequence is to avoid a pipeline stall on Athlon CPUs.
> >  Try tuning for a different CPU.
> >
> > Paul
> >
> >> Index: dyngen.c
> >> ===================================================================
> >> RCS file: /cvsroot/qemu/qemu/dyngen.c,v
> >> retrieving revision 1.40
> >> diff -u -r1.40 dyngen.c
> >> --- dyngen.c    27 Apr 2005 19:55:58 -0000      1.40
> >> +++ dyngen.c    9 Nov 2005 19:12:38 -0000
> >> @@ -1387,6 +1387,12 @@
> >>               error("empty code for %s", name);
> >>           if (p_end[-1] == 0xc3) {
> >>               len--;
> >> +            /* This can be 'rep ; ret' optimized return sequence,
> >> +             * need to check further and strip the 'rep' prefix
> >> +             */
> >> +            if (len != 0 && p_end[-2] == 0xf3) {
> >> +                len--;
> >> +            }
> >>           } else {
> >>               error("ret or jmp expected at the end of %s", name);
> >>           }
>
> OK I missed that...
> Then a discussion about gcc-4 turns into something much more interesting :)

  reply	other threads:[~2005-11-10  1:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09 19:17 [Qemu-devel] patch for qemu with newer gcc-3.4.x (support repz retq optimization for amd processors correctly) Igor Kovalenko
2005-11-09 19:45 ` Paul Brook
2005-11-09 19:51   ` Igor Kovalenko
2005-11-10  1:33     ` Julian Seward [this message]
2005-11-10  1:44       ` Jamie Lokier
2005-11-10  3:35         ` Jim C. Brown
2005-11-11  7:59         ` John R. Hogerhuis
2005-11-10  1:54       ` Jim C. Brown
2005-11-10 22:28   ` Igor Kovalenko

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=200511100133.55709.jseward@acm.org \
    --to=jseward@acm.org \
    --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 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.