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

« back to all changes in this revision

Viewing changes to stdlib/longlong.h

  • 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:
25
25
   Lesser General Public License for more details.
26
26
 
27
27
   You should have received a copy of the GNU Lesser General Public
28
 
   License along with the GNU C Library; if not, write to the Free
29
 
   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
30
 
   MA 02110-1301, USA.  */
 
28
   License along with the GNU C Library; if not, see
 
29
   <http://www.gnu.org/licenses/>.  */
31
30
 
32
31
/* You have to define the following before including this file:
33
32
 
203
202
UDItype __umulsidi3 (USItype, USItype);
204
203
#endif
205
204
 
206
 
#if defined (__arm__) && !defined (__thumb__) && W_TYPE_SIZE == 32
 
205
#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \
 
206
 && W_TYPE_SIZE == 32
207
207
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
208
208
  __asm__ ("adds        %1, %4, %5\n\tadc       %0, %2, %3"             \
209
209
           : "=r" ((USItype) (sh)),                                     \
220
220
             "rI" ((USItype) (bh)),                                     \
221
221
             "r" ((USItype) (al)),                                      \
222
222
             "rI" ((USItype) (bl)) __CLOBBER_CC)
223
 
#define umul_ppmm(xh, xl, a, b) \
224
 
{register USItype __t0, __t1, __t2;                                     \
225
 
  __asm__ ("%@ Inlined umul_ppmm\n"                                     \
 
223
# if defined(__ARM_ARCH_2__) || defined(__ARM_ARCH_2A__) \
 
224
     || defined(__ARM_ARCH_3__)
 
225
#  define umul_ppmm(xh, xl, a, b)                                       \
 
226
  do {                                                                  \
 
227
    register USItype __t0, __t1, __t2;                                  \
 
228
    __asm__ ("%@ Inlined umul_ppmm\n"                                   \
226
229
           "    mov     %2, %5, lsr #16\n"                              \
227
230
           "    mov     %0, %6, lsr #16\n"                              \
228
231
           "    bic     %3, %5, %2, lsl #16\n"                          \
239
242
             "=r" ((USItype) (xl)),                                     \
240
243
             "=&r" (__t0), "=&r" (__t1), "=r" (__t2)                    \
241
244
           : "r" ((USItype) (a)),                                       \
242
 
             "r" ((USItype) (b)) __CLOBBER_CC );}
243
 
#define UMUL_TIME 20
244
 
#define UDIV_TIME 100
 
245
             "r" ((USItype) (b)) __CLOBBER_CC );                        \
 
246
  } while (0)
 
247
#  define UMUL_TIME 20
 
248
# else
 
249
#  define umul_ppmm(xh, xl, a, b)                                       \
 
250
  do {                                                                  \
 
251
    /* Generate umull, under compiler control.  */                      \
 
252
    register UDItype __t0 = (UDItype)(USItype)(a) * (USItype)(b);       \
 
253
    (xl) = (USItype)__t0;                                               \
 
254
    (xh) = (USItype)(__t0 >> 32);                                       \
 
255
  } while (0)
 
256
#  define UMUL_TIME 3
 
257
# endif
 
258
# define UDIV_TIME 100
245
259
#endif /* __arm__ */
246
260
 
247
261
#if defined(__arm__)
248
262
/* Let gcc decide how best to implement count_leading_zeros.  */
249
263
#define count_leading_zeros(COUNT,X)    ((COUNT) = __builtin_clz (X))
 
264
#define count_trailing_zeros(COUNT,X)   ((COUNT) = __builtin_ctz (X))
250
265
#define COUNT_LEADING_ZEROS_0 32
251
266
#endif
252
267
 
 
268
#if defined (__AVR__)
 
269
 
 
270
#if W_TYPE_SIZE == 16
 
271
#define count_leading_zeros(COUNT,X)  ((COUNT) = __builtin_clz (X))
 
272
#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X))
 
273
#define COUNT_LEADING_ZEROS_0 16
 
274
#endif /* W_TYPE_SIZE == 16 */
 
275
 
 
276
#if W_TYPE_SIZE == 32
 
277
#define count_leading_zeros(COUNT,X)  ((COUNT) = __builtin_clzl (X))
 
278
#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X))
 
279
#define COUNT_LEADING_ZEROS_0 32
 
280
#endif /* W_TYPE_SIZE == 32 */
 
281
 
 
282
#if W_TYPE_SIZE == 64
 
283
#define count_leading_zeros(COUNT,X)  ((COUNT) = __builtin_clzll (X))
 
284
#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzll (X))
 
285
#define COUNT_LEADING_ZEROS_0 64
 
286
#endif /* W_TYPE_SIZE == 64 */
 
287
 
 
288
#endif /* defined (__AVR__) */
 
289
 
253
290
#if defined (__CRIS__) && __CRIS_arch_version >= 3
254
291
#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
255
292
#if __CRIS_arch_version >= 8
431
468
           : "0" ((UDItype) (n0)),                                      \
432
469
             "1" ((UDItype) (n1)),                                      \
433
470
             "rm" ((UDItype) (dv)))
434
 
#define count_leading_zeros(count, x)   ((count) = __builtin_clzl (x))
435
 
#define count_trailing_zeros(count, x)  ((count) = __builtin_ctzl (x))
 
471
#define count_leading_zeros(count, x)   ((count) = __builtin_clzll (x))
 
472
#define count_trailing_zeros(count, x)  ((count) = __builtin_ctzll (x))
436
473
#define UMUL_TIME 40
437
474
#define UDIV_TIME 40
438
475
#endif /* x86_64 */
1090
1127
             "rJ" ((USItype) (al)),                                     \
1091
1128
             "rI" ((USItype) (bl))                                      \
1092
1129
           __CLOBBER_CC)
 
1130
#if defined (__sparc_v9__)
 
1131
#define umul_ppmm(w1, w0, u, v) \
 
1132
  do {                                                                  \
 
1133
    register USItype __g1 asm ("g1");                                   \
 
1134
    __asm__ ("umul\t%2,%3,%1\n\t"                                       \
 
1135
             "srlx\t%1, 32, %0"                                         \
 
1136
             : "=r" ((USItype) (w1)),                                   \
 
1137
               "=r" (__g1)                                              \
 
1138
             : "r" ((USItype) (u)),                                     \
 
1139
               "r" ((USItype) (v)));                                    \
 
1140
    (w0) = __g1;                                                        \
 
1141
  } while (0)
 
1142
#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \
 
1143
  __asm__ ("mov\t%2,%%y\n\t"                                            \
 
1144
           "udiv\t%3,%4,%0\n\t"                                         \
 
1145
           "umul\t%0,%4,%1\n\t"                                         \
 
1146
           "sub\t%3,%1,%1"                                              \
 
1147
           : "=&r" ((USItype) (__q)),                                   \
 
1148
             "=&r" ((USItype) (__r))                                    \
 
1149
           : "r" ((USItype) (__n1)),                                    \
 
1150
             "r" ((USItype) (__n0)),                                    \
 
1151
             "r" ((USItype) (__d)))
 
1152
#else
1093
1153
#if defined (__sparc_v8__)
1094
1154
#define umul_ppmm(w1, w0, u, v) \
1095
1155
  __asm__ ("umul %2,%3,%1;rd %%y,%0"                                    \
1255
1315
#define UDIV_TIME (3+7*32)      /* 7 instructions/iteration. 32 iterations.  */
1256
1316
#endif /* __sparclite__ */
1257
1317
#endif /* __sparc_v8__ */
 
1318
#endif /* __sparc_v9__ */
1258
1319
#endif /* sparc32 */
1259
1320
 
1260
1321
#if ((defined (__sparc__) && defined (__arch64__)) || defined (__sparcv9)) \
1261
1322
    && W_TYPE_SIZE == 64
1262
1323
#define add_ssaaaa(sh, sl, ah, al, bh, bl)                              \
1263
 
  __asm__ ("addcc %r4,%5,%1\n\t"                                        \
1264
 
           "add %r2,%3,%0\n\t"                                          \
1265
 
           "bcs,a,pn %%xcc, 1f\n\t"                                     \
1266
 
           "add %0, 1, %0\n"                                            \
1267
 
           "1:"                                                         \
1268
 
           : "=r" ((UDItype)(sh)),                                      \
1269
 
             "=&r" ((UDItype)(sl))                                      \
1270
 
           : "%rJ" ((UDItype)(ah)),                                     \
1271
 
             "rI" ((UDItype)(bh)),                                      \
1272
 
             "%rJ" ((UDItype)(al)),                                     \
1273
 
             "rI" ((UDItype)(bl))                                       \
1274
 
           __CLOBBER_CC)
 
1324
  do {                                                                  \
 
1325
    UDItype __carry = 0;                                                \
 
1326
    __asm__ ("addcc\t%r5,%6,%1\n\t"                                     \
 
1327
             "add\t%r3,%4,%0\n\t"                                       \
 
1328
             "movcs\t%%xcc, 1, %2\n\t"                                  \
 
1329
             "add\t%0, %2, %0"                                          \
 
1330
             : "=r" ((UDItype)(sh)),                                    \
 
1331
               "=&r" ((UDItype)(sl)),                                   \
 
1332
               "+r" (__carry)                                           \
 
1333
             : "%rJ" ((UDItype)(ah)),                                   \
 
1334
               "rI" ((UDItype)(bh)),                                    \
 
1335
               "%rJ" ((UDItype)(al)),                                   \
 
1336
               "rI" ((UDItype)(bl))                                     \
 
1337
             __CLOBBER_CC);                                             \
 
1338
  } while (0)
1275
1339
 
1276
 
#define sub_ddmmss(sh, sl, ah, al, bh, bl)                              \
1277
 
  __asm__ ("subcc %r4,%5,%1\n\t"                                        \
1278
 
           "sub %r2,%3,%0\n\t"                                          \
1279
 
           "bcs,a,pn %%xcc, 1f\n\t"                                     \
1280
 
           "sub %0, 1, %0\n\t"                                          \
1281
 
           "1:"                                                         \
1282
 
           : "=r" ((UDItype)(sh)),                                      \
1283
 
             "=&r" ((UDItype)(sl))                                      \
1284
 
           : "rJ" ((UDItype)(ah)),                                      \
1285
 
             "rI" ((UDItype)(bh)),                                      \
1286
 
             "rJ" ((UDItype)(al)),                                      \
1287
 
             "rI" ((UDItype)(bl))                                       \
1288
 
           __CLOBBER_CC)
 
1340
#define sub_ddmmss(sh, sl, ah, al, bh, bl)                              \
 
1341
  do {                                                                  \
 
1342
    UDItype __carry = 0;                                                \
 
1343
    __asm__ ("subcc\t%r5,%6,%1\n\t"                                     \
 
1344
             "sub\t%r3,%4,%0\n\t"                                       \
 
1345
             "movcs\t%%xcc, 1, %2\n\t"                                  \
 
1346
             "sub\t%0, %2, %0"                                          \
 
1347
             : "=r" ((UDItype)(sh)),                                    \
 
1348
               "=&r" ((UDItype)(sl)),                                   \
 
1349
               "+r" (__carry)                                           \
 
1350
             : "%rJ" ((UDItype)(ah)),                                   \
 
1351
               "rI" ((UDItype)(bh)),                                    \
 
1352
               "%rJ" ((UDItype)(al)),                                   \
 
1353
               "rI" ((UDItype)(bl))                                     \
 
1354
             __CLOBBER_CC);                                             \
 
1355
  } while (0)
1289
1356
 
1290
1357
#define umul_ppmm(wh, wl, u, v)                                         \
1291
1358
  do {                                                                  \
1368
1435
  } while (0)
1369
1436
#endif /* __vax__ */
1370
1437
 
 
1438
#ifdef _TMS320C6X
 
1439
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
 
1440
  do                                                                    \
 
1441
    {                                                                   \
 
1442
      UDItype __ll;                                                     \
 
1443
      __asm__ ("addu .l1 %1, %2, %0"                                    \
 
1444
               : "=a" (__ll) : "a" (al), "a" (bl));                     \
 
1445
      (sl) = (USItype)__ll;                                             \
 
1446
      (sh) = ((USItype)(__ll >> 32)) + (ah) + (bh);                     \
 
1447
    }                                                                   \
 
1448
  while (0)
 
1449
 
 
1450
#ifdef _TMS320C6400_PLUS
 
1451
#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v)
 
1452
#define umul_ppmm(w1, w0, u, v)                                         \
 
1453
  do {                                                                  \
 
1454
    UDItype __x = (UDItype) (USItype) (u) * (USItype) (v);              \
 
1455
    (w1) = (USItype) (__x >> 32);                                       \
 
1456
    (w0) = (USItype) (__x);                                             \
 
1457
  } while (0)
 
1458
#endif  /* _TMS320C6400_PLUS */
 
1459
 
 
1460
#define count_leading_zeros(count, x)   ((count) = __builtin_clz (x))
 
1461
#ifdef _TMS320C6400
 
1462
#define count_trailing_zeros(count, x)  ((count) = __builtin_ctz (x))
 
1463
#endif
 
1464
#define UMUL_TIME 4
 
1465
#define UDIV_TIME 40
 
1466
#endif /* _TMS320C6X */
 
1467
 
1371
1468
#if defined (__xtensa__) && W_TYPE_SIZE == 32
1372
1469
/* This code is not Xtensa-configuration-specific, so rely on the compiler
1373
1470
   to expand builtin functions depending on what configuration features