1/*
2 * Public domain.
3 */
4
5#include <machine/asm.h>
6#include <libm-alias-finite.h>
7
8 .section .rodata
9
10 .align ALIGNARG(4)
11 .type zero_nan,@object
12zero_nan:
13 .double 0.0
14nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
15 .byte 0, 0, 0, 0, 0, 0, 0, 0x80
16 .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
17 ASM_SIZE_DIRECTIVE(zero_nan)
18
19
20#ifdef PIC
21# define MO(op) op##@GOTOFF(%ecx)
22# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
23#else
24# define MO(op) op
25# define MOX(op,x,f) op(,x,f)
26#endif
27
28 .text
29ENTRY(__ieee754_scalbl)
30 fldt 16(%esp)
31 fxam
32 fnstsw
33 fldt 4(%esp)
34 andl $0x4700, %eax
35 cmpl $0x0700, %eax
36 je 1f
37 andl $0x4500, %eax
38 cmpl $0x0100, %eax
39 je 2f
40 fxam
41 fnstsw
42 andl $0x4500, %eax
43 cmpl $0x0100, %eax
44 je 2f
45 fld %st(1)
46 frndint
47 fcomp %st(2)
48 fnstsw
49 sahf
50 jne 4f
51 fscale
52 fstp %st(1)
53 ret
54
55 /* y is -inf */
561: fxam
57#ifdef PIC
58 LOAD_PIC_REG (cx)
59#endif
60 fnstsw
61 movl 12(%esp), %edx
62 shrl $5, %eax
63 fstp %st
64 fstp %st
65 andl $0x8000, %edx
66 andl $0x0228, %eax
67 cmpl $0x0028, %eax
68 je 4f
69 andl $8, %eax
70 shrl $11, %edx
71 addl %edx, %eax
72 fldl MOX(zero_nan, %eax, 1)
73 ret
74
75 /* The result is NaN; raise an exception for sNaN arguments. */
762: faddp
77 ret
78
79 /* Return NaN and raise the invalid exception. */
804: fstp %st
81 fstp %st
82 fldz
83 fdiv %st
84 ret
85END(__ieee754_scalbl)
86libm_alias_finite (__ieee754_scalbl, __scalbl)
87

source code of glibc/sysdeps/i386/fpu/e_scalbl.S