Print this page
5261 libm should stop using synonyms.h
5298 fabs is 0-sized, confuses dis(1) and others
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Gordon Ross <gwr@nexenta.com>


  22  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23  */
  24 /*
  25  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29         .file   "__reduction.s"
  30 
  31 /
  32 /    After argument reduction which returns n:
  33 /       n mod 4     sin(x)      cos(x)        tan(x)
  34 /     ----------------------------------------------------------
  35 /          0          S           C             S/C
  36 /          1          C          -S            -C/S
  37 /          2         -S          -C             S/C
  38 /          3         -C           S            -C/S
  39 /     ----------------------------------------------------------
  40 
  41 #include "libm.h"
  42 #include "libm_synonyms.h"
  43 #include "libm_protos.h"
  44 #undef fabs
  45 
  46         ENTRY(__reduction)
  47 #ifndef PIC
  48         movl    12(%esp),%eax           / load the high part of arg
  49 #else
  50         movl    16(%esp),%eax           / load the high part of arg
  51 #endif
  52         andl    $0x7fffffff,%eax        / clear sign
  53         cmpl    $0x3fe921fb,%eax        / Is |x| < pi/4 (= 0x3fe921fb54...) ?
  54         jbe     .L0
  55         cmpl    $0x7ff00000,%eax        / Is arg a NaN or an Inf ?
  56         jb      .L1
  57 .L0:
  58 #ifndef PIC
  59         fldl    8(%esp)                 / push arg
  60 #else
  61         fldl    12(%esp)                / push arg
  62 #endif
  63         fwait
  64         movl    $0,%eax                 / set n = 0




  22  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23  */
  24 /*
  25  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29         .file   "__reduction.s"
  30 
  31 /
  32 /    After argument reduction which returns n:
  33 /       n mod 4     sin(x)      cos(x)        tan(x)
  34 /     ----------------------------------------------------------
  35 /          0          S           C             S/C
  36 /          1          C          -S            -C/S
  37 /          2         -S          -C             S/C
  38 /          3         -C           S            -C/S
  39 /     ----------------------------------------------------------
  40 
  41 #include "libm.h"

  42 #include "libm_protos.h"

  43 
  44         ENTRY(__reduction)
  45 #ifndef PIC
  46         movl    12(%esp),%eax           / load the high part of arg
  47 #else
  48         movl    16(%esp),%eax           / load the high part of arg
  49 #endif
  50         andl    $0x7fffffff,%eax        / clear sign
  51         cmpl    $0x3fe921fb,%eax        / Is |x| < pi/4 (= 0x3fe921fb54...) ?
  52         jbe     .L0
  53         cmpl    $0x7ff00000,%eax        / Is arg a NaN or an Inf ?
  54         jb      .L1
  55 .L0:
  56 #ifndef PIC
  57         fldl    8(%esp)                 / push arg
  58 #else
  59         fldl    12(%esp)                / push arg
  60 #endif
  61         fwait
  62         movl    $0,%eax                 / set n = 0