None of the .c/.h in Arm/ are used any more => remove them.
Also merge the CC flags for MSFT ARM and ARM64, since these are the
only archs we support for this package.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-#include <Base.h>\r
-#include <Library/DebugLib.h>\r
-\r
-#define CHAR_BIT 8\r
-\r
-typedef union {\r
- INT64 all;\r
- struct {\r
- UINT32 low;\r
- INT32 high;\r
- };\r
-} dwords;\r
-\r
-typedef union {\r
- UINT64 all;\r
- struct {\r
- UINT32 low;\r
- UINT32 high;\r
- };\r
-} udwords;\r
-\r
-// __aeabi_ return values\r
-typedef struct {\r
- UINT64 Quotent;\r
- UINT64 Remainder;\r
-} ulldiv_t;\r
-\r
-typedef struct {\r
- INT64 Quotent;\r
- INT64 Remainder;\r
-} lldiv_t;\r
-\r
-typedef struct {\r
- UINT32 Quotent;\r
- UINT32 Remainder;\r
-} uidiv_return;\r
-\r
-#if __GNUC__\r
- #define COUNT_LEADING_ZEROS(_a) __builtin_clz((_a))\r
- #define COUNT_TRAILING_ZEROS(_a) __builtin_ctz((_a))\r
-#else\r
-#error COUNT_LEADING_ZEROS() and COUNT_TRAILING_ZEROS() macros not ported to your compiler\r
-#endif\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-// Returns: a << b\r
-\r
-// Precondition: 0 <= b < bits_in_dword\r
-\r
-INT64\r
-__ashldi3(INT64 a, INT32 b)\r
-{\r
- const int bits_in_word = (int)(sizeof(INT32) * CHAR_BIT);\r
- dwords input;\r
- dwords result;\r
- input.all = a;\r
- if (b & bits_in_word) // bits_in_word <= b < bits_in_dword\r
- {\r
- result.low = 0;\r
- result.high = input.low << (b - bits_in_word);\r
- }\r
- else // 0 <= b < bits_in_word\r
- {\r
- if (b == 0)\r
- return a;\r
- result.low = input.low << b;\r
- result.high = (input.high << b) | (input.low >> (bits_in_word - b));\r
- }\r
- return result.all;\r
-}\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-// Returns: arithmetic a >> b\r
-\r
-// Precondition: 0 <= b < bits_in_dword\r
-\r
-INT64\r
-__ashrdi3(INT64 a, INT32 b)\r
-{\r
- const int bits_in_word = (int)(sizeof(INT32) * CHAR_BIT);\r
- dwords input;\r
- dwords result;\r
- input.all = a;\r
- if (b & bits_in_word) // bits_in_word <= b < bits_in_dword\r
- {\r
- // result.high = input.high < 0 ? -1 : 0\r
- result.high = input.high >> (bits_in_word - 1);\r
- result.low = input.high >> (b - bits_in_word);\r
- }\r
- else // 0 <= b < bits_in_word\r
- {\r
- if (b == 0)\r
- return a;\r
- result.high = input.high >> b;\r
- result.low = (input.high << (bits_in_word - b)) | (input.low >> b);\r
- }\r
- return result.all;\r
-}\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic to return the number of leading zeros, ported from LLVM code.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-// Returns: the number of leading 0-bits\r
-\r
-// Precondition: a != 0\r
-\r
-INT32\r
-__clzsi2(INT32 a)\r
-{\r
- UINT32 x = (UINT32)a;\r
- INT32 t = ((x & 0xFFFF0000) == 0) << 4; // if (x is small) t = 16 else 0\r
- x >>= 16 - t; // x = [0 - 0xFFFF]\r
- UINT32 r = t; // r = [0, 16]\r
- // return r + clz(x)\r
- t = ((x & 0xFF00) == 0) << 3;\r
- x >>= 8 - t; // x = [0 - 0xFF]\r
- r += t; // r = [0, 8, 16, 24]\r
- // return r + clz(x)\r
- t = ((x & 0xF0) == 0) << 2;\r
- x >>= 4 - t; // x = [0 - 0xF]\r
- r += t; // r = [0, 4, 8, 12, 16, 20, 24, 28]\r
- // return r + clz(x)\r
- t = ((x & 0xC) == 0) << 1;\r
- x >>= 2 - t; // x = [0 - 3]\r
- r += t; // r = [0 - 30] and is even\r
- // return r + clz(x)\r
-// switch (x)\r
-// {\r
-// case 0:\r
-// return r + 2;\r
-// case 1:\r
-// return r + 1;\r
-// case 2:\r
-// case 3:\r
-// return r;\r
-// }\r
- return r + ((2 - x) & -((x & 2) == 0));\r
-}\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic to return the number of trailing zeros, ported from LLVM code.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-// Returns: the number of trailing 0-bits\r
-\r
-// Precondition: a != 0\r
-\r
-INT32\r
-__ctzsi2(INT32 a)\r
-{\r
- UINT32 x = (UINT32)a;\r
- INT32 t = ((x & 0x0000FFFF) == 0) << 4; // if (x has no small bits) t = 16 else 0\r
- x >>= t; // x = [0 - 0xFFFF] + higher garbage bits\r
- UINT32 r = t; // r = [0, 16]\r
- // return r + ctz(x)\r
- t = ((x & 0x00FF) == 0) << 3;\r
- x >>= t; // x = [0 - 0xFF] + higher garbage bits\r
- r += t; // r = [0, 8, 16, 24]\r
- // return r + ctz(x)\r
- t = ((x & 0x0F) == 0) << 2;\r
- x >>= t; // x = [0 - 0xF] + higher garbage bits\r
- r += t; // r = [0, 4, 8, 12, 16, 20, 24, 28]\r
- // return r + ctz(x)\r
- t = ((x & 0x3) == 0) << 1;\r
- x >>= t;\r
- x &= 3; // x = [0 - 3]\r
- r += t; // r = [0 - 30] and is even\r
- // return r + ctz(x)\r
-// The branch-less return statement below is equivalent\r
-// to the following switch statement:\r
-// switch (x)\r
-// {\r
-// case 0:\r
-// return r + 2;\r
-// case 2:\r
-// return r + 1;\r
-// case 1:\r
-// case 3:\r
-// return r;\r
-// }\r
- return r + ((2 - (x >> 1)) & -((x & 1) == 0));\r
-}\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 64-bit compare, ported from LLVM code.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-UINT64 __udivmoddi4(UINT64 a, UINT64 b, UINT64* rem);\r
-\r
-// Returns: a / b\r
-\r
-INT64\r
-__divdi3(INT64 a, INT64 b)\r
-{\r
- const int bits_in_dword_m1 = (int)(sizeof(INT64) * CHAR_BIT) - 1;\r
- INT64 s_a = a >> bits_in_dword_m1; // s_a = a < 0 ? -1 : 0\r
- INT64 s_b = b >> bits_in_dword_m1; // s_b = b < 0 ? -1 : 0\r
- a = (a ^ s_a) - s_a; // negate if s_a == -1\r
- b = (b ^ s_b) - s_b; // negate if s_b == -1\r
- s_a ^= s_b; // sign of quotient\r
- return (__udivmoddi4(a, b, (UINT64*)0) ^ s_a) - s_a; // negate if s_a == -1\r
-}\r
-\r
-\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 32--bit unsigned division, ported from LLVM code.\r
-\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-UINT32 __udivsi3(UINT32 n, UINT32 d);\r
-\r
-// Returns: a / b\r
-\r
-INT32\r
-__divsi3(INT32 a, INT32 b)\r
-{\r
- const int bits_in_word_m1 = (int)(sizeof(INT32) * CHAR_BIT) - 1;\r
- INT32 s_a = a >> bits_in_word_m1; // s_a = a < 0 ? -1 : 0\r
- INT32 s_b = b >> bits_in_word_m1; // s_b = b < 0 ? -1 : 0\r
- a = (a ^ s_a) - s_a; // negate if s_a == -1\r
- b = (b ^ s_b) - s_b; // negate if s_b == -1\r
- s_a ^= s_b; // sign of quotient\r
- return (__udivsi3(a, b) ^ s_a) - s_a; // negate if s_a == -1\r
-}\r
-\r
-\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-// Returns: logical a >> b\r
-\r
-// Precondition: 0 <= b < bits_in_dword\r
-\r
-INT64\r
-__lshrdi3(INT64 a, INT32 b)\r
-{\r
- const int bits_in_word = (int)(sizeof(INT32) * CHAR_BIT);\r
- udwords input;\r
- udwords result;\r
- input.all = a;\r
- if (b & bits_in_word) // bits_in_word <= b < bits_in_dword\r
- {\r
- result.high = 0;\r
- result.low = input.high >> (b - bits_in_word);\r
- }\r
- else // 0 <= b < bits_in_word\r
- {\r
- if (b == 0)\r
- return a;\r
- result.high = input.high >> b;\r
- result.low = (input.high << (bits_in_word - b)) | (input.low >> b);\r
- }\r
- return result.all;\r
-}\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 64-bit mod, ported from LLVM code.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-UINT64 __udivmoddi4(UINT64 a, UINT64 b, UINT64* rem);\r
-\r
-// Returns: a % b\r
-\r
-INT64\r
-__moddi3(INT64 a, INT64 b)\r
-{\r
- const int bits_in_dword_m1 = (int)(sizeof(INT64) * CHAR_BIT) - 1;\r
- INT64 s = b >> bits_in_dword_m1; // s = b < 0 ? -1 : 0\r
- b = (b ^ s) - s; // negate if s == -1\r
- s = a >> bits_in_dword_m1; // s = a < 0 ? -1 : 0\r
- a = (a ^ s) - s; // negate if s == -1\r
- INT64 r;\r
- __udivmoddi4(a, b, (UINT64*)&r);\r
- return (r ^ s) - s; // negate if s == -1\r
-}\r
-\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 32-bit mod, ported from LLVM code.\r
-\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-// Returns: a % b\r
-\r
-INT32\r
-__modsi3(INT32 a, INT32 b)\r
-{\r
- return a - (a / b) * b;\r
-}\r
-\r
-\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-#include <Base.h>\r
-#include "Llvm_int_lib.h"\r
-\r
-\r
-// Returns: a * b\r
-\r
-static\r
-INT64\r
-__muldsi3(UINT32 a, UINT32 b)\r
-{\r
- dwords r;\r
- const int bits_in_word_2 = (int)(sizeof(INT32) * CHAR_BIT) / 2;\r
- const UINT32 lower_mask = (UINT32)~0 >> bits_in_word_2;\r
- r.low = (a & lower_mask) * (b & lower_mask);\r
- UINT32 t = r.low >> bits_in_word_2;\r
- r.low &= lower_mask;\r
- t += (a >> bits_in_word_2) * (b & lower_mask);\r
- r.low += (t & lower_mask) << bits_in_word_2;\r
- r.high = t >> bits_in_word_2;\r
- t = r.low >> bits_in_word_2;\r
- r.low &= lower_mask;\r
- t += (b >> bits_in_word_2) * (a & lower_mask);\r
- r.low += (t & lower_mask) << bits_in_word_2;\r
- r.high += t >> bits_in_word_2;\r
- r.high += (a >> bits_in_word_2) * (b >> bits_in_word_2);\r
- return r.all;\r
-}\r
-\r
-// Returns: a * b\r
-\r
-INT64\r
-__muldi3(INT64 a, INT64 b)\r
-{\r
- dwords x;\r
- x.all = a;\r
- dwords y;\r
- y.all = b;\r
- dwords r;\r
- r.all = __muldsi3(x.low, y.low);\r
- r.high += x.high * y.low + x.low * y.high;\r
- return r.all;\r
-}\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 64-bit compare, ported from LLVM code.\r
-\r
- Copyright (c) 2008-2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-\r
-// Returns: if (a < b) returns 0\r
-// if (a == b) returns 1\r
-// if (a > b) returns 2\r
-\r
-UINT32\r
-__ucmpdi2(UINT64 a, UINT64 b)\r
-{\r
- udwords x;\r
- x.all = a;\r
- udwords y;\r
- y.all = b;\r
- if (x.high < y.high)\r
- return 0;\r
- if (x.high > y.high)\r
- return 2;\r
- if (x.low < y.low)\r
- return 0;\r
- if (x.low > y.low)\r
- return 2;\r
- return 1;\r
-}\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 64-bit unisigned div, ported from LLVM code.\r
-\r
- Copyright (c) 2008-2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-UINT64 __udivmoddi4 (UINT64 a, UINT64 b, UINT64 *rem);\r
-\r
-// Returns: a / b\r
-\r
-UINT64\r
-__udivdi3(UINT64 a, UINT64 b)\r
-{\r
- return __udivmoddi4(a, b, 0);\r
-}\r
-\r
-\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 64-bit compare, ported from LLVM code.\r
-\r
- Copyright (c) 2008-2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-// Effects: if rem != 0, *rem = a % b\r
-// Returns: a / b\r
-\r
-// Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide\r
-\r
-UINT64\r
-__udivmoddi4 (UINT64 a, UINT64 b, UINT64* rem)\r
-{\r
- const unsigned n_uword_bits = sizeof(UINT32) * CHAR_BIT;\r
- const unsigned n_udword_bits = sizeof(UINT64) * CHAR_BIT;\r
- udwords n;\r
- n.all = a;\r
- udwords d;\r
- d.all = b;\r
- udwords q;\r
- udwords r;\r
- unsigned sr;\r
-\r
- if (b == 0) {\r
-// ASSERT (FALSE);\r
- return 0;\r
- }\r
-\r
- // special cases, X is unknown, K != 0\r
- if (n.high == 0)\r
- {\r
- if (d.high == 0)\r
- {\r
- // 0 X\r
- // ---\r
- // 0 X\r
- if (rem)\r
- *rem = n.low % d.low;\r
- return n.low / d.low;\r
- }\r
- // 0 X\r
- // ---\r
- // K X\r
- if (rem)\r
- *rem = n.low;\r
- return 0;\r
- }\r
- // n.high != 0\r
- if (d.low == 0)\r
- {\r
- if (d.high == 0)\r
- {\r
- // K X\r
- // ---\r
- // 0 0\r
- if (rem)\r
- *rem = n.high % d.low;\r
- return n.high / d.low;\r
- }\r
- // d.high != 0\r
- if (n.low == 0)\r
- {\r
- // K 0\r
- // ---\r
- // K 0\r
- if (rem)\r
- {\r
- r.high = n.high % d.high;\r
- r.low = 0;\r
- *rem = r.all;\r
- }\r
- return n.high / d.high;\r
- }\r
- // K K\r
- // ---\r
- // K 0\r
- if ((d.high & (d.high - 1)) == 0) // if d is a power of 2\r
- {\r
- if (rem)\r
- {\r
- r.low = n.low;\r
- r.high = n.high & (d.high - 1);\r
- *rem = r.all;\r
- }\r
- return n.high >> COUNT_TRAILING_ZEROS(d.high);\r
- }\r
- // K K\r
- // ---\r
- // K 0\r
- sr = COUNT_LEADING_ZEROS(d.high) - COUNT_LEADING_ZEROS(n.high);\r
- // 0 <= sr <= n_uword_bits - 2 or sr large\r
- if (sr > n_uword_bits - 2)\r
- {\r
- if (rem)\r
- *rem = n.all;\r
- return 0;\r
- }\r
- ++sr;\r
- // 1 <= sr <= n_uword_bits - 1\r
- // q.all = n.all << (n_udword_bits - sr);\r
- q.low = 0;\r
- q.high = n.low << (n_uword_bits - sr);\r
- // r.all = n.all >> sr;\r
- r.high = n.high >> sr;\r
- r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);\r
- }\r
- else // d.low != 0\r
- {\r
- if (d.high == 0)\r
- {\r
- // K X\r
- // ---\r
- // 0 K\r
- if ((d.low & (d.low - 1)) == 0) // if d is a power of 2\r
- {\r
- if (rem)\r
- *rem = n.low & (d.low - 1);\r
- if (d.low == 1)\r
- return n.all;\r
- unsigned sr = COUNT_TRAILING_ZEROS(d.low);\r
- q.high = n.high >> sr;\r
- q.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);\r
- return q.all;\r
- }\r
- // K X\r
- // ---\r
- // 0 K\r
- sr = 1 + n_uword_bits + COUNT_LEADING_ZEROS(d.low) - COUNT_LEADING_ZEROS(n.high);\r
- // 2 <= sr <= n_udword_bits - 1\r
- // q.all = n.all << (n_udword_bits - sr);\r
- // r.all = n.all >> sr;\r
- // if (sr == n_uword_bits)\r
- // {\r
- // q.low = 0;\r
- // q.high = n.low;\r
- // r.high = 0;\r
- // r.low = n.high;\r
- // }\r
- // else if (sr < n_uword_bits) // 2 <= sr <= n_uword_bits - 1\r
- // {\r
- // q.low = 0;\r
- // q.high = n.low << (n_uword_bits - sr);\r
- // r.high = n.high >> sr;\r
- // r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);\r
- // }\r
- // else // n_uword_bits + 1 <= sr <= n_udword_bits - 1\r
- // {\r
- // q.low = n.low << (n_udword_bits - sr);\r
- // q.high = (n.high << (n_udword_bits - sr)) |\r
- // (n.low >> (sr - n_uword_bits));\r
- // r.high = 0;\r
- // r.low = n.high >> (sr - n_uword_bits);\r
- // }\r
- q.low = (n.low << (n_udword_bits - sr)) &\r
- ((INT32)(n_uword_bits - sr) >> (n_uword_bits-1));\r
- q.high = ((n.low << ( n_uword_bits - sr)) &\r
- ((INT32)(sr - n_uword_bits - 1) >> (n_uword_bits-1))) |\r
- (((n.high << (n_udword_bits - sr)) |\r
- (n.low >> (sr - n_uword_bits))) &\r
- ((INT32)(n_uword_bits - sr) >> (n_uword_bits-1)));\r
- r.high = (n.high >> sr) &\r
- ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1));\r
- r.low = ((n.high >> (sr - n_uword_bits)) &\r
- ((INT32)(n_uword_bits - sr - 1) >> (n_uword_bits-1))) |\r
- (((n.high << (n_uword_bits - sr)) |\r
- (n.low >> sr)) &\r
- ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1)));\r
- }\r
- else\r
- {\r
- // K X\r
- // ---\r
- // K K\r
- sr = COUNT_LEADING_ZEROS(d.high) - COUNT_LEADING_ZEROS(n.high);\r
- // 0 <= sr <= n_uword_bits - 1 or sr large\r
- if (sr > n_uword_bits - 1)\r
- {\r
- if (rem)\r
- *rem = n.all;\r
- return 0;\r
- }\r
- ++sr;\r
- // 1 <= sr <= n_uword_bits\r
- // q.all = n.all << (n_udword_bits - sr);\r
- q.low = 0;\r
- q.high = n.low << (n_uword_bits - sr);\r
- // r.all = n.all >> sr;\r
- // if (sr < n_uword_bits)\r
- // {\r
- // r.high = n.high >> sr;\r
- // r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);\r
- // }\r
- // else\r
- // {\r
- // r.high = 0;\r
- // r.low = n.high;\r
- // }\r
- r.high = (n.high >> sr) &\r
- ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1));\r
- r.low = (n.high << (n_uword_bits - sr)) |\r
- ((n.low >> sr) &\r
- ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1)));\r
- }\r
- }\r
- // Not a special case\r
- // q and r are initialized with:\r
- // q.all = n.all << (n_udword_bits - sr);\r
- // r.all = n.all >> sr;\r
- // 1 <= sr <= n_udword_bits - 1\r
- UINT32 carry = 0;\r
- for (; sr > 0; --sr)\r
- {\r
- // r:q = ((r:q) << 1) | carry\r
- r.high = (r.high << 1) | (r.low >> (n_uword_bits - 1));\r
- r.low = (r.low << 1) | (q.high >> (n_uword_bits - 1));\r
- q.high = (q.high << 1) | (q.low >> (n_uword_bits - 1));\r
- q.low = (q.low << 1) | carry;\r
- // carry = 0;\r
- // if (r.all >= d.all)\r
- // {\r
- // r.all -= d.all;\r
- // carry = 1;\r
- // }\r
- const INT64 s = (INT64)(d.all - r.all - 1) >> (n_udword_bits - 1);\r
- carry = s & 1;\r
- r.all -= d.all & s;\r
- }\r
- q.all = (q.all << 1) | carry;\r
- if (rem)\r
- *rem = r.all;\r
- return q.all;\r
-}\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 32-bit unsigned div, ported from LLVM code.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-\r
-// Returns: n / d\r
-\r
-// Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide\r
-\r
-UINT32\r
-__udivsi3(UINT32 n, UINT32 d)\r
-{\r
- const unsigned n_uword_bits = sizeof(UINT32) * CHAR_BIT;\r
- UINT32 q;\r
- UINT32 r;\r
- unsigned sr;\r
-\r
- // special cases\r
- if (d == 0) {\r
-// ASSERT (FALSE);\r
- return 0; // ?!\r
- }\r
- if (n == 0)\r
- return 0;\r
-\r
- sr = COUNT_LEADING_ZEROS(d) - COUNT_LEADING_ZEROS(n);\r
- // 0 <= sr <= n_uword_bits - 1 or sr large\r
- if (sr > n_uword_bits - 1) // d > r\r
- return 0;\r
- if (sr == n_uword_bits - 1) // d == 1\r
- return n;\r
- ++sr;\r
- // 1 <= sr <= n_uword_bits - 1\r
- // Not a special case\r
- q = n << (n_uword_bits - sr);\r
- r = n >> sr;\r
- UINT32 carry = 0;\r
- for (; sr > 0; --sr)\r
- {\r
- // r:q = ((r:q) << 1) | carry\r
- r = (r << 1) | (q >> (n_uword_bits - 1));\r
- q = (q << 1) | carry;\r
- // carry = 0;\r
- // if (r.all >= d.all)\r
- // {\r
- // r.all -= d.all;\r
- // carry = 1;\r
- // }\r
- const INT32 s = (INT32)(d - r - 1) >> (n_uword_bits - 1);\r
- carry = s & 1;\r
- r -= d & s;\r
- }\r
- q = (q << 1) | carry;\r
- return q;\r
-}\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "Llvm_int_lib.h"\r
-#include <Library/BaseLib.h>\r
-\r
-\r
-UINT32 __udivsi3(UINT32 n, UINT32 d);\r
-UINT32 __umodsi3(UINT32 a, UINT32 b);\r
-\r
-\r
-UINT64\r
-__aeabi_uidivmod(unsigned numerator, unsigned denominator)\r
-{\r
- UINT64 Return;\r
-\r
- Return = __udivsi3 (numerator, denominator);\r
- Return |= LShiftU64 (__umodsi3 (numerator, denominator), 32);\r
-\r
- return Return;\r
-}\r
-\r
-unsigned\r
-__aeabi_uidiv (unsigned n, unsigned d)\r
-{\r
- return __udivsi3 (n, d);\r
-}\r
-\r
-\r
-\r
-\r
-\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 64-bit unsigned mod, ported from LLVM code.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-UINT64 __udivmoddi4(UINT64 a, UINT64 b, UINT64* rem);\r
-\r
-// Returns: a % b\r
-\r
-UINT64\r
-__umoddi3(UINT64 a, UINT64 b)\r
-{\r
- UINT64 r;\r
- __udivmoddi4(a, b, &r);\r
- return r;\r
-}\r
-\r
+++ /dev/null
-/** @file\r
- Compiler intrinsic for 32-bit unsigned mod, ported from LLVM code.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-/**\r
- University of Illinois/NCSA\r
- Open Source License\r
-\r
- Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.\r
- All rights reserved.\r
-\r
- Developed by:\r
-\r
- LLVM Team\r
-\r
- University of Illinois at Urbana-Champaign\r
-\r
- http://llvm.org\r
-\r
- Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- this software and associated documentation files (the "Software"), to deal with\r
- the Software without restriction, including without limitation the rights to\r
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
- of the Software, and to permit persons to whom the Software is furnished to do\r
- so, subject to the following conditions:\r
-\r
- * Redistributions of source code must retain the above copyright notice,\r
- this list of conditions and the following disclaimers.\r
-\r
- * Redistributions in binary form must reproduce the above copyright notice,\r
- this list of conditions and the following disclaimers in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
- * Neither the names of the LLVM Team, University of Illinois at\r
- Urbana-Champaign, nor the names of its contributors may be used to\r
- endorse or promote products derived from this Software without specific\r
- prior written permission.\r
-\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
- SOFTWARE.\r
-**/\r
-\r
-\r
-#include "Llvm_int_lib.h"\r
-\r
-\r
-// Returns: a % b\r
-\r
-UINT32\r
-__umodsi3(UINT32 a, UINT32 b)\r
-{\r
- return a - (a / b) * b;\r
-}\r
\r
[Sources]\r
memcpy.c | RVCT\r
- memcpy.c | GCC\r
- memcpy_ms.c | MSFT\r
memset.c | RVCT\r
+\r
+ memcpy.c | GCC\r
memset.c | GCC\r
+\r
+ memcpy_ms.c | MSFT\r
memset_ms.c | MSFT\r
\r
[Sources.ARM]\r
Arm/uldiv.asm | RVCT\r
Arm/ldivmod.asm | RVCT\r
\r
+ Arm/ashrdi3.S | GCC\r
+ Arm/ashldi3.S | GCC\r
+ Arm/div.S | GCC\r
+ Arm/divdi3.S | GCC\r
+ Arm/divsi3.S | GCC\r
+ Arm/lshrdi3.S | GCC\r
+ Arm/memmove.S | GCC\r
+ Arm/modsi3.S | GCC\r
+ Arm/moddi3.S | GCC\r
+ Arm/muldi3.S | GCC\r
+ Arm/mullu.S | GCC\r
+ Arm/udivsi3.S | GCC\r
+ Arm/umodsi3.S | GCC\r
+ Arm/udivdi3.S | GCC\r
+ Arm/umoddi3.S | GCC\r
+ Arm/udivmoddi4.S | GCC\r
+ Arm/clzsi2.S | GCC\r
+ Arm/ctzsi2.S | GCC\r
+ Arm/ucmpdi2.S | GCC\r
+ Arm/switch8.S | GCC\r
+ Arm/switchu8.S | GCC\r
+ Arm/switch16.S | GCC\r
+ Arm/switch32.S | GCC\r
+ Arm/sourcery.S | GCC\r
+ Arm/uldiv.S | GCC\r
+ Arm/ldivmod.S | GCC\r
+ Arm/llsr.S | GCC\r
+ Arm/llsl.S | GCC\r
\r
-#\r
-# Move .c to .s to work around LLVM issues\r
-#\r
-# Arm/ashrdi3.c | GCC\r
-# Arm/ashldi3.c | GCC\r
-# Arm/divdi3.c | GCC\r
-# Arm/divsi3.c | GCC\r
-# Arm/lshrdi3.c | GCC\r
- Arm/ashrdi3.S | GCC\r
- Arm/ashldi3.S | GCC\r
- Arm/div.S | GCC\r
- Arm/divdi3.S | GCC\r
- Arm/divsi3.S | GCC\r
- Arm/lshrdi3.S | GCC\r
-\r
- Arm/memmove.S | GCC\r
-\r
-# Arm/modsi3.c | GCC\r
-# Arm/moddi3.c | GCC\r
-# Arm/muldi3.c | GCC\r
- Arm/modsi3.S | GCC\r
- Arm/moddi3.S | GCC\r
- Arm/muldi3.S | GCC\r
- Arm/mullu.S | GCC\r
-\r
-# Arm/udivsi3.c | GCC\r
-# Arm/umodsi3.c | GCC\r
-# Arm/udivdi3.c | GCC\r
-# Arm/umoddi3.c | GCC\r
-# Arm/udivmoddi4.c | GCC\r
- Arm/udivsi3.S | GCC\r
- Arm/umodsi3.S | GCC\r
- Arm/udivdi3.S | GCC\r
- Arm/umoddi3.S | GCC\r
- Arm/udivmoddi4.S | GCC\r
-\r
-# Arm/clzsi2.c | GCC\r
-# Arm/ctzsi2.c | GCC\r
-# Arm/ucmpdi2.c | GCC\r
- Arm/clzsi2.S | GCC\r
- Arm/ctzsi2.S | GCC\r
- Arm/ucmpdi2.S | GCC\r
- Arm/switch8.S | GCC\r
- Arm/switchu8.S | GCC\r
- Arm/switch16.S | GCC\r
- Arm/switch32.S | GCC\r
-\r
- Arm/sourcery.S | GCC\r
- Arm/uldiv.S | GCC\r
- Arm/ldivmod.S | GCC\r
-\r
- Arm/llsr.S | GCC\r
- Arm/llsl.S | GCC\r
-\r
- Arm/div.asm | MSFT\r
- Arm/uldiv.asm | MSFT\r
- Arm/ldivmod.asm | MSFT\r
- Arm/llsr.asm | MSFT\r
+ Arm/div.asm | MSFT\r
+ Arm/uldiv.asm | MSFT\r
+ Arm/ldivmod.asm | MSFT\r
+ Arm/llsr.asm | MSFT\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r
ArmPkg/ArmPkg.dec\r
\r
-[LibraryClasses]\r
-\r
[BuildOptions]\r
- MSFT:*_*_ARM_CC_FLAGS = /GL-\r
+ MSFT:*_*_*_CC_FLAGS = /GL-\r
MSFT:*_*_ARM_ASM_FLAGS = /oldit\r
- MSFT:*_*_AARCH64_CC_FLAGS = /GL-\r