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>


  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23  */
  24 /*
  25  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29         .file "ilogbf.s"
  30 
  31 #include "libm.h"
  32 LIBM_ANSI_PRAGMA_WEAK(ilogbf,function)
  33 #include "libm_synonyms.h"
  34 #include "xpg6.h"
  35 
  36         .data
  37         .align  8
  38 two23:  .long   0x4b000000              / 2**23
  39 
  40         ENTRY(ilogbf)
  41         movl    4(%esp),%eax            / eax <-- x
  42         testl   $0x7f800000,%eax        / is bexp(x) 0?
  43         jz      .bexp_0                 / jump if x is 0 or subnormal
  44                                         / here, biased exponent is non-zero
  45         andl    $0x7fffffff,%eax        / eax <-- abs(x)
  46         cmpl    $0x7f800000,%eax        / is bexp(x) 0xff?
  47         jae     .bexp_all_1             / jump if x is NaN or Inf
  48         shrl    $23,%eax                / eax <-- zero_xtnd(bexp(x))
  49         subl    $127,%eax               / unbias exponent by 127
  50         ret
  51 
  52 .bexp_all_1:
  53         movl    $0x7fffffff,%eax        / x is NaN or inf, so return 0x7fffffff




  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23  */
  24 /*
  25  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29         .file "ilogbf.s"
  30 
  31 #include "libm.h"
  32 LIBM_ANSI_PRAGMA_WEAK(ilogbf,function)

  33 #include "xpg6.h"
  34 
  35         .data
  36         .align  8
  37 two23:  .long   0x4b000000              / 2**23
  38 
  39         ENTRY(ilogbf)
  40         movl    4(%esp),%eax            / eax <-- x
  41         testl   $0x7f800000,%eax        / is bexp(x) 0?
  42         jz      .bexp_0                 / jump if x is 0 or subnormal
  43                                         / here, biased exponent is non-zero
  44         andl    $0x7fffffff,%eax        / eax <-- abs(x)
  45         cmpl    $0x7f800000,%eax        / is bexp(x) 0xff?
  46         jae     .bexp_all_1             / jump if x is NaN or Inf
  47         shrl    $23,%eax                / eax <-- zero_xtnd(bexp(x))
  48         subl    $127,%eax               / unbias exponent by 127
  49         ret
  50 
  51 .bexp_all_1:
  52         movl    $0x7fffffff,%eax        / x is NaN or inf, so return 0x7fffffff