~ubuntu-branches/ubuntu/utopic/eglibc/utopic

« back to all changes in this revision

Viewing changes to sysdeps/ia64/fpu/s_modff.S

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-10-26 05:14:58 UTC
  • mfrom: (1.5.1) (4.4.22 experimental)
  • Revision ID: package-import@ubuntu.com-20121026051458-oryotr4i03ob5pab
Tags: 2.16-0ubuntu1
* Merge with unreleased 2.16 in Debian experimental, remaining changes:
  - Drop the Breaks line from libc6, which refers to a Debian transition
  - Remove the libc6 recommends on libc6-i686, which we don't build
  - Enable libc6{,-dev}-armel on armhf and libc6{-dev}-armhf on armel
  - Ship update-locale and validlocale in /usr/sbin in libc-bin
  - Don't build locales or locales-all in Ubuntu, we rely on langpacks
  - Heavily mangle the way we do service restarting on major upgrades
  - Use different MIN_KERNEL_SUPPORTED versions than Debian, due to
    buildd needs.  This should be universally bumped to 3.2.0 once all
    our buildds (including the PPA guests) are running precise kernels
  - Build i386 variants as -march=i686, build amd64 with -O3, and build
    ppc64 variants (both 64-bit and 32-bit) with -O3 -fno-tree-vectorize
  - Re-enable unsubmitted-ldconfig-cache-abi.diff and rebuild the cache
    on upgrades from previous versions that used a different constant
  - debian/patches/any/local-CVE-2012-3406.diff: switch to malloc when
    array grows too large to handle via alloca extension (CVE-2012-3406)
  - Build generic i386/i686 flavour with -mno-tls-direct-seg-refs
* Changes added/dropped with this merge while reducing our delta:
  - Stop building glibc docs from the eglibc source, and instead make
    the glibc-docs stub have a hard dependency on glibc-doc-reference
  - Remove outdated conflicts against ancient versions of ia32-libs
  - Drop the tzdata dependency from libc6, it's in required and minimal
  - Use gcc-4.7/g++-4.7 by default on all our supported architectures
  - Save our historical changelog as changelog.ubuntu in the source
  - Drop nscd's libaudit build-dep for now, as libaudit is in universe
  - Drop the unnecessary Breaks from libc6 to locales and locales-all
  - Ship xen's ld.so.conf.d snippet as /etc/ld.so.conf.d/libc6-xen.conf
* Disable hard failures on the test suite for the first upload to raring

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.file "modff.s"
2
 
 
3
 
 
4
 
// Copyright (c) 2000 - 2003, Intel Corporation
5
 
// All rights reserved.
6
 
//
7
 
// Contributed 2000 by the Intel Numerics Group, 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:
12
 
//
13
 
// * Redistributions of source code must retain the above copyright
14
 
// notice, this list of conditions and the following disclaimer.
15
 
//
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.
19
 
//
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.
23
 
 
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. 
35
 
// 
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://www.intel.com/software/products/opensource/libraries/num.htm.
39
 
//
40
 
// History
41
 
//==============================================================
42
 
// 02/02/00 Initial version
43
 
// 04/04/00 Improved speed, corrected result for NaN input
44
 
// 12/22/00 Fixed so inexact flag is never set, and invalid is not set for 
45
 
//            qnans nor for inputs larger than 2^63.
46
 
// 05/20/02 Cleaned up namespace and sf0 syntax
47
 
// 02/10/03 Reordered header: .section, .global, .proc, .align
48
 
//
49
 
// API
50
 
//==============================================================
51
 
// float modff(float x, float *iptr)
52
 
// break a floating point x number into fraction and an exponent
53
 
//
54
 
// input  floating point f8, address in r33
55
 
// output floating point f8 (x fraction), and *iptr (x integral part)
56
 
//
57
 
// OVERVIEW
58
 
//==============================================================
59
 
 
60
 
// NO FRACTIONAL PART: HUGE
61
 
// If
62
 
// for double-extended
63
 
// If the true exponent is greater than or equal 63
64
 
//      1003e ==> 1003e -ffff = 3f = 63(dec)
65
 
// for double
66
 
// If the true exponent is greater than or equal 52
67
 
//                10033 -ffff = 34 = 52(dec)
68
 
// for single
69
 
// If the true exponent is greater than or equal 23
70
 
//                10016 -ffff = 17 = 23(dec)
71
 
// then
72
 
// we are already an integer (p9 true)
73
 
 
74
 
// NO INTEGER PART:    SMALL
75
 
//     Is f8 exponent less than register bias (that is, is it
76
 
//     less than 1). If it is, get the right sign of
77
 
//     zero and store this in iptr.
78
 
 
79
 
// CALCULATION: NOT HUGE, NOT SMALL
80
 
// To get the integer part
81
 
// Take the floating-point  input and truncate 
82
 
//   then convert  this integer to fp  Call it  MODF_INTEGER_PART
83
 
 
84
 
// Subtract  MODF_INTEGER_PART from MODF_NORM_F8 to get fraction part
85
 
// Then put fraction part in f8 
86
 
//      put integer  part MODF_INTEGER_PART into *iptr
87
 
 
88
 
// Registers used
89
 
//==============================================================
90
 
 
91
 
// predicate registers used: 
92
 
// p6 - p13
93
 
 
94
 
//                      0xFFFF           0x10016
95
 
// -----------------------+-----------------+-------------
96
 
//              SMALL     |      NORMAL     | HUGE
97
 
//    p11 --------------->|<----- p12 ----->| <-------------- p9
98
 
//    p10 --------------------------------->|
99
 
//    p13 --------------------------------------------------->|
100
 
//
101
 
 
102
 
// floating-point registers used: 
103
 
MODF_NORM_F8               = f9
104
 
MODF_FRACTION_PART         = f10
105
 
MODF_INTEGER_PART          = f11
106
 
MODF_INT_INTEGER_PART      = f12
107
 
 
108
 
 
109
 
// general registers used 
110
 
modf_signexp    = r14
111
 
modf_GR_no_frac = r15
112
 
modf_GR_FFFF    = r16
113
 
modf_17_ones    = r17 
114
 
modf_exp        = r18
115
 
// r33 = iptr
116
 
     
117
 
 
118
 
.section .text
119
 
GLOBAL_LIBM_ENTRY(modff)
120
 
 
121
 
// Main path is p9, p11, p8 FALSE and p12 TRUE
122
 
 
123
 
// Assume input is normalized and get signexp
124
 
// Normalize input just in case
125
 
// Form exponent bias 
126
 
{ .mfi
127
 
      getf.exp  modf_signexp = f8
128
 
      fnorm.s0          MODF_NORM_F8  = f8
129
 
      addl           modf_GR_FFFF  = 0xffff, r0
130
 
}
131
 
// Get integer part of input
132
 
// Form exponent mask
133
 
{ .mfi
134
 
      nop.m 999
135
 
      fcvt.fx.trunc.s1  MODF_INT_INTEGER_PART   = f8
136
 
      mov  modf_17_ones     = 0x1ffff ;;
137
 
}
138
 
 
139
 
// Is x nan or inf?
140
 
// qnan snan inf norm     unorm 0 -+
141
 
// 1    1    1   0        0     0 11 = 0xe3 NAN_INF
142
 
// Form biased exponent where input only has an integer part
143
 
{ .mfi
144
 
      nop.m 999
145
 
      fclass.m.unc p6,p13 = f8, 0xe3
146
 
      addl modf_GR_no_frac = 0x10016, r0 ;;
147
 
}
148
 
 
149
 
// Mask to get exponent
150
 
// Is x unnorm?
151
 
// qnan snan inf norm     unorm 0 -+
152
 
// 0    0    0   0        1     0 11 = 0x0b UNORM
153
 
// Set p13 to indicate calculation path, else p6 if nan or inf 
154
 
{ .mfi
155
 
      and       modf_exp = modf_17_ones, modf_signexp 
156
 
      fclass.m.unc p8,p0 = f8, 0x0b
157
 
      nop.i 999 ;;
158
 
}
159
 
 
160
 
// p11 <== SMALL, no integer part, fraction is everyting
161
 
// p9  <== HUGE,  no fraction part, integer is everything
162
 
// p12 <== NORMAL, fraction part and integer part
163
 
{ .mii
164
 
(p13) cmp.lt.unc p11,p10 = modf_exp, modf_GR_FFFF
165
 
      nop.i 999
166
 
      nop.i 999 ;;
167
 
}
168
 
 
169
 
// Is x inf? p6 if inf, p7 if nan
170
 
{ .mfb
171
 
(p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
172
 
(p6)  fclass.m.unc p6,p7 = f8, 0x23
173
 
(p8)  br.cond.spnt MODF_DENORM ;;
174
 
}
175
 
 
176
 
MODF_COMMON:
177
 
// For HUGE set fraction to signed 0
178
 
{ .mfi
179
 
      nop.m 999
180
 
(p9)  fmerge.s f8 = f8,f0
181
 
      nop.i 999
182
 
}
183
 
// For HUGE set integer part to normalized input
184
 
{ .mfi
185
 
      nop.m 999
186
 
(p9)  fnorm.s.s0 MODF_INTEGER_PART = MODF_NORM_F8
187
 
      nop.i 999 ;;
188
 
}
189
 
 
190
 
// For SMALL set fraction to normalized input, integer part to signed 0
191
 
{ .mfi
192
 
      nop.m 999
193
 
(p11) fmerge.s MODF_INTEGER_PART = f8,f0
194
 
      nop.i 999
195
 
}
196
 
{ .mfi
197
 
      nop.m 999
198
 
(p11) fnorm.s.s0 f8 = MODF_NORM_F8
199
 
      nop.i 999 ;;
200
 
}
201
 
 
202
 
// For NORMAL float the integer part
203
 
{ .mfi
204
 
      nop.m 999
205
 
(p12) fcvt.xf    MODF_INTEGER_PART = MODF_INT_INTEGER_PART
206
 
      nop.i 999 ;;
207
 
}
208
 
 
209
 
// If x inf set integer part to INF, fraction to signed 0
210
 
{ .mfi
211
 
(p6)  stfs [r33] = MODF_NORM_F8
212
 
(p6)  fmerge.s  f8 = f8,f0
213
 
      nop.i 999 ;;
214
 
}
215
 
 
216
 
// If x nan set integer and fraction parts to NaN (quietized)
217
 
{ .mfi
218
 
(p7)  stfs [r33] = MODF_NORM_F8
219
 
(p7)  fmerge.s  f8 = MODF_NORM_F8, MODF_NORM_F8
220
 
      nop.i 999 ;;
221
 
}
222
 
 
223
 
{ .mmi
224
 
(p9)  stfs [r33] = MODF_INTEGER_PART
225
 
      nop.m 999
226
 
      nop.i 999 ;;
227
 
}
228
 
 
229
 
// For NORMAL compute fraction part
230
 
{ .mfi
231
 
(p11) stfs [r33] = MODF_INTEGER_PART
232
 
(p12) fms.s.s0   f8 = MODF_NORM_F8,f1, MODF_INTEGER_PART
233
 
      nop.i 999 ;;
234
 
}
235
 
 
236
 
// For NORMAL test if fraction part is zero; if so append correct sign
237
 
{ .mfi
238
 
      nop.m 999
239
 
(p12) fcmp.eq.unc.s0 p7,p0 = MODF_NORM_F8, MODF_INTEGER_PART
240
 
      nop.i 999 ;;
241
 
}
242
 
 
243
 
{ .mfi
244
 
(p12) stfs [r33] = MODF_INTEGER_PART
245
 
      nop.f 999
246
 
      nop.i 999 ;;
247
 
}
248
 
 
249
 
// For NORMAL if fraction part is zero append sign of input
250
 
{ .mfb
251
 
      nop.m 999
252
 
(p7)  fmerge.s f8 = MODF_NORM_F8, f0
253
 
      br.ret.sptk    b0 ;;
254
 
}
255
 
 
256
 
MODF_DENORM:
257
 
// If x unorm get signexp from normalized input
258
 
// If x unorm get integer part from normalized input
259
 
{ .mfi
260
 
      getf.exp  modf_signexp = MODF_NORM_F8
261
 
      fcvt.fx.trunc.s1  MODF_INT_INTEGER_PART   = MODF_NORM_F8
262
 
      nop.i 999 ;;
263
 
}
264
 
 
265
 
// If x unorm mask to get exponent
266
 
{ .mmi
267
 
      and       modf_exp = modf_17_ones, modf_signexp ;;
268
 
      cmp.lt.unc p11,p10 = modf_exp, modf_GR_FFFF
269
 
      nop.i 999 ;;
270
 
}
271
 
 
272
 
{ .mfb
273
 
(p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
274
 
      nop.f 999
275
 
      br.cond.spnt MODF_COMMON ;;
276
 
}
277
 
 
278
 
GLOBAL_LIBM_END(modff)