Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libmvec/common/__vpow.c
          +++ new/usr/src/lib/libmvec/common/__vpow.c
↓ open down ↓ 538 lines elided ↑ open up ↑
 539  539                  if ( sy )                                                                       \
 540  540                          *pz = DONE / *pz;                                                       \
 541  541          }                                                                                       \
 542  542          else                                                                                    \
 543  543                  *pz = (sx) ? DZERO / DZERO : DONE;                                              \
 544  544          RET_SC(I)                                                                               \
 545  545  }                                                                                               \
 546  546  yisint##I = 0;  /* Y - non-integer */                                                           \
 547  547  exp = hy >> 20; /* Y exponent */                                                                \
 548  548  ull_y0 &= LMMANT;                                                                               \
 549      -ull_x##I = ull_y0 | LDONE;                                                                      \
      549 +ull_x##I = (ull_y0 | LDONE);                                                                    \
 550  550  x##I = *(double*)&ull_x##I;                                                                     \
 551      -ull_ax##I = (ull_x##I + LMROUND) & LMHI20;                                                      \
      551 +ull_ax##I = ((ull_x##I + LMROUND) & LMHI20);                                                    \
 552  552  ax##I = *(double*)&ull_ax##I;                                                                   \
 553  553  if ( hx >= 0x7ff00000 || exp >= 0x43e )         /* X=Inf,Nan or |Y|>2^63,Inf,Nan */             \
 554  554  {                                                                                               \
 555  555          y0 = *px;                                                                               \
 556  556          if ( hx > 0x7ff00000 || (hx == 0x7ff00000 && lx != 0) ||                                \
 557  557          hy > 0x7ff00000 || (hy == 0x7ff00000 && ly != 0) )      /* |X| or |Y| = Nan */          \
 558  558                  RETURN (I, y0 + *py)                                                            \
 559  559          if ( hy == 0x7ff00000 && (ly == 0) )                    /* |Y| = Inf */                 \
 560  560          {                                                                                       \
 561  561                  if ( hx == 0x3ff00000 && (lx == 0) )            /* +-1 ** +-Inf */              \
↓ open down ↓ 50 lines elided ↑ open up ↑
 612  612                                  *pz = DONE / *pz;                                               \
 613  613                  }                                                                               \
 614  614                  else                                                                            \
 615  615                  {                                                                               \
 616  616                          y0 = ( (hx < 0x3ff00000) != sy ) ? _TINY : _HUGE;                       \
 617  617                          *pz = y0 * y0;                                                          \
 618  618                  }                                                                               \
 619  619                  RET_SC(I)                                                                       \
 620  620          }                                                                                       \
 621  621  }                                                                                               \
 622      -if ( sx || (hx | lx) == 0 )     /* X <= 0      */                                               \
      622 +if ( (sx || (hx | lx)) == 0 )   /* X <= 0      */                                               \
 623  623  {                                                                                               \
 624  624          if ( exp >= 0x434 )     /* |Y| >= 2^53 */                                               \
 625  625                  yisint##I = 2;  /* Y - even    */                                               \
 626  626          else                                                                                    \
 627  627          {                                                                                       \
 628  628                  if ( exp >= 0x3ff )     /* |Y| >= 1    */                                       \
 629  629                  {                                                                               \
 630  630                          if ( exp > (20 + 0x3ff) )                                               \
 631  631                          {                                                                       \
 632  632                                  i0 = ly >> (52 - (exp - 0x3ff));                                \
↓ open down ↓ 22 lines elided ↑ open up ↑
 655  655  }                                                                                               \
 656  656  exp = (hx >> 20);                                                                               \
 657  657  exp##I = exp - 2046;                                                                            \
 658  658  py##I = py;                                                                                     \
 659  659  pz##I = pz;                                                                                     \
 660  660  ux##I = x##I + ax##I;                                                                           \
 661  661  if ( !exp )                                                                                     \
 662  662  {                                                                                               \
 663  663          ax##I = (double) ull_y0;                                                                \
 664  664          ull_ax##I = *(unsigned long long*)&ax##I;                                               \
 665      -        ull_x##I = ull_ax##I & LMMANT | LDONE;                                                  \
      665 +        ull_x##I = ((ull_ax##I & LMMANT) | LDONE);                                                      \
 666  666          x##I = *(double*)&ull_x##I;                                                             \
 667  667          exp##I = ((unsigned int*) & ull_ax##I)[0];                                              \
 668  668          exp##I = (exp##I >> 20) - (2046 + 1023 + 51);                                           \
 669      -        ull_ax##I = ull_x##I + LMROUND & LMHI20;                                                \
      669 +        ull_ax##I = (ull_x##I + (LMROUND & LMHI20));                                            \
 670  670          ax##I = *(double*)&ull_ax##I;                                                           \
 671  671          ux##I = x##I + ax##I;                                                                   \
 672  672  }                                                                                               \
 673  673  ull_x##I = *(unsigned long long *)&ux##I;                                                       \
 674  674  hx##I = HI(&ull_ax##I);                                                                 \
 675  675  yd##I = DONE / ux##I;
 676  676  
 677  677  void
 678  678  __vpow( int n, double * restrict px, int stridex, double * restrict py,
 679  679          int stridey, double * restrict pz, int stridez )
 680  680  {
 681      -        double                  *py0, *py1, *py2;
 682      -        double                  *pz0, *pz1, *pz2;
 683      -        double                  y0, yd0, u0, s0, s_l0, m_h0;
 684      -        double                  y1, yd1, u1, s1, s_l1, m_h1;
      681 +        double                  *py0 = 0, *py1 = 0, *py2;
      682 +        double                  *pz0 = 0, *pz1 = 0, *pz2;
      683 +        double                  y0, yd0 = 0.0L, u0, s0, s_l0, m_h0;
      684 +        double                  y1, yd1 = 0.0L, u1, s1, s_l1, m_h1;
 685  685          double                  y2, yd2, u2, s2, s_l2, m_h2;
 686      -        double                  ax0, x0, s_h0, ux0;
 687      -        double                  ax1, x1, s_h1, ux1;
      686 +        double                  ax0 = 0.0L, x0 = 0.0L, s_h0, ux0;
      687 +        double                  ax1 = 0.0L, x1 = 0.0L, s_h1, ux1;
 688  688          double                  ax2, x2, s_h2, ux2;
 689  689          int                     eflag0, gflag0, ind0, i0;
 690  690          int                     eflag1, gflag1, ind1, i1;
 691  691          int                     eflag2, gflag2, ind2, i2;
 692      -        int                     hx0, yisint0, exp0;
 693      -        int                     hx1, yisint1, exp1;
      692 +        int                     hx0 = 0, yisint0 = 0, exp0 = 0;
      693 +        int                     hx1 = 0, yisint1 = 0, exp1 = 0;
 694  694          int                     hx2, yisint2, exp2;
 695  695          int                     exp, i = 0;
 696  696          unsigned                hx, lx, sx, hy, ly, sy;
 697  697          unsigned long long      ull_y0, ull_x0, ull_x1, ull_x2, ull_ax0, ull_ax1, ull_ax2;
 698  698          unsigned long long      LDONE = ((unsigned long long*)LCONST)[1];       /* 1.0                                  */
 699  699          unsigned long long      LMMANT = ((unsigned long long*)LCONST)[4];      /* 0x000fffffffffffff                   */
 700  700          unsigned long long      LMROUND = ((unsigned long long*)LCONST)[5];     /* 0x0000080000000000                   */
 701  701          unsigned long long      LMHI20 = ((unsigned long long*)LCONST)[6];      /* 0xfffff00000000000                   */
 702  702          double                  DONE = ((double*)LCONST)[1];                    /* 1.0                                  */
 703  703          double                  DZERO = ((double*)LCONST)[7];                   /* 0.0                                  */
↓ open down ↓ 418 lines elided ↑ open up ↑
1122 1122  #define KA3     ((double*)LCONST)[9]                    /* 9.61796693925765549423e-01*256       */
1123 1123  #define KA1_LO  ((double*)LCONST)[10]                   /* 1.41052154268147309568e-05*256       */
1124 1124  #define KA1_HI  ((double*)LCONST)[11]                   /* 2.8853759765625e+00*256              */
1125 1125  #define KA1     ((double*)LCONST)[12]                   /* 2.885390081777926774e+00*256         */
1126 1126  
1127 1127  
1128 1128  static void
1129 1129  __vpowx( int n, double * restrict px, double * restrict py,
1130 1130          int stridey, double * restrict pz, int stridez )
1131 1131  {
1132      -        double                  *py0, *py1, *py2;
1133      -        double                  *pz0, *pz1, *pz2;
     1132 +        double                  *py0, *py1 = 0, *py2;
     1133 +        double                  *pz0, *pz1 = 0, *pz2;
1134 1134          double                  ux0, y0, yd0, u0, s0;
1135 1135          double                  y1, yd1, u1, s1;
1136 1136          double                  y2, yd2, u2, s2;
1137 1137          double                  yr, s_h0, s_l0, m_h0, x0, ax0;
1138 1138          unsigned long long      ull_y0, ull_x0, ull_x1, ull_x2, ull_ax0;
1139 1139          int                     eflag0, gflag0, ind0, i0, exp0;
1140 1140          int                     eflag1, gflag1, ind1, i1;
1141 1141          int                     eflag2, gflag2, ind2, i2;
1142 1142          int                     i = 0;
1143 1143          unsigned                hx, hx0, hy, ly, sy;
↓ open down ↓ 4 lines elided ↑ open up ↑
1148 1148          double                  LTHRESH = ((double*)LCONST)[14];                /* -275200.0                    */
1149 1149          double                  KB5 = ((double*)LCONST)[15];                    /*  1.21195555854068860923e-15  */
1150 1150          double                  KB4 = ((double*)LCONST)[16];                    /*  2.23939573811855104311e-12  */
1151 1151          double                  KB3 = ((double*)LCONST)[17];                    /*  3.30830268126604677436e-09  */
1152 1152          double                  KB2 = ((double*)LCONST)[18];                    /*  3.66556559691003767877e-06  */
1153 1153          double                  KB1 = ((double*)LCONST)[19];                    /*  2.70760617406228636578e-03  */
1154 1154  
1155 1155          /* perform s_h + yr = 256*log2(x) */
1156 1156          ull_y0 = *(unsigned long long*)px;
1157 1157          hx = HI(px);
1158      -        ull_x0 = ull_y0 & LMMANT | LDONE;
     1158 +        ull_x0 = (ull_y0 & LMMANT) | LDONE;
1159 1159          x0 = *(double*)&ull_x0;
1160 1160          exp0 = (hx >> 20) - 2046;
1161      -        ull_ax0 = ull_x0 + LMROUND & LMHI20;
     1161 +        ull_ax0 = ull_x0 + (LMROUND & LMHI20);
1162 1162          ax0 = *(double*)&ull_ax0;
1163 1163          hx0 = HI(&ax0);
1164 1164          ux0 = x0 + ax0;
1165 1165          yd0 = DONE / ux0;
1166 1166          u0 = x0 - ax0;
1167 1167          s0 = u0 * yd0;
1168 1168          LO(&ux0) = 0;
1169 1169          y0 = s0 * s0;
1170 1170          s_h0 = s0;
1171 1171          LO(&s_h0) = 0;
↓ open down ↓ 220 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX