qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <malc@pulsesoft.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] cvttps2dq, movdq2q, movq2dq incorrect behaviour
Date: Wed, 21 Jun 2006 12:21:07 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.64.0606211214070.698@home.oyster.ru> (raw)
In-Reply-To: <200606210131.06270.jseward@acm.org>

On Wed, 21 Jun 2006, Julian Seward wrote:

>
> Malc, your sse-movq.patch works for me.  Thanks.
>
>> soft-float was a red herring, translate.c is at fault here (interpreter
>> does not use it, hence behaved correctly)
>>
>> translate.c:3009
>> if (b1 >= 2 && ((b >= 0x50 && b <= 0x5f) ||
>>                  b == 0xc2)) {
>>      /* specific case for SSE single instructions */
>>      if (b1 == 2) {
>>          /* 32 bit access */
>>          gen_op_ld_T0_A0[OT_LONG + s->mem_index]();
>>          gen_op_movl_env_T0(offsetof(CPUX86State,xmm_t0.XMM_L(0)));
>>      } else {
>>          /* 64 bit access */
>>          gen_ldq_env_A0[s->mem_index >>
>> 2](offsetof(CPUX86State,xmm_t0.XMM_D(0))); }
>> } else {
>>      gen_ldo_env_A0[s->mem_index >> 2](op2_offset);
>> }
>>
>> cvttps2dq is 0x5b(b=0x5b) with repn prefix (b1=2) the above code is
>> optimized a bit more than it should have been, as it loads only 4 bytes
>> into xmm_t0 instead of 16.
>
> Uh, fine, but I don't understand how/what to fix.  Can you advise?

Following will fix the _specific_ case of cvttps2dq, ideally one
should go through all the [0x50..0x5f, 0xc2] with (repnz,repz prefix)
range and check wether the rules imposed by the above snippet apply.

--- /mnt/big/npf/cvs/qemux/qemu/target-i386/translate.c Tue Jun 20 15:19:20 2006
+++ translate.c Tue Jun 20 18:17:19 2006
@@ -3009,7 +3009,9 @@
                  if (b1 >= 2 && ((b >= 0x50 && b <= 0x5f) ||
                                  b == 0xc2)) {
                      /* specific case for SSE single instructions */
-                    if (b1 == 2) {
+                    if (b1 == 2 && b == 0x5b) {
+                        gen_ldo_env_A0[s->mem_index >> 2](offsetof(CPUX86State,xmm_t0.XMM_Q(0)));
+                    } else if (b1 == 2) {
                          /* 32 bit access */
                          gen_op_ld_T0_A0[OT_LONG + s->mem_index]();
                          gen_op_movl_env_T0(offsetof(CPUX86State,xmm_t0.XMM_L(0)));

-- 
mailto:malc@pulsesoft.com

  reply	other threads:[~2006-06-21  8:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-20 10:54 [Qemu-devel] cvttps2dq, movdq2q, movq2dq incorrect behaviour Julian Seward
2006-06-20 11:29 ` malc
2006-06-20 11:48   ` Julian Seward
2006-06-20 14:26     ` malc
2006-06-21  0:31       ` Julian Seward
2006-06-21  8:21         ` malc [this message]
2006-06-21 11:04           ` malc
2006-06-21 23:01             ` Julian Seward
2006-06-20 13:15 ` RE : " Sylvain Petreolle
2006-06-20 13:51   ` malc
2006-06-20 14:13     ` Julian Seward
2006-06-20 15:06       ` RE : " Sylvain Petreolle
2006-06-20 15:14         ` Guillaume POIRIER
2006-06-20 14:17     ` RE : " Jens Axboe
2006-06-20 14:23       ` Jens Axboe

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=Pine.LNX.4.64.0606211214070.698@home.oyster.ru \
    --to=malc@pulsesoft.com \
    --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).