(_ISwbit): Protext use of parameter with parentheses.
[glibc.git] / sysdeps / libm-i387 / s_frexpl.S
blobe3019ced6d3934faa83491efeaed043fb75e77e0
1 /* ix87 specific frexp implementation for long double.
2    Copyright (C) 1997 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Library General Public License as
8    published by the Free Software Foundation; either version 2 of the
9    License, or (at your option) any later version.
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Library General Public License for more details.
16    You should have received a copy of the GNU Library General Public
17    License along with the GNU C Library; see the file COPYING.LIB.  If not,
18    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
21 #include <machine/asm.h>
23 #ifdef __ELF__
24         .section .rodata
25 #else
26         .text
27 #endif
29         .align ALIGNARG(4)
30         ASM_TYPE_DIRECTIVE(two64,@object)
31 two64:  .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
32         ASM_SIZE_DIRECTIVE(two64)
34 #ifdef PIC
35 #define MO(op) op##@GOTOFF(%edx)
36 #else
37 #define MO(op) op
38 #endif
40         .text
41 ENTRY(__frexpl)
42         movl    4(%esp), %ecx
43         movl    12(%esp), %eax
44         orl     8(%esp), %ecx
45         movl    %eax, %edx
46         andl    $0x7fff, %eax
47         orl     %eax, %ecx
48         jz      1f
49         xorl    %ecx, %ecx
50         cmpl    $0x7fff, %eax
51         je      1f
53         cmpl    $0, %eax
54         je      2f
56         fldt    4(%esp)
57 #ifdef  PIC
58         call    3f
59 3:      popl    %edx
60         addl    $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx
61 #endif
62         fmull   MO(two64)       /* It's not necessary to use a 80bit factor */
63         movl    $-64, %ecx
64         fstpt   4(%esp)
65         movl    12(%esp), %eax
66         movl    %eax, %edx
67         andl    $0x7fff, %eax
69 2:      andl    $0x8000, %edx
70         subl    $16382, %eax
71         orl     $0x3ffe, %edx
72         addl    %eax, %ecx
73         movl    %edx, 12(%esp)
75         /* Store %ecx in the variable pointed to by the second argument,
76            get the factor from the stack and return.  */
77 1:      movl    16(%esp), %eax
78         fldt    4(%esp)
79         movl    %ecx, (%eax)
80         ret
81 END(__frexpl)
82 weak_alias (__frexpl, frexpl)