Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1906 | serge | 1 | /* |
2 | * Written by J.T. Conklin |
||
3 | * Public domain. |
||
4 | */ |
||
5 | |||
6 | .file "ilogbf.S" |
||
7 | .text |
||
8 | .align 4 |
||
9 | .globl _ilogbf |
||
10 | .def _ilogbf; .scl 2; .type 32; .endef |
||
11 | _ilogbf: |
||
12 | flds 4(%esp) |
||
13 | /* I added the following ugly construct because ilogb(+-Inf) is |
||
14 | required to return INT_MAX in ISO C99. |
||
15 | -- jakub@redhat.com. */ |
||
16 | fxam /* Is NaN or +-Inf? */ |
||
17 | fstsw %ax |
||
18 | movb $0x45, %dh |
||
19 | andb %ah, %dh |
||
20 | cmpb $0x05, %dh |
||
21 | je 1f /* Is +-Inf, jump. */ |
||
22 | |||
23 | fxtract |
||
24 | pushl %eax |
||
25 | fstp %st |
||
26 | |||
27 | fistpl (%esp) |
||
28 | fwait |
||
29 | popl %eax |
||
30 | |||
31 | ret |
||
32 | |||
33 | 1: fstp %st |
||
34 | movl $0x7fffffff, %eax |
||
35 | ret |