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: Tue, 20 Jun 2006 15:29:10 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.64.0606201524080.2085@home.oyster.ru> (raw)
In-Reply-To: <200606201154.40985.jseward@acm.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1313 bytes --]

On Tue, 20 Jun 2006, Julian Seward wrote:

>
> The SSE2 instructions cvttps2dq, movdq2q, movq2dq do not behave
> correctly, as shown by the attached program.  It should print
>
>  cvttps2dq_1 ... ok
>  cvttps2dq_2 ... ok
>  movdq2q_1 ... ok
>  movq2dq_1 ... ok
>
> but instead produces
>
>  cvttps2dq_1 ... ok
>  cvttps2dq_2 ... not ok
>    result0.sd[0] = 12 (expected 12)
>    result0.sd[1] = 3 (expected 56)
>    result0.sd[2] = -2147483648 (expected 43)
>    result0.sd[3] = 3 (expected 87)
>  movdq2q_1 ... not ok
>    result0.uq[0] = 1302123111658042420 (expected 5124095577148911)
>  movq2dq_1 ... not ok
>    result0.uq[0] = 1302123111658042420 (expected 5124095577148911)
>    result0.uq[1] = 6221254864647256184 (expected 0)
>
> I looked at QEMU's instruction decoders for these, and compared them
> to Valgrind's, but could not see what the problem was.  The decode
> logic looks OK.  Maybe the problem is elsewhere.

The signature of movdq2q is Pq, VRq and for movq2dq - Vo, PRq it appears
that translate.c gets it backwards, attached patch should deal with it.

As for cvttps2dq i ran it with interpreter which uses outdated(i.e. non
soft-float) conversion routines and it passed, so my guess would be that
this is float32_to_int32_round_to_zero vs (int32_t) cast issue.

--
mailto:malc@pulsesoft.com

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1181 bytes --]

--- translate.c	Tue Jun 20 15:19:01 2006
+++ /mnt/big/npf/cvs/qemux/qemu/target-i386/translate.c	Tue Jun 20 15:19:20 2006
@@ -2947,15 +2947,15 @@
         case 0x2d6: /* movq2dq */
             gen_op_enter_mmx();
             rm = (modrm & 7) | REX_B(s);
-            gen_op_movq(offsetof(CPUX86State,xmm_regs[reg & 7].XMM_Q(0)),
-                        offsetof(CPUX86State,fpregs[rm].mmx));
-            gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg & 7].XMM_Q(1)));
+            gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)),
+                        offsetof(CPUX86State,fpregs[reg & 7].mmx));
+            gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[rm].XMM_Q(1)));
             break;
         case 0x3d6: /* movdq2q */
             gen_op_enter_mmx();
             rm = (modrm & 7);
-            gen_op_movq(offsetof(CPUX86State,fpregs[reg].mmx),
-                        offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)));
+            gen_op_movq(offsetof(CPUX86State,fpregs[rm].mmx),
+                        offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)));
             break;
         case 0xd7: /* pmovmskb */
         case 0x1d7:

  reply	other threads:[~2006-06-20 11:30 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 [this message]
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
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.0606201524080.2085@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).