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-2017 Free Software Foundation, Inc.
5 This file is part of GCC.
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
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
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.
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/>. */
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. */
33 typedef unsigned long uDI
;
35 typedef unsigned int uSI
;
36 typedef int word_type
__attribute__ ((mode (__word__
)));
38 DI
__ashldi3 (DI x
, word_type c
);
39 DI
__ashrdi3 (DI x
, word_type c
);
41 word_type
__cmpdi2 (DI x
, DI y
);
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
);
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
);
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
; }
72 #endif /* __ppc64__ || __x86_64__ */