From nobody Wed May 1 00:44:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+40490+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40490+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1557737675; cv=none; d=zoho.com; s=zohoarc; b=epKKWsYZb/0eKYBLDoXm6gFvQK46iw4FgkDTNctry+9t5R0Pl2Cl0+1YoAwMhsV8rLFf5EG3+2XussPqm0jtT4AhFFNNkPrhghq1iQ3P+8mO2tBWmZeMMXPB4Yaw91EZiBJyNcBL//YrnvqsBYrc0UaXAD8oRztem+exuldrtIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557737675; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=FtMlRoembPr3o18xx8EV3LDpGa3lFFckR2yX+Zx1Ybk=; b=hbWQDl3VCLGPD0DbnAYQfJvf/AtgMCr5gtmjVAqApU9bdXrXRkgjLL8iXBapB6YH0VIPtaId5eUHRFHYDvBT76huCvk8oIofK+u3VQSfTSbZ0GKFV8KDrP0gIwmPLYysfukCoFlvlQBhVhgwOCW7S4Y+Z70M/j8vTyzgV9DSetM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40490+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1557737675925230.64328785971247; Mon, 13 May 2019 01:54:35 -0700 (PDT) Return-Path: X-Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by groups.io with SMTP; Mon, 13 May 2019 01:54:34 -0700 X-Received: by mail-ed1-f67.google.com with SMTP id g57so16423426edc.12 for ; Mon, 13 May 2019 01:54:33 -0700 (PDT) X-Gm-Message-State: APjAAAX7t4X7q7OdXNC9AUIpw6ygmnAS4hQae0/goWFrcIbx8fSHL+nU JxeLXSgutg441JSYtxhBDTJcELmdwIU= X-Google-Smtp-Source: APXvYqzKFJh5JkPiO+l0hxKZvzCgyPqOms1KYergKgKtMvtCYeemCatH1ilTg2WIsYNaH24TJ6kUSg== X-Received: by 2002:a50:84a1:: with SMTP id 30mr27470035edq.105.1557737670812; Mon, 13 May 2019 01:54:30 -0700 (PDT) X-Received: from localhost.localdomain ([84.203.49.55]) by smtp.gmail.com with ESMTPSA id k57sm3595701ede.17.2019.05.13.01.54.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 01:54:29 -0700 (PDT) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org Subject: [edk2-devel] [PATCH v2 1/4] ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf Date: Mon, 13 May 2019 09:54:13 +0100 Message-Id: <20190513085416.1352-2-pete@akeo.ie> In-Reply-To: <20190513085416.1352-1-pete@akeo.ie> References: <20190513085416.1352-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1557737674; bh=+39rTI7gJbpKF4wq0rPh6fOihfpjEhzUzaU/QDxzaCY=; h=Cc:Date:From:Reply-To:Subject:To; b=Orce88gOSiYNIOyYK6dNFaYz9cFT15gtzsSm8onUCxGIHvZ4+QHYgpTXY2Czyem7fQZ ZmO6tM96awVcWRirx/MSYhu/foxJJG6xWH34Nk3NHLvsXQn1F1umv3FnwS46ujRJEhFoq xN9ArCQE0BeBah9cJyuhrZEn2kC+e/RcczQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" None of the .c/.h in Arm/ are used any more =3D> 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 Cc: Leif Lindholm Signed-off-by: Pete Batard --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h | 93 -----= -- ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.c | 77 ------ ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.c | 78 ------ ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.c | 90 -----= -- ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.c | 92 -----= -- ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.c | 71 ----- ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.c | 72 ----- ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.c | 77 ------ ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.c | 71 ----- ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.c | 64 ----- ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.c | 92 -----= -- ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.c | 76 ------ ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.c | 65 ----- ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.c | 281 -----= --------------- ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.c | 105 -----= --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c | 37 --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.c | 66 ----- ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.c | 62 ----- ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 103 +++--= -- 19 files changed, 38 insertions(+), 1634 deletions(-) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h b/ArmP= kg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h deleted file mode 100644 index 38bcad6b90cc..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h +++ /dev/null @@ -1,93 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - -#include -#include - -#define CHAR_BIT 8 - -typedef union { - INT64 all; - struct { - UINT32 low; - INT32 high; - }; -} dwords; - -typedef union { - UINT64 all; - struct { - UINT32 low; - UINT32 high; - }; -} udwords; - -// __aeabi_ return values -typedef struct { - UINT64 Quotent; - UINT64 Remainder; -} ulldiv_t; - -typedef struct { - INT64 Quotent; - INT64 Remainder; -} lldiv_t; - -typedef struct { - UINT32 Quotent; - UINT32 Remainder; -} uidiv_return; - -#if __GNUC__ - #define COUNT_LEADING_ZEROS(_a) __builtin_clz((_a)) - #define COUNT_TRAILING_ZEROS(_a) __builtin_ctz((_a)) -#else -#error COUNT_LEADING_ZEROS() and COUNT_TRAILING_ZEROS() macros not ported = to your compiler -#endif diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/ashldi3.c deleted file mode 100644 index 0a1adb86eabe..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.c +++ /dev/null @@ -1,77 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - -#include "Llvm_int_lib.h" - -// Returns: a << b - -// Precondition: 0 <=3D b < bits_in_dword - -INT64 -__ashldi3(INT64 a, INT32 b) -{ - const int bits_in_word =3D (int)(sizeof(INT32) * CHAR_BIT); - dwords input; - dwords result; - input.all =3D a; - if (b & bits_in_word) // bits_in_word <=3D b < bits_in_dword - { - result.low =3D 0; - result.high =3D input.low << (b - bits_in_word); - } - else // 0 <=3D b < bits_in_word - { - if (b =3D=3D 0) - return a; - result.low =3D input.low << b; - result.high =3D (input.high << b) | (input.low >> (bits_in_word - = b)); - } - return result.all; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/ashrdi3.c deleted file mode 100644 index 5d9307e1c068..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.c +++ /dev/null @@ -1,78 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - -#include "Llvm_int_lib.h" - -// Returns: arithmetic a >> b - -// Precondition: 0 <=3D b < bits_in_dword - -INT64 -__ashrdi3(INT64 a, INT32 b) -{ - const int bits_in_word =3D (int)(sizeof(INT32) * CHAR_BIT); - dwords input; - dwords result; - input.all =3D a; - if (b & bits_in_word) // bits_in_word <=3D b < bits_in_dword - { - // result.high =3D input.high < 0 ? -1 : 0 - result.high =3D input.high >> (bits_in_word - 1); - result.low =3D input.high >> (b - bits_in_word); - } - else // 0 <=3D b < bits_in_word - { - if (b =3D=3D 0) - return a; - result.high =3D input.high >> b; - result.low =3D (input.high << (bits_in_word - b)) | (input.low >> = b); - } - return result.all; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/clzsi2.c deleted file mode 100644 index d454748268ec..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.c +++ /dev/null @@ -1,90 +0,0 @@ -/** @file - Compiler intrinsic to return the number of leading zeros, ported from LL= VM code. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -// Returns: the number of leading 0-bits - -// Precondition: a !=3D 0 - -INT32 -__clzsi2(INT32 a) -{ - UINT32 x =3D (UINT32)a; - INT32 t =3D ((x & 0xFFFF0000) =3D=3D 0) << 4; // if (x is small) t = =3D 16 else 0 - x >>=3D 16 - t; // x =3D [0 - 0xFFFF] - UINT32 r =3D t; // r =3D [0, 16] - // return r + clz(x) - t =3D ((x & 0xFF00) =3D=3D 0) << 3; - x >>=3D 8 - t; // x =3D [0 - 0xFF] - r +=3D t; // r =3D [0, 8, 16, 24] - // return r + clz(x) - t =3D ((x & 0xF0) =3D=3D 0) << 2; - x >>=3D 4 - t; // x =3D [0 - 0xF] - r +=3D t; // r =3D [0, 4, 8, 12, 16, 20, 24, 28] - // return r + clz(x) - t =3D ((x & 0xC) =3D=3D 0) << 1; - x >>=3D 2 - t; // x =3D [0 - 3] - r +=3D t; // r =3D [0 - 30] and is even - // return r + clz(x) -// switch (x) -// { -// case 0: -// return r + 2; -// case 1: -// return r + 1; -// case 2: -// case 3: -// return r; -// } - return r + ((2 - x) & -((x & 2) =3D=3D 0)); -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/ctzsi2.c deleted file mode 100644 index 930a75f85ed3..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.c +++ /dev/null @@ -1,92 +0,0 @@ -/** @file - Compiler intrinsic to return the number of trailing zeros, ported from L= LVM code. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -// Returns: the number of trailing 0-bits - -// Precondition: a !=3D 0 - -INT32 -__ctzsi2(INT32 a) -{ - UINT32 x =3D (UINT32)a; - INT32 t =3D ((x & 0x0000FFFF) =3D=3D 0) << 4; // if (x has no small b= its) t =3D 16 else 0 - x >>=3D t; // x =3D [0 - 0xFFFF] + higher garbage bits - UINT32 r =3D t; // r =3D [0, 16] - // return r + ctz(x) - t =3D ((x & 0x00FF) =3D=3D 0) << 3; - x >>=3D t; // x =3D [0 - 0xFF] + higher garbage bits - r +=3D t; // r =3D [0, 8, 16, 24] - // return r + ctz(x) - t =3D ((x & 0x0F) =3D=3D 0) << 2; - x >>=3D t; // x =3D [0 - 0xF] + higher garbage bits - r +=3D t; // r =3D [0, 4, 8, 12, 16, 20, 24, 28] - // return r + ctz(x) - t =3D ((x & 0x3) =3D=3D 0) << 1; - x >>=3D t; - x &=3D 3; // x =3D [0 - 3] - r +=3D t; // r =3D [0 - 30] and is even - // return r + ctz(x) -// The branch-less return statement below is equivalent -// to the following switch statement: -// switch (x) -// { -// case 0: -// return r + 2; -// case 2: -// return r + 1; -// case 1: -// case 3: -// return r; -// } - return r + ((2 - (x >> 1)) & -((x & 1) =3D=3D 0)); -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/divdi3.c deleted file mode 100644 index 320870a06e1c..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.c +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - Compiler intrinsic for 64-bit compare, ported from LLVM code. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -UINT64 __udivmoddi4(UINT64 a, UINT64 b, UINT64* rem); - -// Returns: a / b - -INT64 -__divdi3(INT64 a, INT64 b) -{ - const int bits_in_dword_m1 =3D (int)(sizeof(INT64) * CHAR_BIT) - 1; - INT64 s_a =3D a >> bits_in_dword_m1; // s_a =3D a < 0 ? -1 := 0 - INT64 s_b =3D b >> bits_in_dword_m1; // s_b =3D b < 0 ? -1 := 0 - a =3D (a ^ s_a) - s_a; // negate if s_a =3D=3D= -1 - b =3D (b ^ s_b) - s_b; // negate if s_b =3D=3D= -1 - s_a ^=3D s_b; // sign of quotient - return (__udivmoddi4(a, b, (UINT64*)0) ^ s_a) - s_a; // negate if s_a= =3D=3D -1 -} - - diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/divsi3.c deleted file mode 100644 index 804886db4096..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.c +++ /dev/null @@ -1,72 +0,0 @@ -/** @file - Compiler intrinsic for 32--bit unsigned division, ported from LLVM code. - - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -UINT32 __udivsi3(UINT32 n, UINT32 d); - -// Returns: a / b - -INT32 -__divsi3(INT32 a, INT32 b) -{ - const int bits_in_word_m1 =3D (int)(sizeof(INT32) * CHAR_BIT) - 1; - INT32 s_a =3D a >> bits_in_word_m1; // s_a =3D a < 0 ? -1 : 0 - INT32 s_b =3D b >> bits_in_word_m1; // s_b =3D b < 0 ? -1 : 0 - a =3D (a ^ s_a) - s_a; // negate if s_a =3D=3D= -1 - b =3D (b ^ s_b) - s_b; // negate if s_b =3D=3D= -1 - s_a ^=3D s_b; // sign of quotient - return (__udivsi3(a, b) ^ s_a) - s_a; // negate if s_a =3D=3D -1 -} - - diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/lshrdi3.c deleted file mode 100644 index 83129b27135c..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.c +++ /dev/null @@ -1,77 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - -#include "Llvm_int_lib.h" - -// Returns: logical a >> b - -// Precondition: 0 <=3D b < bits_in_dword - -INT64 -__lshrdi3(INT64 a, INT32 b) -{ - const int bits_in_word =3D (int)(sizeof(INT32) * CHAR_BIT); - udwords input; - udwords result; - input.all =3D a; - if (b & bits_in_word) // bits_in_word <=3D b < bits_in_dword - { - result.high =3D 0; - result.low =3D input.high >> (b - bits_in_word); - } - else // 0 <=3D b < bits_in_word - { - if (b =3D=3D 0) - return a; - result.high =3D input.high >> b; - result.low =3D (input.high << (bits_in_word - b)) | (input.low >> = b); - } - return result.all; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/moddi3.c deleted file mode 100644 index cd333a34c124..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.c +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - Compiler intrinsic for 64-bit mod, ported from LLVM code. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -UINT64 __udivmoddi4(UINT64 a, UINT64 b, UINT64* rem); - -// Returns: a % b - -INT64 -__moddi3(INT64 a, INT64 b) -{ - const int bits_in_dword_m1 =3D (int)(sizeof(INT64) * CHAR_BIT) - 1; - INT64 s =3D b >> bits_in_dword_m1; // s =3D b < 0 ? -1 : 0 - b =3D (b ^ s) - s; // negate if s =3D=3D -1 - s =3D a >> bits_in_dword_m1; // s =3D a < 0 ? -1 : 0 - a =3D (a ^ s) - s; // negate if s =3D=3D -1 - INT64 r; - __udivmoddi4(a, b, (UINT64*)&r); - return (r ^ s) - s; // negate if s =3D=3D -1 -} - diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/modsi3.c deleted file mode 100644 index 964c3462f7c6..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - Compiler intrinsic for 32-bit mod, ported from LLVM code. - - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -// Returns: a % b - -INT32 -__modsi3(INT32 a, INT32 b) -{ - return a - (a / b) * b; -} - - diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/muldi3.c deleted file mode 100644 index 869c4beb0fba..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.c +++ /dev/null @@ -1,92 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - -#include -#include "Llvm_int_lib.h" - - -// Returns: a * b - -static -INT64 -__muldsi3(UINT32 a, UINT32 b) -{ - dwords r; - const int bits_in_word_2 =3D (int)(sizeof(INT32) * CHAR_BIT) / 2; - const UINT32 lower_mask =3D (UINT32)~0 >> bits_in_word_2; - r.low =3D (a & lower_mask) * (b & lower_mask); - UINT32 t =3D r.low >> bits_in_word_2; - r.low &=3D lower_mask; - t +=3D (a >> bits_in_word_2) * (b & lower_mask); - r.low +=3D (t & lower_mask) << bits_in_word_2; - r.high =3D t >> bits_in_word_2; - t =3D r.low >> bits_in_word_2; - r.low &=3D lower_mask; - t +=3D (b >> bits_in_word_2) * (a & lower_mask); - r.low +=3D (t & lower_mask) << bits_in_word_2; - r.high +=3D t >> bits_in_word_2; - r.high +=3D (a >> bits_in_word_2) * (b >> bits_in_word_2); - return r.all; -} - -// Returns: a * b - -INT64 -__muldi3(INT64 a, INT64 b) -{ - dwords x; - x.all =3D a; - dwords y; - y.all =3D b; - dwords r; - r.all =3D __muldsi3(x.low, y.low); - r.high +=3D x.high * y.low + x.low * y.high; - return r.all; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/ucmpdi2.c deleted file mode 100644 index 89c367f0360f..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.c +++ /dev/null @@ -1,76 +0,0 @@ -/** @file - Compiler intrinsic for 64-bit compare, ported from LLVM code. - - Copyright (c) 2008-2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - - -// Returns: if (a < b) returns 0 -// if (a =3D=3D b) returns 1 -// if (a > b) returns 2 - -UINT32 -__ucmpdi2(UINT64 a, UINT64 b) -{ - udwords x; - x.all =3D a; - udwords y; - y.all =3D b; - if (x.high < y.high) - return 0; - if (x.high > y.high) - return 2; - if (x.low < y.low) - return 0; - if (x.low > y.low) - return 2; - return 1; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/udivdi3.c deleted file mode 100644 index 6718dd8f141c..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.c +++ /dev/null @@ -1,65 +0,0 @@ -/** @file - Compiler intrinsic for 64-bit unisigned div, ported from LLVM code. - - Copyright (c) 2008-2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -UINT64 __udivmoddi4 (UINT64 a, UINT64 b, UINT64 *rem); - -// Returns: a / b - -UINT64 -__udivdi3(UINT64 a, UINT64 b) -{ - return __udivmoddi4(a, b, 0); -} - - diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.c b/ArmPkg= /Library/CompilerIntrinsicsLib/Arm/udivmoddi4.c deleted file mode 100644 index 1dca318623c4..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.c +++ /dev/null @@ -1,281 +0,0 @@ -/** @file - Compiler intrinsic for 64-bit compare, ported from LLVM code. - - Copyright (c) 2008-2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -// Effects: if rem !=3D 0, *rem =3D a % b -// Returns: a / b - -// Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide - -UINT64 -__udivmoddi4 (UINT64 a, UINT64 b, UINT64* rem) -{ - const unsigned n_uword_bits =3D sizeof(UINT32) * CHAR_BIT; - const unsigned n_udword_bits =3D sizeof(UINT64) * CHAR_BIT; - udwords n; - n.all =3D a; - udwords d; - d.all =3D b; - udwords q; - udwords r; - unsigned sr; - - if (b =3D=3D 0) { -// ASSERT (FALSE); - return 0; - } - - // special cases, X is unknown, K !=3D 0 - if (n.high =3D=3D 0) - { - if (d.high =3D=3D 0) - { - // 0 X - // --- - // 0 X - if (rem) - *rem =3D n.low % d.low; - return n.low / d.low; - } - // 0 X - // --- - // K X - if (rem) - *rem =3D n.low; - return 0; - } - // n.high !=3D 0 - if (d.low =3D=3D 0) - { - if (d.high =3D=3D 0) - { - // K X - // --- - // 0 0 - if (rem) - *rem =3D n.high % d.low; - return n.high / d.low; - } - // d.high !=3D 0 - if (n.low =3D=3D 0) - { - // K 0 - // --- - // K 0 - if (rem) - { - r.high =3D n.high % d.high; - r.low =3D 0; - *rem =3D r.all; - } - return n.high / d.high; - } - // K K - // --- - // K 0 - if ((d.high & (d.high - 1)) =3D=3D 0) // if d is a power of 2 - { - if (rem) - { - r.low =3D n.low; - r.high =3D n.high & (d.high - 1); - *rem =3D r.all; - } - return n.high >> COUNT_TRAILING_ZEROS(d.high); - } - // K K - // --- - // K 0 - sr =3D COUNT_LEADING_ZEROS(d.high) - COUNT_LEADING_ZEROS(n.high); - // 0 <=3D sr <=3D n_uword_bits - 2 or sr large - if (sr > n_uword_bits - 2) - { - if (rem) - *rem =3D n.all; - return 0; - } - ++sr; - // 1 <=3D sr <=3D n_uword_bits - 1 - // q.all =3D n.all << (n_udword_bits - sr); - q.low =3D 0; - q.high =3D n.low << (n_uword_bits - sr); - // r.all =3D n.all >> sr; - r.high =3D n.high >> sr; - r.low =3D (n.high << (n_uword_bits - sr)) | (n.low >> sr); - } - else // d.low !=3D 0 - { - if (d.high =3D=3D 0) - { - // K X - // --- - // 0 K - if ((d.low & (d.low - 1)) =3D=3D 0) // if d is a power of 2 - { - if (rem) - *rem =3D n.low & (d.low - 1); - if (d.low =3D=3D 1) - return n.all; - unsigned sr =3D COUNT_TRAILING_ZEROS(d.low); - q.high =3D n.high >> sr; - q.low =3D (n.high << (n_uword_bits - sr)) | (n.low >> sr); - return q.all; - } - // K X - // --- - // 0 K - sr =3D 1 + n_uword_bits + COUNT_LEADING_ZEROS(d.low) - COUNT_L= EADING_ZEROS(n.high); - // 2 <=3D sr <=3D n_udword_bits - 1 - // q.all =3D n.all << (n_udword_bits - sr); - // r.all =3D n.all >> sr; - // if (sr =3D=3D n_uword_bits) - // { - // q.low =3D 0; - // q.high =3D n.low; - // r.high =3D 0; - // r.low =3D n.high; - // } - // else if (sr < n_uword_bits) // 2 <=3D sr <=3D n_uword_bits= - 1 - // { - // q.low =3D 0; - // q.high =3D n.low << (n_uword_bits - sr); - // r.high =3D n.high >> sr; - // r.low =3D (n.high << (n_uword_bits - sr)) | (n.low >> s= r); - // } - // else // n_uword_bits + 1 <=3D sr <=3D n_udword= _bits - 1 - // { - // q.low =3D n.low << (n_udword_bits - sr); - // q.high =3D (n.high << (n_udword_bits - sr)) | - // (n.low >> (sr - n_uword_bits)); - // r.high =3D 0; - // r.low =3D n.high >> (sr - n_uword_bits); - // } - q.low =3D (n.low << (n_udword_bits - sr)) & - ((INT32)(n_uword_bits - sr) >> (n_uword_bits-1)); - q.high =3D ((n.low << ( n_uword_bits - sr)) = & - ((INT32)(sr - n_uword_bits - 1) >> (n_uword_bits-1)))= | - (((n.high << (n_udword_bits - sr)) = | - (n.low >> (sr - n_uword_bits))) = & - ((INT32)(n_uword_bits - sr) >> (n_uword_bits-1))); - r.high =3D (n.high >> sr) & - ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1)); - r.low =3D ((n.high >> (sr - n_uword_bits)) = & - ((INT32)(n_uword_bits - sr - 1) >> (n_uword_bits-1)))= | - (((n.high << (n_uword_bits - sr)) = | - (n.low >> sr)) = & - ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1))); - } - else - { - // K X - // --- - // K K - sr =3D COUNT_LEADING_ZEROS(d.high) - COUNT_LEADING_ZEROS(n.hig= h); - // 0 <=3D sr <=3D n_uword_bits - 1 or sr large - if (sr > n_uword_bits - 1) - { - if (rem) - *rem =3D n.all; - return 0; - } - ++sr; - // 1 <=3D sr <=3D n_uword_bits - // q.all =3D n.all << (n_udword_bits - sr); - q.low =3D 0; - q.high =3D n.low << (n_uword_bits - sr); - // r.all =3D n.all >> sr; - // if (sr < n_uword_bits) - // { - // r.high =3D n.high >> sr; - // r.low =3D (n.high << (n_uword_bits - sr)) | (n.low >> s= r); - // } - // else - // { - // r.high =3D 0; - // r.low =3D n.high; - // } - r.high =3D (n.high >> sr) & - ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1)); - r.low =3D (n.high << (n_uword_bits - sr)) | - ((n.low >> sr) & - ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1))); - } - } - // Not a special case - // q and r are initialized with: - // q.all =3D n.all << (n_udword_bits - sr); - // r.all =3D n.all >> sr; - // 1 <=3D sr <=3D n_udword_bits - 1 - UINT32 carry =3D 0; - for (; sr > 0; --sr) - { - // r:q =3D ((r:q) << 1) | carry - r.high =3D (r.high << 1) | (r.low >> (n_uword_bits - 1)); - r.low =3D (r.low << 1) | (q.high >> (n_uword_bits - 1)); - q.high =3D (q.high << 1) | (q.low >> (n_uword_bits - 1)); - q.low =3D (q.low << 1) | carry; - // carry =3D 0; - // if (r.all >=3D d.all) - // { - // r.all -=3D d.all; - // carry =3D 1; - // } - const INT64 s =3D (INT64)(d.all - r.all - 1) >> (n_udword_bits - 1= ); - carry =3D s & 1; - r.all -=3D d.all & s; - } - q.all =3D (q.all << 1) | carry; - if (rem) - *rem =3D r.all; - return q.all; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/udivsi3.c deleted file mode 100644 index e1340861fe6d..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.c +++ /dev/null @@ -1,105 +0,0 @@ -/** @file - Compiler intrinsic for 32-bit unsigned div, ported from LLVM code. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - - -// Returns: n / d - -// Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide - -UINT32 -__udivsi3(UINT32 n, UINT32 d) -{ - const unsigned n_uword_bits =3D sizeof(UINT32) * CHAR_BIT; - UINT32 q; - UINT32 r; - unsigned sr; - - // special cases - if (d =3D=3D 0) { -// ASSERT (FALSE); - return 0; // ?! - } - if (n =3D=3D 0) - return 0; - - sr =3D COUNT_LEADING_ZEROS(d) - COUNT_LEADING_ZEROS(n); - // 0 <=3D sr <=3D n_uword_bits - 1 or sr large - if (sr > n_uword_bits - 1) // d > r - return 0; - if (sr =3D=3D n_uword_bits - 1) // d =3D=3D 1 - return n; - ++sr; - // 1 <=3D sr <=3D n_uword_bits - 1 - // Not a special case - q =3D n << (n_uword_bits - sr); - r =3D n >> sr; - UINT32 carry =3D 0; - for (; sr > 0; --sr) - { - // r:q =3D ((r:q) << 1) | carry - r =3D (r << 1) | (q >> (n_uword_bits - 1)); - q =3D (q << 1) | carry; - // carry =3D 0; - // if (r.all >=3D d.all) - // { - // r.all -=3D d.all; - // carry =3D 1; - // } - const INT32 s =3D (INT32)(d - r - 1) >> (n_uword_bits - 1); - carry =3D s & 1; - r -=3D d & s; - } - q =3D (q << 1) | carry; - return q; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c b/ArmPkg/L= ibrary/CompilerIntrinsicsLib/Arm/uldivmod.c deleted file mode 100644 index 1e0fba2419fc..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "Llvm_int_lib.h" -#include - - -UINT32 __udivsi3(UINT32 n, UINT32 d); -UINT32 __umodsi3(UINT32 a, UINT32 b); - - -UINT64 -__aeabi_uidivmod(unsigned numerator, unsigned denominator) -{ - UINT64 Return; - - Return =3D __udivsi3 (numerator, denominator); - Return |=3D LShiftU64 (__umodsi3 (numerator, denominator), 32); - - return Return; -} - -unsigned -__aeabi_uidiv (unsigned n, unsigned d) -{ - return __udivsi3 (n, d); -} - - - - - diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/umoddi3.c deleted file mode 100644 index f5bef991db26..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - Compiler intrinsic for 64-bit unsigned mod, ported from LLVM code. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - -UINT64 __udivmoddi4(UINT64 a, UINT64 b, UINT64* rem); - -// Returns: a % b - -UINT64 -__umoddi3(UINT64 a, UINT64 b) -{ - UINT64 r; - __udivmoddi4(a, b, &r); - return r; -} - diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.c b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/umodsi3.c deleted file mode 100644 index 85151712309c..000000000000 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.c +++ /dev/null @@ -1,62 +0,0 @@ -/** @file - Compiler intrinsic for 32-bit unsigned mod, ported from LLVM code. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -/** - University of Illinois/NCSA - Open Source License - - Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. - All rights reserved. - - Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - - Permission is hereby granted, free of charge, to any person obtaining a = copy of - this software and associated documentation files (the "Software"), to de= al with - the Software without restriction, including without limitation the right= s to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell c= opies - of the Software, and to permit persons to whom the Software is furnished= to do - so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright not= ice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright = notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distributio= n. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without spe= cific - prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS W= ITH THE - SOFTWARE. -**/ - - -#include "Llvm_int_lib.h" - - -// Returns: a % b - -UINT32 -__umodsi3(UINT32 a, UINT32 b) -{ - return a - (a / b) * b; -} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf= b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf index 0d5634959993..0203ecb4870f 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf +++ b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf @@ -19,10 +19,12 @@ [Defines] =20 [Sources] memcpy.c | RVCT - memcpy.c | GCC - memcpy_ms.c | MSFT memset.c | RVCT + + memcpy.c | GCC memset.c | GCC + + memcpy_ms.c | MSFT memset_ms.c | MSFT =20 [Sources.ARM] @@ -38,73 +40,44 @@ [Sources.ARM] Arm/uldiv.asm | RVCT Arm/ldivmod.asm | RVCT =20 - -# -# Move .c to .s to work around LLVM issues -# -# Arm/ashrdi3.c | GCC -# Arm/ashldi3.c | GCC -# Arm/divdi3.c | GCC -# Arm/divsi3.c | GCC -# Arm/lshrdi3.c | GCC - Arm/ashrdi3.S | GCC - Arm/ashldi3.S | GCC - Arm/div.S | GCC - Arm/divdi3.S | GCC - Arm/divsi3.S | GCC - Arm/lshrdi3.S | GCC - - Arm/memmove.S | GCC - -# Arm/modsi3.c | GCC -# Arm/moddi3.c | GCC -# Arm/muldi3.c | GCC - Arm/modsi3.S | GCC - Arm/moddi3.S | GCC - Arm/muldi3.S | GCC - Arm/mullu.S | GCC - -# Arm/udivsi3.c | GCC -# Arm/umodsi3.c | GCC -# Arm/udivdi3.c | GCC -# Arm/umoddi3.c | GCC -# Arm/udivmoddi4.c | GCC - Arm/udivsi3.S | GCC - Arm/umodsi3.S | GCC - Arm/udivdi3.S | GCC - Arm/umoddi3.S | GCC - Arm/udivmoddi4.S | GCC - -# Arm/clzsi2.c | GCC -# Arm/ctzsi2.c | GCC -# Arm/ucmpdi2.c | GCC - Arm/clzsi2.S | GCC - Arm/ctzsi2.S | GCC - Arm/ucmpdi2.S | GCC - Arm/switch8.S | GCC - Arm/switchu8.S | GCC - Arm/switch16.S | GCC - Arm/switch32.S | GCC - - Arm/sourcery.S | GCC - Arm/uldiv.S | GCC - Arm/ldivmod.S | GCC - - Arm/llsr.S | GCC - Arm/llsl.S | GCC - - Arm/div.asm | MSFT - Arm/uldiv.asm | MSFT - Arm/ldivmod.asm | MSFT - Arm/llsr.asm | MSFT + Arm/ashrdi3.S | GCC + Arm/ashldi3.S | GCC + Arm/div.S | GCC + Arm/divdi3.S | GCC + Arm/divsi3.S | GCC + Arm/lshrdi3.S | GCC + Arm/memmove.S | GCC + Arm/modsi3.S | GCC + Arm/moddi3.S | GCC + Arm/muldi3.S | GCC + Arm/mullu.S | GCC + Arm/udivsi3.S | GCC + Arm/umodsi3.S | GCC + Arm/udivdi3.S | GCC + Arm/umoddi3.S | GCC + Arm/udivmoddi4.S | GCC + Arm/clzsi2.S | GCC + Arm/ctzsi2.S | GCC + Arm/ucmpdi2.S | GCC + Arm/switch8.S | GCC + Arm/switchu8.S | GCC + Arm/switch16.S | GCC + Arm/switch32.S | GCC + Arm/sourcery.S | GCC + Arm/uldiv.S | GCC + Arm/ldivmod.S | GCC + Arm/llsr.S | GCC + Arm/llsl.S | GCC + + Arm/div.asm | MSFT + Arm/uldiv.asm | MSFT + Arm/ldivmod.asm | MSFT + Arm/llsr.asm | MSFT =20 [Packages] MdePkg/MdePkg.dec ArmPkg/ArmPkg.dec =20 -[LibraryClasses] - [BuildOptions] - MSFT:*_*_ARM_CC_FLAGS =3D /GL- + MSFT:*_*_*_CC_FLAGS =3D /GL- MSFT:*_*_ARM_ASM_FLAGS =3D /oldit - MSFT:*_*_AARCH64_CC_FLAGS =3D /GL- --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#40490): https://edk2.groups.io/g/devel/message/40490 Mute This Topic: https://groups.io/mt/31605111/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 1 00:44:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+40489+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40489+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1557737675; cv=none; d=zoho.com; s=zohoarc; b=Z9unRyM1DxKLi1Bx4dpQV1FC++Th4sAYV0f+qNh3EnUKIRS6r7WS3NjCXlrAerM0qhGKDYIP7VrqzFSX8iJq8qbjRHcfEqyMsHqiganWKFvh0UKyP+wpuyjh9+8JvuN6hrHxdfhnasqtSfjgS5qcbV/o6g/l4yXnStOxusjZyvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557737675; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=sYw1/zhxPQnuWWW3QXQZItMbEOzexYmT6i72glr9okk=; b=Z70FhvtN/cBrGcvsItijLQQiIasPy4tGNY4JkujB6MJZ6X51c6+nV0LtnsY0ouHkce0g9QwmcaaItWZQ6F+mMAtW2q14jfeJlTDWc3h9UdypyBXM/3YNuNJseUxmrQV6d6AtMKnm3oXijODoRAe+5za/IluRmzt+uCUf3SMoG7Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40489+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1557737675543640.7499467742086; Mon, 13 May 2019 01:54:35 -0700 (PDT) Return-Path: X-Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by groups.io with SMTP; Mon, 13 May 2019 01:54:34 -0700 X-Received: by mail-ed1-f48.google.com with SMTP id e24so16418491edq.6 for ; Mon, 13 May 2019 01:54:33 -0700 (PDT) X-Gm-Message-State: APjAAAV2fFS7sS9+MqjDXQUJI/E51yvyd2z0tutiZ4oCb5u/tGJ7kqex fSAGewsl+tVcG9ZFYjB6GMRWgdSFuYw= X-Google-Smtp-Source: APXvYqy8zVAV6oEYJkh5ngZk3RFN/mE0Vep/CgtWdiUIAGxL/CjbIUPbzqL3zW4ybcbpt7J7bNuM0g== X-Received: by 2002:a17:906:4995:: with SMTP id p21mr17254562eju.140.1557737672179; Mon, 13 May 2019 01:54:32 -0700 (PDT) X-Received: from localhost.localdomain ([84.203.49.55]) by smtp.gmail.com with ESMTPSA id k57sm3595701ede.17.2019.05.13.01.54.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 01:54:31 -0700 (PDT) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org Subject: [edk2-devel] [PATCH v2 2/4] ArmPkg/CompilerIntrinsicsLib: Add memcmp, memmove intrinsics for MSFT Date: Mon, 13 May 2019 09:54:14 +0100 Message-Id: <20190513085416.1352-3-pete@akeo.ie> In-Reply-To: <20190513085416.1352-1-pete@akeo.ie> References: <20190513085416.1352-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1557737674; bh=da38peRHltauMh7Y6iY3R/tYYukh7F3uSBGPhsukFuU=; h=Cc:Date:From:Reply-To:Subject:To; b=gapwVbIx8J6P6LFfi9v6oMatWlAPlbgZBx9cUzQsubrR+BuWJTs5ku9e31JE3Iiqhhn wtfa3ckZuzQLZeYptPZAhzjL8S9wHlSHsgIz/hTfxDVrT9cRtVrrZQXTD/i/gxpSOJeLT vrJ6KIUvhKQq5J1fbkj49+T38cjwMICIlDw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" We could have reused memmove.asm for ARM, but we would still need to add an implemention for ARM64, so we use the same source for both archs. Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Pete Batard --- ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 2 ++ ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c | 31 ++++++= ++++++++++++ ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c | 34 ++++++= ++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf= b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf index 0203ecb4870f..d6cc63db75c7 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf +++ b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf @@ -26,6 +26,8 @@ [Sources] =20 memcpy_ms.c | MSFT memset_ms.c | MSFT + memcmp_ms.c | MSFT + memmove_ms.c | MSFT =20 [Sources.ARM] Arm/mullu.asm | RVCT diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c b/ArmPkg/Libr= ary/CompilerIntrinsicsLib/memcmp_ms.c new file mode 100644 index 000000000000..551f8e77c12f --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------= ------ +// +// Copyright (c) 2019, Pete Batard. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +//------------------------------------------------------------------------= ------ + +#if defined(_M_ARM64) +typedef unsigned __int64 size_t; +#else +typedef unsigned __int32 size_t; +#endif + +int memcmp(void *, void *, size_t); +#pragma intrinsic(memcmp) +#pragma function(memcmp) +int memcmp(const void *s1, const void *s2, size_t n) +{ + unsigned char const *t1 =3D s1; + unsigned char const *t2 =3D s2; + + while (n--) { + if (*t1 !=3D *t2) + return (int)*t1 - (int)*t2; + t1++; + t2++; + } + + return 0; +} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/memmove_ms.c new file mode 100644 index 000000000000..5b261ef8b948 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------= ------ +// +// Copyright (c) 2019, Pete Batard. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +//------------------------------------------------------------------------= ------ + +#if defined(_M_ARM64) +typedef unsigned __int64 size_t; +#else +typedef unsigned __int32 size_t; +#endif + +void* memmove(void *, const void *, size_t); +#pragma intrinsic(memmove) +#pragma function(memmove) +void* memmove(void *dest, const void *src, size_t n) +{ + unsigned char *d =3D dest; + unsigned char const *s =3D src; + + if (d < s) { + while (n--) + *d++ =3D *s++; + } else { + d +=3D n; + s +=3D n; + while (n--) + *--d =3D *--s; + } + + return dest; +} --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#40489): https://edk2.groups.io/g/devel/message/40489 Mute This Topic: https://groups.io/mt/31605110/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 1 00:44:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+40491+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40491+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1557737676; cv=none; d=zoho.com; s=zohoarc; b=PqYYJRd/xAudWd9YP7WZdk8R2xY9LbFEzDy/aImiH/JeW56TZExU8r+aFQ3t9wNhq23Uhh4GdBA6KBSJXbLQDbtYT7Fkak1VFoVLK0rmZlSst94/+t/dPwXhjlUsG7NJJychnhJoiyhSCTixss5pZSYCezSGKIKwvsLeQ9BqojA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557737676; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=WTw9mjKGTGO4l3GC22dcP8hY0cyMHqcRWf53aFqxq9g=; b=ApYxYHMJOF5qK6E1KZogPhWHO1Ztv77lmUvQlxCmVlD/RXtfMJfLFHFqRskhEK/he2b3ciJJvyB0VZedjPPiH04FlioCJnfLcetjyS+byPdacfm2rT9Ue/u2vbwF6c3zIaM677uB6ImH1sJBr2/InxML6kXOunN/7fLgEHLU5+Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40491+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1557737676834445.4216326703512; Mon, 13 May 2019 01:54:36 -0700 (PDT) Return-Path: X-Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by groups.io with SMTP; Mon, 13 May 2019 01:54:35 -0700 X-Received: by mail-ed1-f68.google.com with SMTP id n17so16463794edb.0 for ; Mon, 13 May 2019 01:54:34 -0700 (PDT) X-Gm-Message-State: APjAAAVasIwWVKlhh3Do5N9tdYLR9zU4JxV3bCqbJVs+uwnjhwy4x+bu ORd/+9NbIQvVK/WvF8uoOUwcEUhJA2M= X-Google-Smtp-Source: APXvYqzRpiI00m1J7LvB4PnJA6cp9nXqvg+CcC1f3RD1EWOTzHKdakoTmZeTb1S4vRlVCHKljezeVA== X-Received: by 2002:a50:aed0:: with SMTP id f16mr20831399edd.12.1557737673274; Mon, 13 May 2019 01:54:33 -0700 (PDT) X-Received: from localhost.localdomain ([84.203.49.55]) by smtp.gmail.com with ESMTPSA id k57sm3595701ede.17.2019.05.13.01.54.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 01:54:32 -0700 (PDT) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org Subject: [edk2-devel] [PATCH v2 3/4] ArmPkg/CompilerIntrinsicsLib: Add lasr ARM assembly source for GCC Date: Mon, 13 May 2019 09:54:15 +0100 Message-Id: <20190513085416.1352-4-pete@akeo.ie> In-Reply-To: <20190513085416.1352-1-pete@akeo.ie> References: <20190513085416.1352-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1557737675; bh=lqKwtyPTtwW0TMM23HLdUZqEyYm7CILuxXCiKptt0Tg=; h=Cc:Date:From:Reply-To:Subject:To; b=kLm6FVYKdw7h0iJ900NBN3oRIJ0W9seyaOWj7zk5R/4T0h9h84OBYr5DCWmnY4AfeqS xoWKRKIXr5O8//mqz/j+kiHuHG1UHh3N+XG0fJurod6fCXPHPUq8BVNeeRbUQN4AKWTK3 GePwaVdVs5PzrWPZ07uXEKAVJkQsqcyEb7A= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The new source is a port of the RVCT version. Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Pete Batard --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S | 30 ++++++= ++++++++++++++ ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 1 + 2 files changed, 31 insertions(+) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S b/ArmPkg/Libra= ry/CompilerIntrinsicsLib/Arm/lasr.S new file mode 100644 index 000000000000..feeea9edd12a --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S @@ -0,0 +1,30 @@ +#-------------------------------------------------------------------------= ----- +# +# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#-------------------------------------------------------------------------= ----- + +#include + +# +#UINT64 +#EFIAPI +#__aeabi_lasr ( +# IN UINT64 Value +# IN UINT32 Shift +# ); +# +ASM_FUNC(__aeabi_lasr) + subs r3,r2,#0x20 + bpl L_Test + rsb r3,r2,#0x20 + lsr r0,r0,r2 + orr r0,r0,r1,LSL r3 + asr r1,r1,r2 + bx lr +L_Test: + asr r0,r1,r3 + asr r1,r1,#31 + bx lr diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf= b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf index d6cc63db75c7..aaf3de02a952 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf +++ b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf @@ -68,6 +68,7 @@ [Sources.ARM] Arm/sourcery.S | GCC Arm/uldiv.S | GCC Arm/ldivmod.S | GCC + Arm/lasr.S | GCC Arm/llsr.S | GCC Arm/llsl.S | GCC =20 --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#40491): https://edk2.groups.io/g/devel/message/40491 Mute This Topic: https://groups.io/mt/31605112/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 1 00:44:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+40492+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40492+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1557737677; cv=none; d=zoho.com; s=zohoarc; b=GqNHvqKJKweHKetGAqsLEU/KjwBSMx6T7v6DwGa1cUmZuoI8Eydx+ZvGfFrEPS/hLTgqFXJuUaCihAmaXHcuqBvsIkejLb7mob5tjgnUewxmipIDUq6QU08wlvWg5LwitCOBlpaHRVWAXMvMM1hXOxgYHkAl62PzNOQhYwEk9Z4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557737677; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=BBDU9OdQ1QCTM2ZcOAU1ZGY1S4zFkI/hT/A8SPVlFCE=; b=nD4nbXzcqb31rQyFvj7Uqk73ORKsx2T1jdH23/wt681VrQ+HgPS5zMeHW0xN+iDCxNckmSFNh0hm5ANAbDrVTwnFFthP21PUZPwP5KlG2XIXrC5bp48b+0g4vG8hokZjOJtfes76swG6t74aSFqIMUcPZs45hyjDTA5HcuvW9Jw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40492+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1557737677535101.84761344093056; Mon, 13 May 2019 01:54:37 -0700 (PDT) Return-Path: X-Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by groups.io with SMTP; Mon, 13 May 2019 01:54:36 -0700 X-Received: by mail-ed1-f54.google.com with SMTP id n17so16463898edb.0 for ; Mon, 13 May 2019 01:54:35 -0700 (PDT) X-Gm-Message-State: APjAAAWPBcNxpntK/kKQLzNfKRYoMHHeZLKiAdoGVo1YkPMlQDFu2tek wg8xtVYh2u6NkLIxqGij33rkKKAio+U= X-Google-Smtp-Source: APXvYqxnYFxNe+13PLJinSr5lNkNCil544nmOL5drNzeQeutpNVcyQ5MNvKFnHr/FxpMnQLTChlROA== X-Received: by 2002:a17:906:82d9:: with SMTP id a25mr14771456ejy.189.1557737674480; Mon, 13 May 2019 01:54:34 -0700 (PDT) X-Received: from localhost.localdomain ([84.203.49.55]) by smtp.gmail.com with ESMTPSA id k57sm3595701ede.17.2019.05.13.01.54.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 01:54:33 -0700 (PDT) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org Subject: [edk2-devel] [PATCH v2 4/4] ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources Date: Mon, 13 May 2019 09:54:16 +0100 Message-Id: <20190513085416.1352-5-pete@akeo.ie> In-Reply-To: <20190513085416.1352-1-pete@akeo.ie> References: <20190513085416.1352-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1557737677; bh=NnuCne+Mq2+mAQlATdzJkYLAtYAsi083sR7NZc6ICOw=; h=Cc:Date:From:Reply-To:Subject:To; b=FhGlMmXSTNFBIWAa57gXJi2XYB6fYTP1/pRXJyyzc2kW7NYMABdrO1V6j5eHgcjCkQP w+MKotO3vpANajaE9E7GLixBtvrBSTBqFLfDHPZIwZIhMldfGMA4C87NiuycsEIiSqW2g t6ooI3+//sufTkhieUE6DXcxd5ibdMcg66s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The new sources are a copy of the RVCT version. Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Pete Batard --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S | 54 ++++++= ++++++++++++++ ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S | 53 ++++++= +++++++++++++ ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 2 + 3 files changed, 109 insertions(+) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S b/ArmPkg/Libr= ary/CompilerIntrinsicsLib/Arm/uread.S new file mode 100644 index 000000000000..e8a1dbad8692 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S @@ -0,0 +1,54 @@ +#-------------------------------------------------------------------------= ----- +# +# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#-------------------------------------------------------------------------= ----- + +#include + +# +#UINT32 +#EFIAPI +#__aeabi_uread4 ( +# IN VOID *Pointer +# ); +# +ASM_FUNC(__aeabi_uread4) + ldrb r1, [r0] + ldrb r2, [r0, #1] + ldrb r3, [r0, #2] + ldrb r0, [r0, #3] + orr r1, r1, r2, lsl #8 + orr r1, r1, r3, lsl #16 + orr r0, r1, r0, lsl #24 + bx lr + +# +#UINT64 +#EFIAPI +#__aeabi_uread8 ( +# IN VOID *Pointer +# ); +# +ASM_FUNC(__aeabi_uread8) + mov r3, r0 + + ldrb r1, [r3] + ldrb r2, [r3, #1] + orr r1, r1, r2, lsl #8 + ldrb r2, [r3, #2] + orr r1, r1, r2, lsl #16 + ldrb r0, [r3, #3] + orr r0, r1, r0, lsl #24 + + ldrb r1, [r3, #4] + ldrb r2, [r3, #5] + orr r1, r1, r2, lsl #8 + ldrb r2, [r3, #6] + orr r1, r1, r2, lsl #16 + ldrb r2, [r3, #7] + orr r1, r1, r2, lsl #24 + + bx lr diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S b/ArmPkg/Lib= rary/CompilerIntrinsicsLib/Arm/uwrite.S new file mode 100644 index 000000000000..9432ac431799 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S @@ -0,0 +1,53 @@ +#-------------------------------------------------------------------------= ----- +# +# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#-------------------------------------------------------------------------= ----- + +#include + +# +#UINT32 +#EFIAPI +#__aeabi_uwrite4 ( +# IN UINT32 Data, +# IN VOID *Pointer +# ); +# +ASM_FUNC(__aeabi_uwrite4) + mov r2, r0, lsr #8 + strb r0, [r1] + strb r2, [r1, #1] + mov r2, r0, lsr #16 + strb r2, [r1, #2] + mov r2, r0, lsr #24 + strb r2, [r1, #3] + bx lr + +# +#UINT64 +#EFIAPI +#__aeabi_uwrite8 ( +# IN UINT64 Data, +# IN VOID *Pointer +# ); +# +ASM_FUNC(__aeabi_uwrite8) + mov r3, r0, lsr #8 + strb r0, [r2] + strb r3, [r2, #1] + mov r3, r0, lsr #16 + strb r3, [r2, #2] + mov r3, r0, lsr #24 + strb r3, [r2, #3] + + mov r3, r1, lsr #8 + strb r1, [r2, #4] + strb r3, [r2, #5] + mov r3, r1, lsr #16 + strb r3, [r2, #6] + mov r3, r1, lsr #24 + strb r3, [r2, #7] + bx lr diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf= b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf index aaf3de02a952..d5bad9467758 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf +++ b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf @@ -71,6 +71,8 @@ [Sources.ARM] Arm/lasr.S | GCC Arm/llsr.S | GCC Arm/llsl.S | GCC + Arm/uread.S | GCC + Arm/uwrite.S | GCC =20 Arm/div.asm | MSFT Arm/uldiv.asm | MSFT --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#40492): https://edk2.groups.io/g/devel/message/40492 Mute This Topic: https://groups.io/mt/31605113/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-