linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Zang Roy-r61911 <tie-fei.zang@freescale.com>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev list <linuxppc-dev@ozlabs.org>,
	Liu Yu <B13201@freescale.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH] Fix rounding bug in emulation for double floatoperating
Date: 12 Dec 2007 16:30:24 +0800	[thread overview]
Message-ID: <1197448223.29372.12.camel@localhost.localdomain> (raw)
In-Reply-To: <A069B515-C07A-4471-9473-7A7E29F12685@kernel.crashing.org>

On Tue, 2007-12-11 at 23:26, Kumar Gala wrote:
> >>
> >> how did you find this?
> >>
> > It supposed to run the following test case on a powerpc platform.
> > Yu's patch fixes the issue.
> > Could you help to merge this patch in your tree?
> > ---
> > #include <stdio.h>
> > #include <math.h>
> > #include <bits/nan.h>
> > #ifdef __SPE__
> > #include <spe.h>
> > int
> > getSPEFSCR()
> > {
> >    return __builtin_spe_mfspefscr();
> > }
> >
> > void
> > setSPEFSCR(int i)
> > {
> >    __builtin_spe_mtspefscr(i);
> > }
> > #else
> > int
> > getSPEFSCR()
> > {
> >    return 0;
> > }
> >
> > void
> > setSPEFSCR(int i)
> > {
> > }
> > #endif
> >
> > void
> > dmul(double d, double d1, double expected)
> > {
> >    double d2;
> >    int before, after;
> >
> >    before = getSPEFSCR();
> >    d2 = d * d1;
> >    after = getSPEFSCR();
> >
> >    printf("dmul %llx * %llx = %llx expected %llx %s [0x%x 0x%x]\n", 
> > d, d1, d2, expected,
> >           (d2 == expected) ? "(PASS)" : "(FAIL)", before, after);
> > }
> >
> > void
> > ddiv(double d, double d1, double expected)
> > {
> >    register double d2;
> >    int before, after;
> >
> >    before = getSPEFSCR();
> >    d2 = d / d1;
> >    after = getSPEFSCR();
> >
> >    printf("ddiv %llx / %llx = %llx expected %llx %s [0x%x 0x%x]\n", 
> > d, d1, d2, expected,
> >           (d2 == expected) ? "(PASS)" : "(FAIL)", before, after);
> > }
> >
> > main()
> > {
> >    const double min_double = 4.9406564584124654e-324L;
> >
> >    printf("\n");
> >    dmul(0.5L, min_double, 0.0L);
> >    dmul(-0.5L, min_double, 0.0L);
> >    dmul(-min_double, -0.5L, 0.0L);
> >    printf("\n");
> >    ddiv(min_double, 2.0L, 0.0L);
> > }
> 
> When I run this on a G5 (w/HW FP) I get:
> 
> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
> 
> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
> 
> and on the 85xx w/FP emu:
> 
> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
> 
> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
> 
> Maybe I'm missing where the error is.
I am missing ...
It is supposed to run based on previous IEEE 754 patch.
http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031351.html
Roy

  reply	other threads:[~2007-12-12  8:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-10  5:00 [PATCH] Fix rounding bug in emulation for double float operating Liu Yu
2007-12-10  4:56 ` David Gibson
2007-12-10  5:25   ` [PATCH] Fix rounding bug in emulation for double floatoperating Liu Yu
2007-12-10 15:00     ` Kumar Gala
2007-12-11  1:38       ` Liu Yu
2007-12-11  3:19       ` Zang Roy-r61911
2007-12-11 15:26         ` Kumar Gala
2007-12-12  8:30           ` Zang Roy-r61911 [this message]
2007-12-12 13:36             ` Kumar Gala
2007-12-14  5:46             ` Kumar Gala
2007-12-14  6:06               ` Zang Roy-r61911
2007-12-14  6:14                 ` Kumar Gala
2007-12-14  5:01 ` [PATCH] Fix rounding bug in emulation for double float operating Kumar Gala

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=1197448223.29372.12.camel@localhost.localdomain \
    --to=tie-fei.zang@freescale.com \
    --cc=B13201@freescale.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.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).