qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fred Konrad <konrad@adacore.com>
To: Laurent Vivier <laurent@vivier.eu>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	alex.bennee@linaro.org, Aurelien Jarno <aurelien@aurel32.net>,
	philmd@redhat.com
Subject: Re: [PATCH 1/2] softfloat: m68k: infinity is a valid encoding
Date: Mon, 15 Jun 2020 17:59:30 +0200	[thread overview]
Message-ID: <0cfb0348-d6db-db68-3181-85a605bfa91b@adacore.com> (raw)
In-Reply-To: <1f4d93eb-0b89-5189-0147-3a456197cc0d@vivier.eu>

Missed this one sorry.

Le 6/12/20 à 10:31 AM, Laurent Vivier a écrit :
> Le 28/04/2020 à 19:17, KONRAD Frederic a écrit :
>> The MC68881 say about infinities (3.2.4):
>>
>> "*For the extended precision format, the most significant bit of the
>> mantissa (the integer bit) is a don't care."
>>
>> https://www.nxp.com/docs/en/reference-manual/MC68881UM.pdf
>>
>> The m68k extended format is implemented with the floatx80 and
>> floatx80_invalid_encoding currently treats 0x7fff00000000000000000000 as
>> an invalid encoding.  This patch fixes floatx80_invalid_encoding so it
>> accepts that the most significant bit of the mantissa can be 0.
>>
>> This bug can be revealed with the following code which pushes extended
>> infinity on the stack as a double and then reloads it as a double.  It
>> should normally be converted and read back as infinity and is currently
>> read back as nan:
>>
>>          .global _start
>>          .text
>> _start:
>>          lea val, %a0
>>          lea fp, %fp
>>          fmovex (%a0), %fp0
>>          fmoved %fp0, %fp@(-8)
>>          fmoved %fp@(-8), %fp0
>> end:
>>          bra end
>>
>> .align 0x4
>> val:
>>          .fill 1, 4, 0x7fff0000
>>          .fill 1, 4, 0x00000000
>>          .fill 1, 4, 0x00000000
>> .align 0x4
>>          .fill 0x100, 1, 0
>> fp:
>>

[...]

> 
> According to "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" the explicit
> integer bit is "Don't care" for signed infinite (a.high == 0x7FFF) (this
> is the case this patch manages).
> 
> But wit a zero exponent and a non zero mantissa, it's a denormal number,
> and a signed zero has also a zero explicit integer bit but a zero
> mantissa. (both cases are already managed in the existing code).
> 
> with a non zero exponent less than the maximum value it's an unnormal
> number.
> 
> The denormal and unnormal numbers must be managed during the load
> operation in the m68k TCG emulation to generate directly the FP_UNIMP
> exception.

Is this already handled in the TCG code?

Thanks,
Fred

> 
> So I think, in the end, we don't have invalid number at softfloat level
> and floatx80_invalid_encoding() should always return "false" for
> TARGET_M68K.
> 
> Thanks,
> Laurent
> 


  reply	other threads:[~2020-06-15 16:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 17:17 [PATCH 0/2] m68k fpu fixes KONRAD Frederic
2020-04-28 17:17 ` [PATCH 1/2] softfloat: m68k: infinity is a valid encoding KONRAD Frederic
2020-04-28 18:43   ` Alex Bennée
2020-04-29  8:48     ` Laurent Vivier
2020-04-29  9:26       ` Alex Bennée
2020-04-29  9:43         ` Laurent Vivier
2020-04-29 10:22           ` Alex Bennée
2020-04-29 14:27         ` Laurent Vivier
2020-04-29 20:51           ` Alex Bennée
2020-04-29  8:42   ` Laurent Vivier
2020-04-29 12:33     ` KONRAD Frederic
2020-07-13 10:01     ` Andreas Schwab
2020-06-12  8:31   ` Laurent Vivier
2020-06-15 15:59     ` Fred Konrad [this message]
2020-06-15 16:46       ` Laurent Vivier
2020-04-28 17:17 ` [PATCH 2/2] target/m68k: fix gdb for m68xxx KONRAD Frederic
2020-04-29  8:57   ` Laurent Vivier
2020-04-29  9:28     ` Alex Bennée
2020-04-29  9:38       ` Laurent Vivier
2020-04-29 12:25         ` KONRAD Frederic

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=0cfb0348-d6db-db68-3181-85a605bfa91b@adacore.com \
    --to=konrad@adacore.com \
    --cc=alex.bennee@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.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).