            FAST sqrt routine for Alpha 21164(A)

                                               98/10/10

                                          by Kazushige Goto


              * THIS SOURCE IS PRELIMINARY!!! *
      *  YOU CAN TRY, BUT DO NOT INCLUDE OTHER PACKAGES  *


1. Abstract

  This sqrt routine is written in assembler, and it's very fast.
  It runs a little bit faster than sqrt of DEC's libm !

  It also contains various error handling such as NaN, +-Inf and
  subnormal.  Even if the value is subnormal, it runs faster than
  glibc's assembler routine(Normal value takes ONLY 53 clocks,
  Subnormal value takes beween 88 to 130 clocks, depending on values).  

  My main target is for Alpha 21164(A).  21164SX, 21064, 21066 are
  not so fast(of course, it's faster than before though).

  This source will be merged next libffm package.


2. How to build
 
  It's simple.  Please try to type "make", and link sqrt.o with your
program(same way as libffm, sqrt.o should be placed on the first.
e.g.  sqrt.o -lffm -lm,  or you can remove libffm's sqrt and replace
it). 


3. Algorithm

  The main algorithm is same as glibc's assembler routine.  The
glibc's routine has 6 bit table.  I use 14bit table(256kBytes) which is
larger than 21164's first level cache(8kBytes) and second level
cache(96kBytes).  I checked some benchmarks which use sqrt heavily,
and showed good(enough?) performance.
