1169689Skan/* Functions shipped in the ppc64 and x86_64 version of libgcc_s.1.dylib
2169689Skan   in older Mac OS X versions, preserved for backwards compatibility.
3169689Skan   Copyright (C) 2006  Free Software Foundation, Inc.
4169689Skan
5169689SkanThis file is part of GCC.
6169689Skan
7169689SkanGCC is free software; you can redistribute it and/or modify it under
8169689Skanthe terms of the GNU General Public License as published by the Free
9169689SkanSoftware Foundation; either version 2, or (at your option) any later
10169689Skanversion.
11169689Skan
12169689SkanIn addition to the permissions in the GNU General Public License, the
13169689SkanFree Software Foundation gives you unlimited permission to link the
14169689Skancompiled version of this file into combinations with other programs,
15169689Skanand to distribute those combinations without any restriction coming
16169689Skanfrom the use of this file.  (The General Public License restrictions
17169689Skando apply in other respects; for example, they cover modification of
18169689Skanthe file, and distribution when not linked into a combine
19169689Skanexecutable.)
20169689Skan
21169689SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY
22169689SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or
23169689SkanFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24169689Skanfor more details.
25169689Skan
26169689SkanYou should have received a copy of the GNU General Public License
27169689Skanalong with GCC; see the file COPYING.  If not, write to the Free
28169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
29169689Skan02110-1301, USA.  */
30169689Skan
31169689Skan#if defined (__ppc64__) || defined (__x86_64__)
32169689Skan/* Many of these functions have probably never been used by anyone
33169689Skan   anywhere on these targets, but it's hard to prove this, so they're defined
34169689Skan   here.  None are actually necessary, as demonstrated below by defining
35169689Skan   each function using the operation it implements.  */
36169689Skan
37169689Skantypedef long DI;
38169689Skantypedef unsigned long uDI;
39169689Skantypedef int SI;
40169689Skantypedef unsigned int uSI;
41169689Skantypedef int word_type __attribute__ ((mode (__word__)));
42169689Skan
43169689SkanDI __ashldi3 (DI x, word_type c);
44169689SkanDI __ashrdi3 (DI x, word_type c);
45169689Skanint __clzsi2 (uSI x);
46169689Skanword_type __cmpdi2 (DI x, DI y);
47169689Skanint __ctzsi2 (uSI x);
48169689SkanDI __divdi3 (DI x, DI y);
49169689SkanuDI __lshrdi3 (uDI x, word_type c);
50169689SkanDI __moddi3 (DI x, DI y);
51169689SkanDI __muldi3 (DI x, DI y);
52169689SkanDI __negdi2 (DI x);
53169689Skanint __paritysi2 (uSI x);
54169689Skanint __popcountsi2 (uSI x);
55169689Skanword_type __ucmpdi2 (uDI x, uDI y);
56169689SkanuDI __udivdi3 (uDI x, uDI y);
57169689SkanuDI __udivmoddi4 (uDI x, uDI y, uDI *r);
58169689SkanuDI __umoddi3 (uDI x, uDI y);
59169689Skan
60169689SkanDI __ashldi3 (DI x, word_type c) { return x << c; }
61169689SkanDI __ashrdi3 (DI x, word_type c) { return x >> c; }
62169689Skanint __clzsi2 (uSI x) { return __builtin_clz (x); }
63169689Skanword_type __cmpdi2 (DI x, DI y) { return x < y ? 0 : x == y ? 1 : 2; }
64169689Skanint __ctzsi2 (uSI x) { return __builtin_ctz (x); }
65169689SkanDI __divdi3 (DI x, DI y) { return x / y; }
66169689SkanuDI __lshrdi3 (uDI x, word_type c) { return x >> c; }
67169689SkanDI __moddi3 (DI x, DI y) { return x % y; }
68169689SkanDI __muldi3 (DI x, DI y) { return x * y; }
69169689SkanDI __negdi2 (DI x) { return -x; }
70169689Skanint __paritysi2 (uSI x) { return __builtin_parity (x); }
71169689Skanint __popcountsi2 (uSI x) { return __builtin_popcount (x); }
72169689Skanword_type __ucmpdi2 (uDI x, uDI y) { return x < y ? 0 : x == y ? 1 : 2; }
73169689SkanuDI __udivdi3 (uDI x, uDI y) { return x / y; }
74169689SkanuDI __udivmoddi4 (uDI x, uDI y, uDI *r) { *r = x % y; return x / y; }
75169689SkanuDI __umoddi3 (uDI x, uDI y) { return x % y; }
76169689Skan
77169689Skan#endif /* __ppc64__ || __x86_64__ */
78