]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/fpu/e_log2l.S
Optimize libm
[thirdparty/glibc.git] / sysdeps / i386 / fpu / e_log2l.S
CommitLineData
e7fd8a39
UD
1/*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
4 * Public domain.
5 *
6 * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
7 */
8
9#include <machine/asm.h>
10
11#ifdef __ELF__
0ac5ae23 12 .section .rodata.cst8,"aM",@progbits,8
e7fd8a39
UD
13#else
14 .text
15#endif
0ac5ae23 16 .p2align 3
e7fd8a39
UD
17 ASM_TYPE_DIRECTIVE(one,@object)
18one: .double 1.0
19 ASM_SIZE_DIRECTIVE(one)
20 /* It is not important that this constant is precise. It is only
21 a value which is known to be on the safe side for using the
22 fyl2xp1 instruction. */
23 ASM_TYPE_DIRECTIVE(limit,@object)
24limit: .double 0.29
25 ASM_SIZE_DIRECTIVE(limit)
26
27
28#ifdef PIC
0ac5ae23 29# define MO(op) op##@GOTOFF(%edx)
e7fd8a39 30#else
0ac5ae23 31# define MO(op) op
e7fd8a39
UD
32#endif
33
34 .text
601d2942 35ENTRY(__ieee754_log2l)
e7fd8a39 36#ifdef PIC
fee732e5 37 LOAD_PIC_REG (dx)
e7fd8a39
UD
38#endif
39 fldl MO(one)
40 fldt 4(%esp) // x : 1
15daa639
UD
41 fxam
42 fnstsw
e7fd8a39 43 fld %st // x : x : 1
15daa639
UD
44 sahf
45