1/* Functions shipped in the ppc64 and x86_64 version of libgcc_s.1.dylib
2   in older Mac OS X versions, preserved for backwards compatibility.
3   Copyright (C) 2006  Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
11
12In addition to the permissions in the GNU General Public License, the
13Free Software Foundation gives you unlimited permission to link the
14compiled version of this file into combinations with other programs,
15and to distribute those combinations without any restriction coming
16from the use of this file.  (The General Public License restrictions
17do apply in other respects; for example, they cover modification of
18the file, and distribution when not linked into a combine
19executable.)
20
21GCC is distributed in the hope that it will be useful, but WITHOUT ANY
22WARRANTY; without even the implied warranty of MERCHANTABILITY or
23FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24for more details.
25
26You should have received a copy of the GNU General Public License
27along with GCC; see the file COPYING.  If not, write to the Free
28Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2902110-1301, USA.  */
30
31#if defined (__ppc64__) || defined (__x86_64__)
32/* Many of these functions have probably never been used by anyone
33   anywhere on these targets, but it's hard to prove this, so they're defined
34   here.  None are actually necessary, as demonstrated below by defining
35   each function using the operation it implements.  */
36
37typedef long DI;
38typedef unsigned long uDI;
39typedef int SI;
40typedef unsigned int uSI;
41typedef int word_type __attribute__ ((mode (__word__)));
42
43DI __ashldi3 (DI x, word_type c);
44DI __ashrdi3 (DI x, word_type c);
45int __clzsi2 (uSI x);
46word_type __cmpdi2 (DI x, DI y);
47int __ctzsi2 (uSI x);
48DI __divdi3 (DI x, DI y);
49uDI __lshrdi3 (uDI x, word_type c);
50DI __moddi3 (DI x, DI y);
51DI __muldi3 (DI x, DI y);
52DI __negdi2 (DI x);
53int __paritysi2 (uSI x);
54int __popcountsi2 (uSI x);
55word_type __ucmpdi2 (uDI x, uDI y);
56uDI __udivdi3 (uDI x, uDI y);
57uDI __udivmoddi4 (uDI x, uDI y, uDI *r);
58uDI __umoddi3 (uDI x, uDI y);
59
60DI __ashldi3 (DI x, word_type c) { return x << c; }
61DI __ashrdi3 (DI x, word_type c) { return x >> c; }
62int __clzsi2 (uSI x) { return __builtin_clz (x); }
63word_type __cmpdi2 (DI x, DI y) { return x < y ? 0 : x == y ? 1 : 2; }
64int __ctzsi2 (uSI x) { return __builtin_ctz (x); }
65DI __divdi3 (DI x, DI y) { return x / y; }
66uDI __lshrdi3 (uDI x, word_type c) { return x >> c; }
67DI __moddi3 (DI x, DI y) { return x % y; }
68DI __muldi3 (DI x, DI y) { return x * y; }
69DI __negdi2 (DI x) { return -x; }
70int __paritysi2 (uSI x) { return __builtin_parity (x); }
71int __popcountsi2 (uSI x) { return __builtin_popcount (x); }
72word_type __ucmpdi2 (uDI x, uDI y) { return x < y ? 0 : x == y ? 1 : 2; }
73uDI __udivdi3 (uDI x, uDI y) { return x / y; }
74uDI __udivmoddi4 (uDI x, uDI y, uDI *r) { *r = x % y; return x / y; }
75uDI __umoddi3 (uDI x, uDI y) { return x % y; }
76
77#endif /* __ppc64__ || __x86_64__ */
78