From: Aurelien Jarno <aurelien@aurel32.net>
To: Richard Henderson <rth@twiddle.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Leon Alrae <leon.alrae@imgtec.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target-mips: apply workaround for TCG optimizations for MFC1
Date: Wed, 15 Jul 2015 12:14:47 +0200 [thread overview]
Message-ID: <20150715101447.GD20210@aurel32.net> (raw)
In-Reply-To: <55A62FAE.7030806@twiddle.net>
On 2015-07-15 11:02, Richard Henderson wrote:
> On 07/15/2015 09:06 AM, Aurelien Jarno wrote:
> >On 2015-07-15 09:31, Paolo Bonzini wrote:
> >>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.
> >
> >Why not reusing the existing trunc_shr_i64_i32 op? AFAIU, it has been
> >designed exactly for that.
>
> Indeed.
>
> >Actually I think we should implement the following ops as optional but
> >*real* TCG ops:
> >- trunc_shr_i64_i32
> >- extu_i32_i64
> >- ext_i32_i64
>
> While we could perhaps gain something from the last two, reliably using the
> first is probably the most important.
>
> I've been unable to reproduce the binary in question. I'm curious if
> something as simple as this helps. Alternately, the two hunks might just
> cancel each other out and result in no change.
No, besides that tcg_assert doesn't exist, it doesn't work, as it is
later optimized out. What I meant is to implement trunc_shr_i64_i32 in
the x86 backend, either as a 32-bit zero extension when count is 0, or a
64-bit shift zero extended otherwise.
I think for 2.4 we should go with the ADDR32 way, using the following
kind of patch. It works when %gs is in use, but has to be extended when
it's not in use. The idea is that qemu_ld/st should behave like other
32-bit ops, that is ignore the high part of the register.
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index ff4d9cf..e139c44 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -1572,6 +1572,9 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64)
if (GUEST_BASE && guest_base_flags) {
seg = guest_base_flags;
offset = 0;
+ if (TARGET_LONG_BITS == 32) {
+ seg = P_ADDR32;
+ }
} else if (TCG_TARGET_REG_BITS == 64 && offset != GUEST_BASE) {
tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_L1, GUEST_BASE);
tgen_arithr(s, ARITH_ADD + P_REXW, TCG_REG_L1, base);
@@ -1705,6 +1708,9 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64)
if (GUEST_BASE && guest_base_flags) {
seg = guest_base_flags;
offset = 0;
+ if (TARGET_LONG_BITS == 32) {
+ seg = P_ADDR32;
+ }
} else if (TCG_TARGET_REG_BITS == 64 && offset != GUEST_BASE) {
tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_L1, GUEST_BASE);
tgen_arithr(s, ARITH_ADD + P_REXW, TCG_REG_L1, base);
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
next prev parent reply other threads:[~2015-07-15 10:14 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
2015-07-15 8:06 ` Aurelien Jarno
2015-07-15 10:02 ` Richard Henderson
2015-07-15 10:14 ` Aurelien Jarno [this message]
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=20150715101447.GD20210@aurel32.net \
--to=aurelien@aurel32.net \
--cc=leon.alrae@imgtec.com \
--cc=pbonzini@redhat.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).