All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhu Ebony-r57400" <ebony.zhu@freescale.com>
To: "Paul Mackerras" <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
Subject: RE: [patch][0/5] powerpc: Add support to fully comply with IEEE-754standard
Date: Fri, 12 Jan 2007 14:38:50 +0800	[thread overview]
Message-ID: <32F3CC26D4DAC44E8ECD07155727A46E816A18@zch01exm20.fsl.freescale.net> (raw)
In-Reply-To: <17831.7374.149397.133454@cargo.ozlabs.ibm.com>

Hi Paul,

On SPE implemented E500/E500v2 core, the embedded floating-point
APU implements a floating-point system as defined in ANSI/IEEE
standard754-1985 but rely on software support in order to conform fully
with the standard. Thus, whenever an input operand of a floating-point
instruction has data values that are +infinity, =A8Cinfinity, denorm, or =
NaN,
or when the result of an operation produces an overflow or an underflow,
an interrupt may be taken and the interrupt handler is responsible for =
delivering
IEEE 754-compliant behavior if desired.

When floating-point invalid input exceptions are disabled
(SPEFSCR[FINVE] is cleared), default results are provided by the=20
hardware when an infinity, denorm, or NaN input is received, or for the
operation 0/0. When floating-point underflow exceptions are disabled
(SPEFSCR[FUNFE] is cleared) and the result of a floating-point operation
underflows, a signed zero result is produced. When floating-point =
overflow
exceptions are disabled (EFSCR[FOVFE] is cleared) and the result of a=20
floating-point operation overflows, a pmax or nmax result is produced.=20
A divide-by-zero exception enable flag (SPEFSCR[FDBZE]) is
provided for generating an interrupt when a divide-by-zero operation is
attempted to allow a software handler to conform to the IEEE 754 =
standard.

In current code, all of these exceptions are disabled, and the IEEE-754 =
standard
is not fully complied.

Let's see an example:

2.1E-44 * 1.5666666 =3D ?

On IEEE-754 fully complied system (x86, 7450, etc.), the result should =
be=20
3.22299e-44. But on E500/E500v2 core, the result is 0.

And there are much more cases show that E500 SPE core is not fully
IEEE-754 complied.

The approach I've taken to solve this issue is:
1. Enable SPEFSCR[FINVE|FDBZE|FUNFE|FOVFE] to make sure exceptions
can take place
2. Use exceptions handlers to handle the exceptions.
3. Restore registers and exit from exception.

In arch/powerpc/math, there are some files to emulate floating point =
instructions
on non-FPU systems, which may come from glibc. Some macros are provided =
to
emulate plus, minus, multiply, divide, etc. Therefore, I re-used some of =
the codes there
and add some new routines to emulated SPE instruction that may cause =
exception,
including SPFP instructions, DPFP instructions and Vector SPFP =
instructions.

Writing some independent codes to handle the exceptions my be an =
alternative way,
but I think re-use the existing interfaces in kernel is the best =
approach.

Ebony



> -----Original Message-----
> From: Paul Mackerras [mailto:paulus@samba.org]=20
> Sent: 2007=C4=EA1=D4=C212=C8=D5 13:30
> To: Zhu Ebony-r57400
> Cc: linuxppc-dev@ozlabs.org
> Subject: Re: [patch][0/5] powerpc: Add support to fully=20
> comply with IEEE-754standard
>=20
> Zhu Ebony-r57400 writes:
>=20
> > This series of patch add support to fully comply with IEEE-754=20
> > standard for E500/E500v2 core when hardware floating point=20
> compiling is used.
>=20
> Your patch descriptions need to explain in detail in what way=20
> the current code doesn't comply with the IEEE-754 standard,=20
> and what approach you have taken to make it comply.  If there=20
> are alternative approaches, explain why the approach you have=20
> taken is the best.
>=20
> Thanks,
> Paul.
>=20

  parent reply	other threads:[~2007-01-12  6:38 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12  5:19 [patch][0/5] powerpc: Add support to fully comply with IEEE-754 standard Zhu Ebony-r57400
2007-01-12  5:29 ` Paul Mackerras
2007-01-12  5:46   ` Kumar Gala
2007-01-12  8:27     ` Zhu Ebony-r57400
2007-01-12 12:06       ` Segher Boessenkool
2007-01-15  8:41         ` Zhu Ebony-r57400
2007-01-12  6:38   ` Zhu Ebony-r57400 [this message]
2007-01-12  6:49     ` [patch][0/5] powerpc: Add support to fully comply with IEEE-754standard Kumar Gala
2007-01-12 12:03     ` Segher Boessenkool
2007-01-15  8:16       ` Zhu Ebony-r57400
2007-01-15 16:08         ` Segher Boessenkool
2007-01-12  6:41 ` [patch][0/5] powerpc: Add support to fully comply with IEEE-754 standard Kumar Gala
2007-01-12  8:09   ` Zhu Ebony-r57400
2007-01-12 12:04     ` Segher Boessenkool
2007-01-15  6:45       ` Zhu Ebony-r57400
2007-01-15 15:54         ` Segher Boessenkool
2007-01-12 18:36     ` Kumar Gala
2007-01-15  6:37       ` Zhu Ebony-r57400
2007-01-15 14:37         ` Kumar Gala
2007-01-16  9:54           ` Zhu Ebony-r57400
2007-01-25  8:25           ` Zhu Ebony-r57400
2007-01-25  8:28             ` Kumar Gala
2007-01-25  8:53               ` Zhu Ebony-r57400
2007-01-25 15:10                 ` Kumar Gala
2007-01-26  6:16                   ` Zhu Ebony-r57400
2007-01-29 10:00                   ` Zhu Ebony-r57400
2007-01-29 14:30                     ` Kumar Gala
2007-01-31  9:45                       ` Zhu Ebony-r57400
2007-01-31 14:48                         ` Kumar Gala
2007-02-01  9:35                           ` Zhu Ebony-r57400
2007-02-07  5:52           ` Zhu Ebony-r57400
2007-02-07  7:11             ` Kumar Gala
2007-02-07  7:21               ` Zhu Ebony-r57400
2007-02-07  7:57                 ` Kumar Gala
2007-02-07  8:04                   ` Zhu Ebony-r57400
2007-02-08  3:50                   ` [patch][0/5] powerpc V2 : " Zhu Ebony-r57400
2007-02-08  5:18                     ` Kumar Gala
2007-02-08  5:40                       ` Zhu Ebony-r57400
2007-02-08  7:06                       ` Zhu Ebony-r57400
2007-02-08  7:15                         ` Kumar Gala
2007-02-08  8:08                           ` Zhu Ebony-r57400
2007-02-08 17:18                             ` Kumar Gala
2007-02-09  5:15                               ` Zhu Ebony-r57400
2007-07-30 14:56                                 ` Sergei Shtylyov
2007-07-31  3:36                                   ` Zhu Ebony-r57400

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=32F3CC26D4DAC44E8ECD07155727A46E816A18@zch01exm20.fsl.freescale.net \
    --to=ebony.zhu@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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.