qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Helge Deller <deller@gmx.de>, Laurent Vivier <laurent@vivier.eu>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH] target/hppa: Move iaoq registers and thus reduce generated code size
Date: Sun, 30 Jul 2023 10:50:50 -0700	[thread overview]
Message-ID: <8dcbe033-bf15-4df3-5042-5fbd3319ad22@linaro.org> (raw)
In-Reply-To: <ZMaQGwK1Ikj27ZPk@p100>

On 7/30/23 09:30, Helge Deller wrote:
> On hppa the Instruction Address Offset Queue (IAOQ) registers specifies
> the next to-be-executed instructions addresses. Each generated TB writes those
> registers at least once, so those registers are used heavily in generated
> code.
> 
> Looking at the generated assembly, for a x86-64 host this code
> to write the address $0x7ffe826f into iaoq_f is generated:
> 0x7f73e8000184:  c7 85 d4 01 00 00 6f 82  movl     $0x7ffe826f, 0x1d4(%rbp)
> 0x7f73e800018c:  fe 7f
> 0x7f73e800018e:  c7 85 d8 01 00 00 73 82  movl     $0x7ffe8273, 0x1d8(%rbp)
> 0x7f73e8000196:  fe 7f
> 
> With the trivial change, by moving the variables iaoq_f and iaoq_b to
> the top of struct CPUArchState, the offset to %rbp is reduced (from
> 0x1d4 to 0), which allows the x86-64 tcg to generate 3 bytes less of
> generated code per move instruction:
> 0x7fc1e800018c:  c7 45 00 6f 82 fe 7f     movl     $0x7ffe826f, (%rbp)
> 0x7fc1e8000193:  c7 45 04 73 82 fe 7f     movl     $0x7ffe8273, 4(%rbp)
> 
> Overall this is a reduction of generated code (not a reduction of
> number of instructions).
> A test run with checks the generated code size by running "/bin/ls"
> with qemu-user shows that the code size shrinks from 1616767 to 1569273
> bytes, which is ~97% of the former size.
> 
> Signed-off-by: Helge Deller<deller@gmx.de>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


  reply	other threads:[~2023-07-30 17:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-30 16:30 [PATCH] target/hppa: Move iaoq registers and thus reduce generated code size Helge Deller
2023-07-30 17:50 ` Richard Henderson [this message]
2023-07-31  9:55 ` Philippe Mathieu-Daudé

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=8dcbe033-bf15-4df3-5042-5fbd3319ad22@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=deller@gmx.de \
    --cc=laurent@vivier.eu \
    --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).