[BACK]Return to flt_rounds.S CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / arch / x86_64 / gen

Annotation of src/lib/libc/arch/x86_64/gen/flt_rounds.S, Revision 1.6

1.6     ! christos    1: /*     $NetBSD: flt_rounds.S,v 1.5 2011/09/29 22:55:45 christos Exp $  */
1.1       fvdl        2:
1.4       christos    3: #include <machine/asm.h>
                      4:
1.1       fvdl        5: /*
1.4       christos    6:  * 00 0 round to zero
                      7:  * 01 1 round to nearest
                      8:  * 10 2 round to positive infinity
                      9:  * 11 3 round to negative infinity
1.1       fvdl       10:  */
                     11:        .text
                     12:        _ALIGN_TEXT
                     13: ENTRY(__flt_rounds)
1.4       christos   14:        fnstcw  -4(%rsp)
1.6     ! christos   15:        movl    -4(%rsp), %ecx
        !            16:        shrl    $9, %ecx
        !            17:        andl    $6, %ecx
        !            18:        movl    $0x2d, %eax     /* 0x2d = 00.10.11.01 */
        !            19:        sarl    %cl, %eax       /* 0,1,2,3 -> 1,3,2,0 */
1.5       christos   20:        andl    $3, %eax
1.1       fvdl       21:        ret

CVSweb <webmaster@jp.NetBSD.org>