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, 2009  Free Software Foundation, Inc.
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11 
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
20 
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24 <http://www.gnu.org/licenses/>.  */
25 
26 #if defined (__ppc64__) || defined (__x86_64__)
27 /* Many of these functions have probably never been used by anyone
28    anywhere on these targets, but it's hard to prove this, so they're defined
29    here.  None are actually necessary, as demonstrated below by defining
30    each function using the operation it implements.  */
31 
32 typedef long DI;
33 typedef unsigned long uDI;
34 typedef int SI;
35 typedef unsigned int uSI;
36 typedef int word_type __attribute__ ((mode (__word__)));
37 
38 DI __ashldi3 (DI x, word_type c);
39 DI __ashrdi3 (DI x, word_type c);
40 int __clzsi2 (uSI x);
41 word_type __cmpdi2 (DI x, DI y);
42 int __ctzsi2 (uSI x);
43 DI __divdi3 (DI x, DI y);
44 uDI __lshrdi3 (uDI x, word_type c);
45 DI __moddi3 (DI x, DI y);
46 DI __muldi3 (DI x, DI y);
47 DI __negdi2 (DI x);
48 int __paritysi2 (uSI x);
49 int __popcountsi2 (uSI x);
50 word_type __ucmpdi2 (uDI x, uDI y);
51 uDI __udivdi3 (uDI x, uDI y);
52 uDI __udivmoddi4 (uDI x, uDI y, uDI *r);
53 uDI __umoddi3 (uDI x, uDI y);
54 
55 DI __ashldi3 (DI x, word_type c) { return x << c; }
56 DI __ashrdi3 (DI x, word_type c) { return x >> c; }
57 int __clzsi2 (uSI x) { return __builtin_clz (x); }
58 word_type __cmpdi2 (DI x, DI y) { return x < y ? 0 : x == y ? 1 : 2; }
59 int __ctzsi2 (uSI x) { return __builtin_ctz (x); }
60 DI __divdi3 (DI x, DI y) { return x / y; }
61 uDI __lshrdi3 (uDI x, word_type c) { return x >> c; }
62 DI __moddi3 (DI x, DI y) { return x % y; }
63 DI __muldi3 (DI x, DI y) { return x * y; }
64 DI __negdi2 (DI x) { return -x; }
65 int __paritysi2 (uSI x) { return __builtin_parity (x); }
66 int __popcountsi2 (uSI x) { return __builtin_popcount (x); }
67 word_type __ucmpdi2 (uDI x, uDI y) { return x < y ? 0 : x == y ? 1 : 2; }
68 uDI __udivdi3 (uDI x, uDI y) { return x / y; }
69 uDI __udivmoddi4 (uDI x, uDI y, uDI *r) { *r = x % y; return x / y; }
70 uDI __umoddi3 (uDI x, uDI y) { return x % y; }
71 
72 #endif /* __ppc64__ || __x86_64__ */
73