From: Paolo Bonzini <pbonzini@redhat.com>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>,
qemu-devel@nongnu.org, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH] target-mips: apply workaround for TCG optimizations for MFC1
Date: Wed, 15 Jul 2015 09:31:24 +0200 [thread overview]
Message-ID: <55A60C4C.3070406@redhat.com> (raw)
In-Reply-To: <20150714220938.GA11278@aurel32.net>
On 15/07/2015 00:09, Aurelien Jarno wrote:
>> > 2) 64-bit processors that have loads with 32-bit addresses.
>> >
>> > => qemu_ld/qemu_st can use 32-bit addresses to do the
>> > truncation
>> >
>> > aarch64, I think, falls under this group
> I don't think that works. We don't want to get a load with a 32-bit
> address. We want a load of (guest_base + address), with guest_base
> possibly being 64-bit, address being 32-bit and the result likely
> being 64-bit.
aarch64, IIUC, has complicated addressing modes with a 64-bit base and a
32-bit sign- or zero-extended index, which is exactly what you need
here. However, the backend is not using it, so right now aarch64 is the
same as x86.
> Well the use of ADDR32 is a bit special, it only works because we can't
> use %gs to add the guest base address. When we can't use %gs, ADDR32
> can't work.
Yes. bsd-user would have to sign extend, in particular.
> I don't think the register allocator is at fault at all. The register
> tcg_reg_alloc_mov doesn't check for the register type because a TCG mov
> is by definition only between registers of the same size.
Ok, I see your point. If you put it like this :) the fault definitely
lies in the backends. What I'm proposing would be in a new
tcg_reg_alloc_trunc function, and it would require implementing a
non-noop trunc.
I still believe the register allocator can be improved to do 32-bit
loads, though as an optimization and not as a bugfix:
> > Even if the prefix was added, modifying the register allocator to use
> > 32-bit loads would still be useful as an optimization, since on x86
> > 32-bit loads are smaller than 64-bit loads.
>
> AFAIK, that's already the case. The REXW prefix is only emitted for
> 64-bit ops.
Yes, but a load from a 64-bit register to a 32-bit destination emits
REX.W. From Leon's dump:
mov_i32 tmp1,w0.d0 => mov 0xe8(%r14),%rbp
mov_i32 tmp0,tmp1
mov_i32 t8,tmp0 => mov %ebp,0x60(%r14)
Note %rbp as the load destination and %ebp as the source of the store.
Paolo
next prev parent reply other threads:[~2015-07-15 7:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-14 16:38 [Qemu-devel] [PATCH] target-mips: apply workaround for TCG optimizations for MFC1 Leon Alrae
2015-07-14 17:09 ` Aurelien Jarno
2015-07-14 18:20 ` Paolo Bonzini
2015-07-14 18:37 ` Aurelien Jarno
2015-07-14 20:56 ` Paolo Bonzini
2015-07-14 22:09 ` Aurelien Jarno
2015-07-15 7:31 ` Paolo Bonzini [this message]
2015-07-15 8:06 ` Aurelien Jarno
2015-07-15 10:02 ` Richard Henderson
2015-07-15 10:14 ` Aurelien Jarno
2015-07-15 10:16 ` Aurelien Jarno
2015-07-15 11:31 ` Paolo Bonzini
2015-07-15 9:46 ` Richard Henderson
2015-07-15 9:59 ` Aurelien Jarno
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=55A60C4C.3070406@redhat.com \
--to=pbonzini@redhat.com \
--cc=aurelien@aurel32.net \
--cc=leon.alrae@imgtec.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).