Print this page
patch mul-ste

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/amd64/fp/_base_il.c
          +++ new/usr/src/lib/libc/amd64/fp/_base_il.c
↓ open down ↓ 31 lines elided ↑ open up ↑
  32   32  
  33   33  #define CSR_DEFAULT 0x1f80
  34   34  
  35   35  /* The following should be coded as inline expansion templates.  */
  36   36  
  37   37  /*
  38   38   * Multiplies two normal or subnormal doubles, returns result and exceptions.
  39   39   */
  40   40  double
  41   41  __mul_set(double x, double y, int *pe) {
  42      -        extern void _putmxcsr(), _getmxcsr();
  43      -        int csr;
       42 +        int csr = CSR_DEFAULT;
  44   43          double z;
  45   44  
  46      -        _putmxcsr(CSR_DEFAULT);
  47      -        z = x * y;
  48      -        _getmxcsr(&csr);
       45 +        __asm__ __volatile__(
       46 +            "ldmxcsr    %4\n"
       47 +            "mulsd      %2,%3\n"
       48 +            "stmxcsr    %0\n"
       49 +            : "=m" (csr), "=C" (z)
       50 +            : "C" (x), "C" (y), "m" (csr));
       51 +
  49   52          if ((csr & 0x3f) == 0) {
  50   53                  *pe = 0;
  51   54          } else {
  52   55                  /* Result may not be exact. */
  53   56                  *pe = 1;
  54   57          }
  55   58          return (z);
  56   59  }
  57   60  
  58   61  /*
↓ open down ↓ 49 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX