Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Simulation of MIPS recip and rsqrt instructions
Date: Tue, 26 Nov 2002 12:38:00 -0000	[thread overview]
Message-ID: <wvn65ukawwz.fsf@talisman.cambridge.redhat.com> (raw)
In-Reply-To: <3DE3D5BD.4070207@redhat.com>

Andrew Cagney <ac131313@redhat.com> writes:
> Can this test case be written in strict assembler so that it can be
> added to the simulator testsuite?

Is there a testsuite for mips?

> > Unfortunately, sim_fpu_inv isn't commented and cp1.c seems to be
> > its only active user.  Which should change?
> 
> Hmm, I guess:
> 
> 	1 / (x * 2^y) == (1/x) * (1/(2^y)) == (1/x) * (2^(-y))
> 
> and
> 	1/x != x
> 
> so I think the inv() function should be fixed - that suggests it is
> pretty broken.

OK, so sim_fpu_inv() _is_ supposed to be a general reciprocal function?
Not just for powers of two, etc.?  It seemed so deliberate, it was
difficult to tell.

Like you say, there's probably some code that could be nicked
from elsewhere, but reusing sim_fpu_div should work too, even
if it isn't as efficient.  The patch below also fixes the
test case.

Richard


Index: sim/common/sim-fpu.c
===================================================================
RCS file: /cvs/src/src/sim/common/sim-fpu.c,v
retrieving revision 1.4
diff -c -d -p -F^[(a-zA-Z0-9_^#] -r1.4 sim-fpu.c
*** sim/common/sim-fpu.c	12 Jun 2002 00:46:11 -0000	1.4
--- sim/common/sim-fpu.c	26 Nov 2002 20:33:46 -0000
*************** INLINE_SIM_FPU (int)
*** 1754,1786 ****
  sim_fpu_inv (sim_fpu *f,
  	     const sim_fpu *r)
  {
!   if (sim_fpu_is_snan (r))
!     {
!       *f = *r;
!       f->class = sim_fpu_class_qnan;
!       return sim_fpu_status_invalid_snan;
!     }
!   if (sim_fpu_is_qnan (r))
!     {
!       *f = *r;
!       f->class = sim_fpu_class_qnan;
!       return 0;
!     }
!   if (sim_fpu_is_infinity (r))
!     {
!       *f = sim_fpu_zero;
!       f->sign = r->sign;
!       return 0;
!     }
!   if (sim_fpu_is_zero (r))
!     {
!       f->class = sim_fpu_class_infinity;
!       f->sign = r->sign;
!       return sim_fpu_status_invalid_div0;
!     }
!   *f = *r;
!   f->normal_exp = - r->normal_exp;
!   return 0;
  }
  
  
--- 1754,1760 ----
  sim_fpu_inv (sim_fpu *f,
  	     const sim_fpu *r)
  {
!   return sim_fpu_div (f, &sim_fpu_one, r);
  }
  
  


  reply	other threads:[~2002-11-26 20:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-26 11:41 Richard Sandiford
2002-11-26 12:12 ` Andrew Cagney
2002-11-26 12:38   ` Richard Sandiford [this message]
     [not found] ` <mailpost.1038339722.6479@news-sj1-1>
2002-11-26 12:42   ` cgd
2002-11-27  0:12     ` Richard Sandiford
     [not found]       ` <mailpost.1038384740.26359@news-sj1-1>
2002-11-27 17:33         ` cgd

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=wvn65ukawwz.fsf@talisman.cambridge.redhat.com \
    --to=rsandifo@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /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