]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Main/Arm/int_lib.h
StdLib/LibC: Provide missing ARM symbols
[mirror_edk2.git] / StdLib / LibC / Main / Arm / int_lib.h
1 /**
2 University of Illinois/NCSA
3 Open Source License
4
5 Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
6
7 All rights reserved.
8
9 Developed by:
10
11 LLVM Team
12
13 University of Illinois at Urbana-Champaign
14
15 http://llvm.org
16
17 Permission is hereby granted, free of charge, to any person obtaining a copy of
18 this software and associated documentation files (the "Software"), to deal with
19 the Software without restriction, including without limitation the rights to
20 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
21 of the Software, and to permit persons to whom the Software is furnished to do
22 so, subject to the following conditions:
23
24 * Redistributions of source code must retain the above copyright notice,
25 this list of conditions and the following disclaimers.
26
27 * Redistributions in binary form must reproduce the above copyright notice,
28 this list of conditions and the following disclaimers in the
29 documentation and/or other materials provided with the distribution.
30
31 * Neither the names of the LLVM Team, University of Illinois at
32 Urbana-Champaign, nor the names of its contributors may be used to
33 endorse or promote products derived from this Software without specific
34 prior written permission.
35
36 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
38 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39 CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
42 SOFTWARE.
43 **/
44
45 #ifndef INT_LIB_H
46 #define INT_LIB_H
47
48 /* Assumption: Signed integral is 2's complement. */
49 /* Assumption: Right shift of signed negative is arithmetic shift. */
50 /* Assumption: Endianness is little or big (not mixed). */
51
52 /* ABI macro definitions */
53
54 /*
55 * TODO define this appropriately for targets that require explicit export
56 * declarations (i.e. Windows)
57 */
58 #define COMPILER_RT_EXPORT
59
60 #if __ARM_EABI__
61 # define ARM_EABI_FNALIAS(aeabi_name, name) \
62 void __aeabi_##aeabi_name() __attribute__((alias("__" #name)));
63 # define COMPILER_RT_ABI COMPILER_RT_EXPORT __attribute__((pcs("aapcs")))
64 #else
65 # define ARM_EABI_FNALIAS(aeabi_name, name)
66 # define COMPILER_RT_ABI COMPILER_RT_EXPORT
67 #endif
68
69 #if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
70 /*
71 * Kernel and boot environment can't use normal headers,
72 * so use the equivalent system headers.
73 */
74 # include <machine/limits.h>
75 # include <sys/stdint.h>
76 # include <sys/types.h>
77 #else
78 /* Include the standard compiler builtin headers we use functionality from. */
79 # include <limits.h>
80 # include <stdint.h>
81 # include <stdbool.h>
82 # include <float.h>
83 #endif
84
85 /* Include the commonly used internal type definitions. */
86 #include "int_types.h"
87
88 /* Include internal utility function declarations. */
89 #include "int_util.h"
90
91 COMPILER_RT_ABI si_int __paritysi2(si_int a);
92 COMPILER_RT_ABI si_int __paritydi2(di_int a);
93
94 COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b);
95 COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b);
96 COMPILER_RT_ABI su_int __udivsi3(su_int n, su_int d);
97
98 COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int* rem);
99 COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
100 #ifdef CRT_HAS_128BIT
101 COMPILER_RT_ABI si_int __clzti2(ti_int a);
102 COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
103 #endif
104
105 #endif /* INT_LIB_H */