Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libmvec/common/__vsincos.c
          +++ new/usr/src/lib/libmvec/common/__vsincos.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 ↓ 45 lines elided ↑ open up ↑
  86   87   * elts < 2^-27 use the approximation 1.0 ~ cos(x).
  87   88   */
  88   89  void
  89   90  __vsincos( int n, double * restrict x, int stridex,
  90   91                                  double * restrict y, int stridey,
  91   92                                  double * restrict c, int stridec )
  92   93  {
  93   94          double          x0_or_one[4], x1_or_one[4], x2_or_one[4];
  94   95          double          y0_or_zero[4], y1_or_zero[4], y2_or_zero[4];
  95   96          double          x0, x1, x2,
  96      -                                *py0, *py1, *py2,
  97      -                                *pc0, *pc1, *pc2,
  98      -                                *xsave, *ysave, *csave;
       97 +                        *py0, *py1, *py2,
       98 +                        *pc0, *pc1, *pc2,
       99 +                        *xsave, *ysave, *csave;
  99  100          unsigned        hx0, hx1, hx2, xsb0, xsb1, xsb2;
 100      -        int                     i, biguns, nsave, sxsave, sysave, scsave;
 101      -
      101 +        int             i, biguns, nsave, sxsave, sysave, scsave;
 102  102          nsave = n;
 103  103          xsave = x;
 104  104          sxsave = stridex;
 105  105          ysave = y;
 106  106          sysave = stridey;
 107  107          csave = c;
 108  108          scsave = stridec;
 109  109          biguns = 0;
 110  110  
 111  111          do /* MAIN LOOP */
↓ open down ↓ 9 lines elided ↑ open up ↑
 121  121                          x += stridex;
 122  122                          y += stridey;
 123  123                          c += stridec;
 124  124                          i = 0;
 125  125                          if ( --n <= 0 )
 126  126                                  break;
 127  127                          goto LOOP0;
 128  128                  }
 129  129                  if ( hx0 < 0x3e400000 ) {
 130  130                          /* Too small.  cos x ~ 1, sin x ~ x. */
 131      -                        volatile int v = *x;
 132  131                          *c = 1.0;
 133  132                          *y = *x;
 134  133                          x += stridex;
 135  134                          y += stridey;
 136  135                          c += stridec;
 137  136                          i = 0;
 138  137                          if ( --n <= 0 )
 139  138                                  break;
 140  139                          goto LOOP0;
 141  140                  }
↓ open down ↓ 16 lines elided ↑ open up ↑
 158  157                          x += stridex;
 159  158                          y += stridey;
 160  159                          c += stridec;
 161  160                          i = 1;
 162  161                          if ( --n <= 0 )
 163  162                                  break;
 164  163                          goto LOOP1;
 165  164                  }
 166  165                  if ( hx1 < 0x3e400000 )
 167  166                  {
 168      -                        volatile int v = *x;
 169  167                          *c = 1.0;
 170  168                          *y = *x;
 171  169                          x += stridex;
 172  170                          y += stridey;
 173  171                          c += stridec;
 174  172                          i = 1;
 175  173                          if ( --n <= 0 )
 176  174                                  break;
 177  175                          goto LOOP1;
 178  176                  }
↓ open down ↓ 16 lines elided ↑ open up ↑
 195  193                          x += stridex;
 196  194                          y += stridey;
 197  195                          c += stridec;
 198  196                          i = 2;
 199  197                          if ( --n <= 0 )
 200  198                                  break;
 201  199                          goto LOOP2;
 202  200                  }
 203  201                  if ( hx2 < 0x3e400000 )
 204  202                  {
 205      -                        volatile int v = *x;
 206  203                          *c = 1.0;
 207  204                          *y = *x;
 208  205                          x += stridex;
 209  206                          y += stridey;
 210  207                          c += stridec;
 211  208                          i = 2;
 212  209                          if ( --n <= 0 )
 213  210                                  break;
 214  211                          goto LOOP2;
 215  212                  }
↓ open down ↓ 1331 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX