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