Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libmvec/common/__vcos.c
          +++ new/usr/src/lib/libmvec/common/__vcos.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21  
  22   22  /*
  23   23   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  /*
  26   26   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27   27   * Use is subject to license terms.
  28   28   */
  29   29  
  30   30  #include <sys/isa_defs.h>
       31 +#include <sys/ccompile.h>
  31   32  
  32   33  #ifdef _LITTLE_ENDIAN
  33   34  #define HI(x)   *(1+(int*)x)
  34   35  #define LO(x)   *(unsigned*)x
  35   36  #else
  36   37  #define HI(x)   *(int*)x
  37   38  #define LO(x)   *(1+(unsigned*)x)
  38   39  #endif
  39   40  
  40   41  #ifdef __RESTRICT
↓ open down ↓ 50 lines elided ↑ open up ↑
  91   92   * Argument reduction is done here for elts pi/4 < arg < 1.647e+06.
  92   93   *
  93   94   * elts < 2^-27 use the approximation 1.0 ~ cos(x).
  94   95   */
  95   96  void
  96   97  __vcos( int n, double * restrict x, int stridex, double * restrict y,
  97   98          int stridey )
  98   99  {
  99  100          double          x0_or_one[4], x1_or_one[4], x2_or_one[4];
 100  101          double          y0_or_zero[4], y1_or_zero[4], y2_or_zero[4];
 101      -        double          x0, x1, x2, *py0, *py1, *py2, *xsave, *ysave;
 102      -        unsigned        hx0, hx1, hx2, xsb0, xsb1, xsb2;
 103      -        int                     i, biguns, nsave, sxsave, sysave;
 104      -
      102 +        double          x0, x1, x2, *py0 = 0, *py1 = 0, *py2, *xsave, *ysave;
      103 +        unsigned        hx0, hx1, hx2, xsb0, xsb1 = 0, xsb2;
      104 +        int             i, biguns, nsave, sxsave, sysave;
 105  105          nsave = n;
 106  106          xsave = x;
 107  107          sxsave = stridex;
 108  108          ysave = y;
 109  109          sysave = stridey;
 110  110          biguns = 0;
 111  111  
 112  112          do /* MAIN LOOP */
 113  113          {
 114  114                  /* Gotos here so _break_ exits MAIN LOOP. */
 115  115  LOOP0:  /* Find first arg in right range. */
 116  116                  xsb0 = HI(x); /* get most significant word */
 117  117                  hx0 = xsb0 & ~0x80000000; /* mask off sign bit */
 118  118                  if ( hx0 > 0x3fe921fb ) {
 119  119                          /* Too big: arg reduction needed, so leave for second part */
 120  120                          biguns = 1;
 121  121                          goto MEDIUM;
 122  122                  }
 123  123                  if ( hx0 < 0x3e400000 ) {
 124  124                          /* Too small.  cos x ~ 1. */
 125      -                        volatile int v = *x;
 126  125                          *y = 1.0;
 127  126                          x += stridex;
 128  127                          y += stridey;
 129  128                          i = 0;
 130  129                          if ( --n <= 0 )
 131  130                                  break;
 132  131                          goto LOOP0;
 133  132                  }
 134  133                  x0 = *x;
 135  134                  py0 = y;
↓ open down ↓ 6 lines elided ↑ open up ↑
 142  141  LOOP1: /* Get second arg, same as above. */
 143  142                  xsb1 = HI(x);
 144  143                  hx1 = xsb1 & ~0x80000000;
 145  144                  if ( hx1 > 0x3fe921fb )
 146  145                  {
 147  146                          biguns = 2;
 148  147                          goto MEDIUM;
 149  148                  }
 150  149                  if ( hx1 < 0x3e400000 )
 151  150                  {
 152      -                        volatile int v = *x;
 153  151                          *y = 1.0;
 154  152                          x += stridex;
 155  153                          y += stridey;
 156  154                          i = 1;
 157  155                          if ( --n <= 0 )
 158  156                                  break;
 159  157                          goto LOOP1;
 160  158                  }
 161  159                  x1 = *x;
 162  160                  py1 = y;
↓ open down ↓ 6 lines elided ↑ open up ↑
 169  167  LOOP2: /* Get third arg, same as above. */
 170  168                  xsb2 = HI(x);
 171  169                  hx2 = xsb2 & ~0x80000000;
 172  170                  if ( hx2 > 0x3fe921fb )
 173  171                  {
 174  172                          biguns = 3;
 175  173                          goto MEDIUM;
 176  174                  }
 177  175                  if ( hx2 < 0x3e400000 )
 178  176                  {
 179      -                        volatile int v = *x;
 180  177                          *y = 1.0;
 181  178                          x += stridex;
 182  179                          y += stridey;
 183  180                          i = 2;
 184  181                          if ( --n <= 0 )
 185  182                                  break;
 186  183                          goto LOOP2;
 187  184                  }
 188  185                  x2 = *x;
 189  186                  py2 = y;
↓ open down ↓ 910 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX