From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] x86/emul: only emulate possibly operand sizes for POPA
Date: Thu, 08 Nov 2012 07:48:23 +0000 [thread overview]
Message-ID: <CCC11447.443E2%keir.xen@gmail.com> (raw)
In-Reply-To: <509B6EB002000078000A71CB@nat28.tlf.novell.com>
On 08/11/2012 07:34, "Jan Beulich" <JBeulich@suse.com> wrote:
>> Would prefer:
>> if ( op_bytes == 2 )
>> *(uint16_t *)regs[i] = (uint16_t)dst.val;
>> else
>> *regs[i] = dst.val;
>>
>> Handles the exceptional case immediately after its predicate.
>
> I had it that way first, but compilers tend to prefer (in terms of
> static branch prediction) the if() body over the else one. Doesn't
> matter that much here of course, but I'm generally trying to
> follow such guidelines even in non performance critical paths so
> that in case code gets cloned elsewhere it doesn't require extra
> reviewing or adjustment.
Should follow such guidelines where the optimisation matters. I think
shaping code to follow such guidelines all the time, is misguided. I'd
rather have the fractionally more readable version than the
possibly-fractionally faster version.
>> And the cast
>> from uint32_t, and 64b-related comment, are pointless and in fact misleading
>> in the default case, since as you say the instruction is invalid in 64-bit
>> mode.
>
> And I considered that aspect too: Even if invalid in 64-bit mode, it
> is valid in compatibility mode, and in that case the zero-extension
> makes sense (as does the comment).
I did wonder. The top halves of 64b registers are not used in compatibility
mode. Are their contents at all guaranteed to be
maintained/updated/preserved in any meaningful way across transitions into
and out of compatibility mode? I wasn't aware they were, and in that case
the cast and comment are indeed pointless.
-- Keir
next prev parent reply other threads:[~2012-11-08 7:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 16:08 [PATCH] x86/emul: only emulate possibly operand sizes for POPA Jan Beulich
2012-11-07 17:10 ` Keir Fraser
2012-11-08 7:34 ` Jan Beulich
2012-11-08 7:48 ` Keir Fraser [this message]
2012-11-08 8:34 ` Jan Beulich
2012-11-08 9:08 ` Keir Fraser
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=CCC11447.443E2%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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.