Print this page
5632 libm's use of _sse_hw is wrong and unnecessary (in that order)


  33 #include <string.h>
  34 #include <signal.h>
  35 #include <siginfo.h>
  36 #include <ucontext.h>
  37 #include <thread.h>
  38 #include <math.h>
  39 #if defined(__SUNPRO_C)
  40 #include <sunmath.h>
  41 #endif
  42 #include <fenv.h>
  43 #include "fex_handler.h"
  44 #include "fenv_inlines.h"
  45 
  46 #if defined(__amd64)
  47 #define test_sse_hw     1
  48 #else
  49 /*
  50  * The following variable lives in libc on Solaris 10, where it
  51  * gets set to a nonzero value at startup time on systems with SSE.
  52  */
  53 int _sse_hw = 0;
  54 #pragma weak _sse_hw
  55 #define test_sse_hw     &_sse_hw && _sse_hw
  56 #endif
  57 
  58 static int accrued = 0;
  59 static thread_key_t accrued_key;
  60 static mutex_t accrued_key_lock = DEFAULTMUTEX;
  61 
  62 int *
  63 __fex_accrued()
  64 {
  65         int             *p;
  66 
  67         if (thr_main())
  68                 return &accrued;
  69         else {
  70                 p = NULL;
  71                 mutex_lock(&accrued_key_lock);
  72                 if (thr_getspecific(accrued_key, (void **)&p) != 0 &&
  73                         thr_keycreate(&accrued_key, free) != 0) {
  74                         mutex_unlock(&accrued_key_lock);
  75                         return NULL;




  33 #include <string.h>
  34 #include <signal.h>
  35 #include <siginfo.h>
  36 #include <ucontext.h>
  37 #include <thread.h>
  38 #include <math.h>
  39 #if defined(__SUNPRO_C)
  40 #include <sunmath.h>
  41 #endif
  42 #include <fenv.h>
  43 #include "fex_handler.h"
  44 #include "fenv_inlines.h"
  45 
  46 #if defined(__amd64)
  47 #define test_sse_hw     1
  48 #else
  49 /*
  50  * The following variable lives in libc on Solaris 10, where it
  51  * gets set to a nonzero value at startup time on systems with SSE.
  52  */
  53 extern int _sse_hw;
  54 #define test_sse_hw     _sse_hw

  55 #endif
  56 
  57 static int accrued = 0;
  58 static thread_key_t accrued_key;
  59 static mutex_t accrued_key_lock = DEFAULTMUTEX;
  60 
  61 int *
  62 __fex_accrued()
  63 {
  64         int             *p;
  65 
  66         if (thr_main())
  67                 return &accrued;
  68         else {
  69                 p = NULL;
  70                 mutex_lock(&accrued_key_lock);
  71                 if (thr_getspecific(accrued_key, (void **)&p) != 0 &&
  72                         thr_keycreate(&accrued_key, free) != 0) {
  73                         mutex_unlock(&accrued_key_lock);
  74                         return NULL;