1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  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 2005 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29         .file "ieee_funcl.s"
  30 
  31 #include "libm.h"
  32 LIBM_ANSI_PRAGMA_WEAK(isinfl,function)
  33 LIBM_ANSI_PRAGMA_WEAK(isnormall,function)
  34 LIBM_ANSI_PRAGMA_WEAK(issubnormall,function)
  35 LIBM_ANSI_PRAGMA_WEAK(iszerol,function)
  36 LIBM_ANSI_PRAGMA_WEAK(signbitl,function)
  37 #include "libm_synonyms.h"
  38 
  39         ENTRY(isinfl)
  40         movl    16(%rsp),%eax           / ax <-- sign and bexp of x 
  41         notl    %eax
  42         andq    $0x7fff,%rax
  43         jz      .L6
  44         movq    $0,%rax
  45 .not_inf:
  46         ret
  47 
  48 .L6:                                    / here, (eax) = 0.0
  49         movl    12(%rsp),%ecx
  50         xorl    $0x80000000,%ecx        / handle unsupported implicitly
  51         orl     8(%rsp), %ecx
  52         jnz     .not_inf
  53         movq    $1,%rax
  54         ret
  55         .align  16
  56         SET_SIZE(isinfl)
  57 
  58         ENTRY(isnormall)
  59                                         / TRUE iff (x is finite, but
  60                                         /           neither subnormal nor zero)
  61                                         /      iff (msb(sgnfcnd(x) /= 0 
  62                                         /           &  0 < bexp(x) < 0x7fff)
  63         movl    12(%rsp),%eax           / eax <-- hi_32(sgnfcnd(x))
  64         movq    $0x80000000,%r8
  65         andq    %r8,%rax                / eax[31]  <-- msb(sgnfcnd(x)),
  66                                         / rest_of(eax) <-- 0
  67         jz      .L8                     / jump iff msb(sgnfcnd(x)) = 0
  68         movl    16(%rsp),%eax           / ax <-- sign and bexp of x
  69         notl    %eax                    / ax[0..14] <-- not(bexp(x))
  70         andq    $0x7fff,%rax            / eax  <-- zero_xtnd(not(bexp(x)))
  71         jz      .L8                     / jump  iff bexp(x) = 0x7fff or 0
  72         xorq    $0x7fff,%rax            / treat pseudo-denormal as subnormal
  73         jz      .L8
  74         movq    $1,%rax
  75 .L8:
  76         ret
  77         .align  16
  78         SET_SIZE(isnormall)
  79 
  80         ENTRY(issubnormall)
  81                                         / TRUE iff (bexp(x) = 0 &
  82                                         / msb(sgnfcnd(x)) = 0 & frac(x) /= 0)
  83         movl    12(%rsp),%eax           / eax <-- hi_32(sgnfcnd(x))
  84         testl   $0x80000000,%eax        / eax[31] = msb(sgnfcnd(x));
  85                                         / set ZF if it is 0.
  86         jz      .may_be_subnorm         / jump iff msb(sgnfcnd(x)) = 0
  87 .not_subnorm:
  88         movq    $0,%rax
  89         ret
  90 .may_be_subnorm:
  91         testl   $0x7fff,16(%rsp)        / set ZF iff bexp(x)  = 0
  92         jnz     .not_subnorm            / jump   iff bexp(x) /= 0
  93         orl     8(%rsp),%eax            / (eax) = 0 iff sgnfcnd(x) = 0
  94         jz      .not_subnorm
  95         movq    $1,%rax
  96         ret
  97         .align  16
  98         SET_SIZE(issubnormall)
  99 
 100         ENTRY(iszerol)
 101         movl    16(%rsp),%eax           / ax <-- sign and bexp of x
 102         andl    $0x7fff,%eax            / eax <-- zero_xtnd(bexp(x))
 103         jz      .may_be_zero            / jump iff bexp(x) = 0
 104 .not_zero:
 105         movq    $0,%rax
 106         ret
 107 .may_be_zero:                           / here, (eax) = 0
 108         orl     12(%rsp),%eax           / is hi_32(sgnfcnd(x)) = 0?
 109         jnz     .not_zero               / jump iff hi_32(sgnfcnd(x)) /= 0
 110         orl     8(%rsp),%eax            / is lo_32(sgnfcnd(x)) = 0?
 111         jnz     .not_zero               / jump iff lo_32(sgnfcnd(x)) /= 0
 112         movq    $1,%rax
 113         ret
 114         .align  16
 115         SET_SIZE(iszerol)
 116 
 117         ENTRY(signbitl)
 118         movl    16(%rsp),%eax           / eax[15] <-- sign_bit(x)
 119         shrl    $15,%eax                / eax <-- zero_xtnd(sign_bit(x))
 120         andq    $1,%rax
 121         ret
 122         .align  16
 123         SET_SIZE(signbitl)