qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Laurent Desnogues <laurent.desnogues@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target-i386: Fix regression with maxsd SSE2 instruction
Date: Tue, 8 Nov 2011 08:22:33 -0600	[thread overview]
Message-ID: <4EB93B29.9070204@windriver.com> (raw)
In-Reply-To: <CABoDooMd5EGaEkEHg=0TtgV_BhjtBDHQ=VzwqQB3Y+_DB21iwQ@mail.gmail.com>

On 11/08/2011 07:48 AM, Laurent Desnogues wrote:
> On Tue, Nov 8, 2011 at 2:00 PM, Jason Wessel <jason.wessel@windriver.com> wrote:
>> The maxsd instruction needs to take into account the sign of the
>> numbers 64 bit numbers.  This is a regression that was introduced in
>> 347ac8e356 (target-i386: switch to softfloat).
>>
>> The case that fails is:
>>
>> maxsd  %xmm1,%xmm0
>>
>> When xmm1 = 24 and xmm0 = -100
>>
>> This was found running the glib2 binding tests where it prints the message:
>> /binding/transform:
>> GLib-GObject-WARNING **: value "24.000000" of type `gdouble' is invalid or out of range for property `value' of type `gdouble'
>> aborting...
>>
>> Using a signed comparison fixes the problem.
>>
>> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
>> ---
>>  target-i386/ops_sse.h |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target-i386/ops_sse.h b/target-i386/ops_sse.h
>> index aa41d25..bcc0ed9 100644
>> --- a/target-i386/ops_sse.h
>> +++ b/target-i386/ops_sse.h
>> @@ -584,8 +584,8 @@ void helper_ ## name ## sd (Reg *d, Reg *s)\
>>  #define FPU_SUB(size, a, b) float ## size ## _sub(a, b, &env->sse_status)
>>  #define FPU_MUL(size, a, b) float ## size ## _mul(a, b, &env->sse_status)
>>  #define FPU_DIV(size, a, b) float ## size ## _div(a, b, &env->sse_status)
>> -#define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b)
>> -#define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b)
> Isn't maxsd a floating-point instruction?  If so, shouldn't
> FPU_{MIN,MAX} use softfloat operations?


You are correct.

It should be:

+#define FPU_MIN(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? (a) : (b)
+#define FPU_MAX(size, a, b) float ## size ## _lt(b, a, &env->sse_status) ? (a) : (b)

Jason.

>
>
> Laurent
>
>> +#define FPU_MIN(size, a, b) (int ## size ## _t)(a) < (int ## size ## _t)(b) ? (a) : (b)
>> +#define FPU_MAX(size, a, b) (int ## size ## _t)(a) > (int ## size ## _t)(b) ? (a) : (b)
>>  #define FPU_SQRT(size, a, b) float ## size ## _sqrt(b, &env->sse_status)
>>
>>  SSE_HELPER_S(add, FPU_ADD)
>> --
>> 1.7.1
>>
>>
>>

  reply	other threads:[~2011-11-08 14:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08 13:00 [Qemu-devel] [PATCH] target-i386: Fix regression with maxsd SSE2 instruction Jason Wessel
2011-11-08 13:48 ` Laurent Desnogues
2011-11-08 14:22   ` Jason Wessel [this message]
2011-11-08 14:40     ` Peter Maydell
2011-11-08 14:45       ` Jason Wessel
2011-11-08 15:19         ` Peter Maydell

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=4EB93B29.9070204@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=laurent.desnogues@gmail.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).