Remove support in configure for unsupported architectures
[glibc.git] / sysdeps / ia64 / fpu / libm_frexp4l.S
blob447c574bfc8019ba38008f74a3d9ce620d4ad968
1 .file "libm_frexp_4l.s"
3 // Copyright (C) 2000, 2001, Intel Corporation
4 // All rights reserved.
5 //
6 // Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
7 // and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are
11 // met:
13 // * Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
16 // * Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
20 // * The name of Intel Corporation may not be used to endorse or promote
21 // products derived from this software without specific prior written
22 // permission.
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
28 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
32 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
33 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 // Intel Corporation is the author of this code, and requests that all
37 // problem reports or change requests be submitted to it directly at
38 // http://developer.intel.com/opensource.
40 // History
41 //==============================================================
42 // 3/20/00: Initial version
43 // 6/01/00: Fixed bug when x a double-extended denormal
44 // 12/08/00 Corrected label on .endp
46 // API
47 //==============================================================
48 // long double frexpl(long double x, int* y)
49 // long double __libm_frexp_4l(long double x, int* y)
50 //   where int* y is a 32-bit integer
52 // Overview of operation
53 //==============================================================
54 // break a floating point x number into fraction and an exponent
55 // The fraction is returned as a long double
56 // The exponent is returned as an integer pointed to by y
57 //    This is a true (not a biased exponent) but 0fffe is subtracted
58 //    as a bias instead of 0xffff. This is because the fraction returned
59 //    is between 0.5 and 1.0, not the expected IEEE range.
61 // The fraction is 0.5 <= fraction < 1.0
63 // Registers used
64 //==============================================================
66 // general registers:
67 // r14  exponent bias for x negative
68 // r15  exponent bias for x positive
69 // r16  signexp of x
70 // r17  exponent mask
71 // r18  exponent of x
72 // r19  exponent result
73 // r20  signexp of 2^64
74 // r32-33  on input contains the 80-bit IEEE long double that is in f8
75 // r34  on input pointer to 32-bit integer for exponent
77 // predicate registers:
78 // p6   set if x is Nan, zero, or infinity
79 // p7   set if x negative
80 // p8   set if x positive
81 // p9   set if x double-extended denormal
83 // floating-point registers:
84 // f8  input, output
85 // f9  normalized x
86 // f10 signexp for significand result for x positive
87 // f11 signexp for significand result for x negative
88 // f12 2^64
90 #include "libm_support.h"
92 .align 32
93 .global __libm_frexp_4l#
95 .section .text
96 .proc  __libm_frexp_4l#
97 .align 32
99 __libm_frexp_4l:
101 // Set signexp for significand result for x>0
102 // If x is a NaN, zero, or infinity, return it.
103 // Put 0 in the int pointer.
104 // x NAN, ZERO, INFINITY?
105 // Set signexp for significand result for x<0
106 { .mfi
107 (p0)    mov         r15 = 0x0fffe
108 (p0)    fclass.m.unc p6,p0 = f8, 0xe7
109 (p0)    mov         r14 = 0x2fffe
111 // Form signexp of 2^64 in case x double-extended denormal
112 // Save the normalized value of input in f9
113 // The normalization also sets fault flags and takes faults if necessary
114 { .mfi
115 (p0)    mov         r20 = 0x1003f
116 (p0)    fnorm       f9 = f8
117         nop.i 999 ;;
120 // Move signexp for significand result for x>0 to FP reg
121 // Form 2^64 in case x double-extended denormal
122 { .mmi
123 (p0)    setf.exp    f10 = r15
124 (p0)    setf.exp    f12 = r20
125         nop.i 999 ;;
128 // Move signexp for significand result for x<0 to FP reg
129 // If x NAN, ZERO, INFINITY, set *y=0 as a 32-bit integer, and exit
130 { .mmb
131 (p0)    setf.exp    f11 = r14
132 (p6)    st4         [r34] = r0
133 (p6)    br.ret.spnt b0 ;;
136 // Form exponent mask
137 // p7 if x<0, else p8
138 { .mfi
139 (p0)    mov         r17 = 0x1ffff
140 (p0)    fcmp.lt.unc p7,p8 = f8,f0
141         nop.i 999 ;;
144 // Test for fnorm(x) denormal, means x double-extended denormal
145 { .mfi
146         nop.m 999
147 (p0)    fclass.m.unc p9,p0 = f9, 0x0b
148         nop.i 999 ;;
151 // If x double-extended denormal add 64 to exponent bias for scaling
152 // If x double-extended denormal multiply x * 2^64 which is normal
153 { .mfi
154 (p9)    add         r15 = 64, r15
155 (p9)    fmpy        f9 = f9, f12
156         nop.i 999 ;;
159 // true exponent stored to int pointer
160 // the bias is treated as 0xfffe instead of
161 // normal 0xffff because we want the significand
162 // to be in the range <=0.5 sig < 1.0
163 // Store the value of the exponent at the pointer in r34
165 // If x>0 form significand result
166 { .mfi
167         nop.m 999
168 (p8)    fmerge.se   f8 = f10,f9
169         nop.i 999  ;;
172 // Get signexp of normalized x
173 // If x<0 form significand result
174 { .mfi
175 (p0)    getf.exp    r16 = f9
176 (p7)    fmerge.se   f8 = f11,f9
177         nop.i 999  ;;
180 // Get exp of normalized x
181 // Subtract off bias to get true exponent of x
182 { .mmi
183 (p0)    and         r18 = r17,r16 ;;
184 (p0)    sub         r19 = r18,r15
185         nop.i 999  ;;
188 // Store int y as a 32-bit integer
189 // Make the value a long double
190 { .mfb
191 (p0)    st4         [r34] = r19
192 (p0)    fnorm       f8 = f8
193 (p0)    br.ret.sptk b0 ;;
196 .endp __libm_frexp_4l
197 ASM_SIZE_DIRECTIVE(__libm_frexp_4l)
198 strong_alias(__libm_frexp_4l, _GI___libm_frexp_4l)