From: Richard Henderson <rth@twiddle.net>
To: Claudio Fontana <claudio.fontana@huawei.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Jani Kokkonen <Jani.Kokkonen@huawei.com>,
qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/4] tcg/aarch64: implement new TCG target for aarch64
Date: Fri, 24 May 2013 10:02:09 -0700 [thread overview]
Message-ID: <519F9D11.9020603@twiddle.net> (raw)
In-Reply-To: <519F2A8F.6090903@huawei.com>
On 05/24/2013 01:53 AM, Claudio Fontana wrote:
>> No real need to special case zero; it's just an extra test slowing down the
>> compiler.
>
> Yes, we need to handle the special case zero.
> Otherwise no instruction at all would be emitted for value 0.
Hmm, true. Although I'd been thinking more along the lines of
arranging the code such that we'd use movz to set the zero.
> I actually don't know whether to prefer ext=0 or ext=1,
> in the sense that it would be useful to know whether using the extended registers
> with a small constant is performance-wise preferable to using the 32bit operation,
> and relying on 0-extension. See also the rotation comment below.
>From the armv8 isa overview:
# Rationale: [...] By maintaining this semantic information in the instruction
# set, implementations can exploit this information to avoid expending energy
# or cycles to compute, forward and store the unused upper 32 bits of such
# data types. Implementations are free to exploit this freedom in whatever way
# they choose to save energy.
>> addr_reg almost certainly needs to be zero-extended for 32-bit guests, easily
>> done by setting ext = 0 here.
>
> I can easily put an #ifdef just to be sure.
No ifdef, just the TARGET_LONG_BITS == 64 comparison works.
>> You initialize FP, but you don't reserve the register, so it's going to get
>> clobbered. We don't actually use the frame pointer in the translated code, so
>> I don't think there's any call to actually initialize it either.
>
> The FP is not going to be clobbered, not by code here and not by called code.
>
> It is not going to be clobbered between our use before the jump and after the
> jump, because all the called functions need to preserve FP as mandated by the
> calling conventions.
>
> It is not going to be clobbered from the point of view of our caller,
> because we save (FP, LR) along with (X19, X20) .. (X27, X28) and restore them
> before returning.
Ah, well, I didn't see it mentioned here,
> + tcg_regset_clear(s->reserved_regs);
> + tcg_regset_set_reg(s->reserved_regs, TCG_REG_SP);
> + tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP);
> + tcg_regset_set_reg(s->reserved_regs, TCG_REG_X18); /* platform register */
but hadn't noticed that it's not listed in the reg_alloc_order.
> We use FP to point to the callee_saved registers, and to move to/from them
> in the tcg_out_store_pair and tcg_out_load_pair functions.
I hadn't noticed you'd hard-coded FP into the load/store_pair functions.
Let's *really* not do that. Even if we decide to continue using it, let's
pass it in explicitly.
But I don't see that you're really gaining anything in the prologue from
using FP instead of SP. It seems like a waste of a register to me.
r~
next prev parent reply other threads:[~2013-05-24 17:02 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 15:57 [Qemu-devel] QEMU aarch64 TCG target Claudio Fontana
2013-03-14 16:16 ` Peter Maydell
2013-05-06 12:56 ` [Qemu-devel] QEMU aarch64 TCG target - testing question about x86-64 Claudio Fontana
2013-05-06 13:27 ` Paolo Bonzini
2013-05-13 13:22 ` [Qemu-devel] [PATCH 0/3] ARM aarch64 TCG target Claudio Fontana
2013-05-13 13:28 ` [Qemu-devel] [PATCH 1/3] configure: permit compilation on arm aarch64 Claudio Fontana
2013-05-13 18:29 ` Peter Maydell
2013-05-14 8:19 ` Claudio Fontana
2013-05-13 13:31 ` [Qemu-devel] [PATCH 2/3] include/elf.h: add aarch64 ELF machine and relocs Claudio Fontana
2013-05-13 18:34 ` Peter Maydell
2013-05-14 8:24 ` Claudio Fontana
2013-05-13 13:33 ` [Qemu-devel] [PATCH 3/3] tcg/aarch64: implement new TCG target for aarch64 Claudio Fontana
2013-05-13 18:28 ` Peter Maydell
2013-05-14 12:01 ` Claudio Fontana
2013-05-14 12:25 ` Peter Maydell
2013-05-14 15:19 ` Richard Henderson
2013-05-16 14:39 ` Claudio Fontana
2013-05-14 12:41 ` Laurent Desnogues
2013-05-13 19:49 ` Richard Henderson
2013-05-14 14:05 ` Claudio Fontana
2013-05-14 15:16 ` Richard Henderson
2013-05-14 16:26 ` Richard Henderson
2013-05-06 13:42 ` [Qemu-devel] QEMU aarch64 TCG target - testing question about x86-64 Peter Maydell
2013-05-23 8:09 ` [Qemu-devel] [PATCH 0/4] ARM aarch64 TCG target VERSION 2 Claudio Fontana
2013-05-23 8:14 ` [Qemu-devel] [PATCH 1/4] include/elf.h: add aarch64 ELF machine and relocs Claudio Fontana
2013-05-23 13:18 ` Peter Maydell
2013-05-28 8:09 ` Laurent Desnogues
2013-05-23 8:18 ` [Qemu-devel] [PATCH 2/4] tcg/aarch64: implement new TCG target for aarch64 Claudio Fontana
2013-05-23 16:29 ` Richard Henderson
2013-05-24 8:53 ` Claudio Fontana
2013-05-24 17:02 ` Richard Henderson [this message]
2013-05-24 17:08 ` Peter Maydell
2013-05-24 17:17 ` Richard Henderson
2013-05-24 17:28 ` Peter Maydell
2013-05-24 17:54 ` Richard Henderson
2013-05-27 11:43 ` Claudio Fontana
2013-05-27 18:47 ` Richard Henderson
2013-05-27 21:14 ` [Qemu-devel] [PATCH 3/3] " Laurent Desnogues
2013-05-28 13:01 ` Claudio Fontana
2013-05-28 13:09 ` Laurent Desnogues
2013-05-28 7:17 ` [Qemu-devel] [PATCH 2/4] " Claudio Fontana
2013-05-28 14:52 ` Richard Henderson
2013-05-23 16:39 ` Peter Maydell
2013-05-24 8:51 ` Claudio Fontana
2013-05-27 9:10 ` Claudio Fontana
2013-05-27 10:40 ` Peter Maydell
2013-05-27 17:05 ` Richard Henderson
2013-05-27 9:47 ` Laurent Desnogues
2013-05-27 10:13 ` Claudio Fontana
2013-05-27 10:28 ` Laurent Desnogues
2013-05-28 13:14 ` Laurent Desnogues
2013-05-28 14:37 ` Claudio Fontana
2013-05-23 8:19 ` [Qemu-devel] [PATCH 3/4] configure: permit compilation on arm aarch64 Claudio Fontana
2013-05-23 13:24 ` Peter Maydell
2013-05-23 8:22 ` [Qemu-devel] [PATCH 4/4] tcg/aarch64: more ops in preparation of tlb lookup Claudio Fontana
2013-05-23 12:37 ` [Qemu-devel] [PATCH 0/4] ARM aarch64 TCG target VERSION 2 Andreas Färber
2013-05-23 12:50 ` Peter Maydell
2013-05-23 12:53 ` Andreas Färber
2013-05-23 13:03 ` Peter Maydell
2013-05-23 13:27 ` Claudio Fontana
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=519F9D11.9020603@twiddle.net \
--to=rth@twiddle.net \
--cc=Jani.Kokkonen@huawei.com \
--cc=claudio.fontana@huawei.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.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 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).