Annotation of coherent/b/lib/libc/crt/i386/_fxam.s, revision 1.1.1.1

1.1       root        1: //////////
                      2: / libc/crt/i386/_fxam.s
                      3: / i386 C runtime library.
                      4: / IEEE software floating point support.
                      5: //////////
                      6: 
                      7: //////////
                      8: / int _fxam(double d)
                      9: / Return a value indicating the type of d,
                     10: / corresponding to the return value of the "fxam" opcode, as follows:
                     11: /      1       + NAN
                     12: /      3       - NAN
                     13: /      4       + Normal
                     14: /      5       + Infinity
                     15: /      6       - Normal
                     16: /      7       - Infinity
                     17: /      8       + 0
                     18: /      10      - 0
                     19: /      12      + Denormal
                     20: /      14      - Denormal
                     21: //////////
                     22: 
                     23: d      .equ    4
                     24: EXPMASK        .equ    0x7FF00000
                     25: MANMASK        .equ    0x000FFFFF
                     26: 
                     27:        .globl  _fxam
                     28: 
                     29: _fxam:
                     30:        movl    %edx, d+4(%esp)
                     31:        movl    %eax, d(%esp)           / d to EDX:EAX
                     32:        movl    %ecx, %edx
                     33:        andl    %ecx, $MANMASK          / extract hi mantissa dword
                     34:        orl     %eax, %ecx              / EAX nonzero if any mantissa bits set
                     35:        movl    %ecx, %edx
                     36:        andl    %ecx, $EXPMASK          / extract exponent in ECX
                     37:        jz      ?zeroexp
                     38:        cmpl    %ecx, $EXPMASK
                     39:        jz      ?maxexp
                     40:        movl    %eax, $4                / arg is normal 
                     41: ?setsign:
                     42:        orl     %edx, %edx
                     43:        jns     ?L0                     / arg positive, return value from EAX
                     44:        addl    %eax, $2                / bump result by 2 for negative arg
                     45: ?L0:
                     46:        ret
                     47: 
                     48: ?zeroexp:                              / exp is 0, arg is 0.0 or denormal
                     49:        orl     %eax, %eax              / check if any mantissa bits set
                     50:        movl    %eax, $8
                     51:        jz      ?setsign                / arg is zero
                     52:        movl    %eax, $12               / arg is denormal
                     53:        jmp     ?setsign
                     54: 
                     55: ?maxexp:                               / exp is max, arg is infinity or NaN
                     56:        orl     %eax, %eax              / check if any mantissa bits set
                     57:        movl    %eax, $5
                     58:        jz      ?setsign                / arg is infinity
                     59:        movl    %eax, $1                / arg is NaN
                     60:        jmp     ?setsign
                     61: 
                     62: / end of libc/crt/i386/_fxam.s

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.