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