public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics
@ 2019-05-13  8:54 Pete Batard
  2019-05-13  8:54 ` [PATCH v2 1/4] ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf Pete Batard
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Pete Batard @ 2019-05-13  8:54 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm

This patch series cleans up and updates the CompilerIntrinsicsLib for ArmPkg.

The first patch removes sources that are no longer used and cleans up the .inf.
The second patch adds memcmp and memmove for MSFT, as I ran into missing symbols
for those while compiling a project with VS2017. Note that we are not reusing
the memmove.asm from ARM and instead adding a separate C source, as we need an
implemention that applies for both ARM and ARM64.
The third patch adds a lasr implementation, which I found was needed to fix
missing symbols when compiling with GCC/ARM on Debian 9.8.
The last patch premtpively adds references for uread/uwrite for completion.

Regards,

/Pete

Pete Batard (4):
  ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf
  ArmPkg/CompilerIntrinsicsLib: Add memcmp, memmove intrinsics for MSFT
  ArmPkg/CompilerIntrinsicsLib: Add lasr ARM assembly source for GCC
  ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources

 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/lasr.S                |  30 +++
 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/Arm/uread.S               |  54 ++++
 ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S              |  53 ++++
 ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 108 +++-----
 ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c               |  31 +++
 ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c              |  34 +++
 24 files changed, 245 insertions(+), 1634 deletions(-)
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.c
 create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.c
 delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.c
 create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S
 create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
 create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
 create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c

-- 
2.21.0.windows.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf
  2019-05-13  8:54 [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Pete Batard
@ 2019-05-13  8:54 ` Pete Batard
  2019-05-13  8:54 ` [PATCH v2 2/4] ArmPkg/CompilerIntrinsicsLib: Add memcmp, memmove intrinsics for MSFT Pete Batard
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Pete Batard @ 2019-05-13  8:54 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm

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>
---
 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/ArmPkg/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-#include <Base.h>
-#include <Library/DebugLib.h>
-
-#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/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-#include "Llvm_int_lib.h"
-
-// Returns: a << b
-
-// Precondition:  0 <= b < bits_in_dword
-
-INT64
-__ashldi3(INT64 a, INT32 b)
-{
-    const int bits_in_word = (int)(sizeof(INT32) * CHAR_BIT);
-    dwords input;
-    dwords result;
-    input.all = a;
-    if (b & bits_in_word)  // bits_in_word <= b < bits_in_dword
-    {
-        result.low = 0;
-        result.high = input.low << (b - bits_in_word);
-    }
-    else  // 0 <= b < bits_in_word
-    {
-        if (b == 0)
-            return a;
-        result.low  = input.low << b;
-        result.high = (input.high << b) | (input.low >> (bits_in_word - b));
-    }
-    return result.all;
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-#include "Llvm_int_lib.h"
-
-// Returns: arithmetic a >> b
-
-// Precondition:  0 <= b < bits_in_dword
-
-INT64
-__ashrdi3(INT64 a, INT32 b)
-{
-    const int bits_in_word = (int)(sizeof(INT32) * CHAR_BIT);
-    dwords input;
-    dwords result;
-    input.all = a;
-    if (b & bits_in_word)  // bits_in_word <= b < bits_in_dword
-    {
-        // result.high = input.high < 0 ? -1 : 0
-        result.high = input.high >> (bits_in_word - 1);
-        result.low = input.high >> (b - bits_in_word);
-    }
-    else  // 0 <= b < bits_in_word
-    {
-        if (b == 0)
-            return a;
-        result.high  = input.high >> b;
-        result.low = (input.high << (bits_in_word - b)) | (input.low >> b);
-    }
-    return result.all;
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.c b/ArmPkg/Library/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 LLVM code.
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-
-#include "Llvm_int_lib.h"
-
-// Returns: the number of leading 0-bits
-
-// Precondition: a != 0
-
-INT32
-__clzsi2(INT32 a)
-{
-    UINT32 x = (UINT32)a;
-    INT32 t = ((x & 0xFFFF0000) == 0) << 4;  // if (x is small) t = 16 else 0
-    x >>= 16 - t;      // x = [0 - 0xFFFF]
-    UINT32 r = t;       // r = [0, 16]
-    // return r + clz(x)
-    t = ((x & 0xFF00) == 0) << 3;
-    x >>= 8 - t;       // x = [0 - 0xFF]
-    r += t;            // r = [0, 8, 16, 24]
-    // return r + clz(x)
-    t = ((x & 0xF0) == 0) << 2;
-    x >>= 4 - t;       // x = [0 - 0xF]
-    r += t;            // r = [0, 4, 8, 12, 16, 20, 24, 28]
-    // return r + clz(x)
-    t = ((x & 0xC) == 0) << 1;
-    x >>= 2 - t;       // x = [0 - 3]
-    r += t;            // r = [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) == 0));
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.c b/ArmPkg/Library/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 LLVM code.
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-
-#include "Llvm_int_lib.h"
-
-// Returns: the number of trailing 0-bits
-
-// Precondition: a != 0
-
-INT32
-__ctzsi2(INT32 a)
-{
-    UINT32 x = (UINT32)a;
-    INT32 t = ((x & 0x0000FFFF) == 0) << 4;  // if (x has no small bits) t = 16 else 0
-    x >>= t;           // x = [0 - 0xFFFF] + higher garbage bits
-    UINT32 r = t;       // r = [0, 16]
-    // return r + ctz(x)
-    t = ((x & 0x00FF) == 0) << 3;
-    x >>= t;           // x = [0 - 0xFF] + higher garbage bits
-    r += t;            // r = [0, 8, 16, 24]
-    // return r + ctz(x)
-    t = ((x & 0x0F) == 0) << 2;
-    x >>= t;           // x = [0 - 0xF] + higher garbage bits
-    r += t;            // r = [0, 4, 8, 12, 16, 20, 24, 28]
-    // return r + ctz(x)
-    t = ((x & 0x3) == 0) << 1;
-    x >>= t;
-    x &= 3;            // x = [0 - 3]
-    r += t;            // r = [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) == 0));
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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 = (int)(sizeof(INT64) * CHAR_BIT) - 1;
-    INT64 s_a = a >> bits_in_dword_m1;           // s_a = a < 0 ? -1 : 0
-    INT64 s_b = b >> bits_in_dword_m1;           // s_b = b < 0 ? -1 : 0
-    a = (a ^ s_a) - s_a;                         // negate if s_a == -1
-    b = (b ^ s_b) - s_b;                         // negate if s_b == -1
-    s_a ^= s_b;                                  // sign of quotient
-    return (__udivmoddi4(a, b, (UINT64*)0) ^ s_a) - s_a;  // negate if s_a == -1
-}
-
-
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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 = (int)(sizeof(INT32) * CHAR_BIT) - 1;
-    INT32 s_a = a >> bits_in_word_m1;           // s_a = a < 0 ? -1 : 0
-    INT32 s_b = b >> bits_in_word_m1;           // s_b = b < 0 ? -1 : 0
-    a = (a ^ s_a) - s_a;                         // negate if s_a == -1
-    b = (b ^ s_b) - s_b;                         // negate if s_b == -1
-    s_a ^= s_b;                                  // sign of quotient
-    return (__udivsi3(a, b) ^ s_a) - s_a;        // negate if s_a == -1
-}
-
-
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-#include "Llvm_int_lib.h"
-
-// Returns: logical a >> b
-
-// Precondition:  0 <= b < bits_in_dword
-
-INT64
-__lshrdi3(INT64 a, INT32 b)
-{
-    const int bits_in_word = (int)(sizeof(INT32) * CHAR_BIT);
-    udwords input;
-    udwords result;
-    input.all = a;
-    if (b & bits_in_word)  // bits_in_word <= b < bits_in_dword
-    {
-        result.high = 0;
-        result.low = input.high >> (b - bits_in_word);
-    }
-    else  // 0 <= b < bits_in_word
-    {
-        if (b == 0)
-            return a;
-        result.high  = input.high >> b;
-        result.low = (input.high << (bits_in_word - b)) | (input.low >> b);
-    }
-    return result.all;
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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 = (int)(sizeof(INT64) * CHAR_BIT) - 1;
-    INT64 s = b >> bits_in_dword_m1;  // s = b < 0 ? -1 : 0
-    b = (b ^ s) - s;                   // negate if s == -1
-    s = a >> bits_in_dword_m1;         // s = a < 0 ? -1 : 0
-    a = (a ^ s) - s;                   // negate if s == -1
-    INT64 r;
-    __udivmoddi4(a, b, (UINT64*)&r);
-    return (r ^ s) - s;                // negate if s == -1
-}
-
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-#include <Base.h>
-#include "Llvm_int_lib.h"
-
-
-// Returns: a * b
-
-static
-INT64
-__muldsi3(UINT32 a, UINT32 b)
-{
-    dwords r;
-    const int bits_in_word_2 = (int)(sizeof(INT32) * CHAR_BIT) / 2;
-    const UINT32 lower_mask = (UINT32)~0 >> bits_in_word_2;
-    r.low = (a & lower_mask) * (b & lower_mask);
-    UINT32 t = r.low >> bits_in_word_2;
-    r.low &= lower_mask;
-    t += (a >> bits_in_word_2) * (b & lower_mask);
-    r.low += (t & lower_mask) << bits_in_word_2;
-    r.high = t >> bits_in_word_2;
-    t = r.low >> bits_in_word_2;
-    r.low &= lower_mask;
-    t += (b >> bits_in_word_2) * (a & lower_mask);
-    r.low += (t & lower_mask) << bits_in_word_2;
-    r.high += t >> bits_in_word_2;
-    r.high += (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 = a;
-    dwords y;
-    y.all = b;
-    dwords r;
-    r.all = __muldsi3(x.low, y.low);
-    r.high += x.high * y.low + x.low * y.high;
-    return r.all;
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-
-#include "Llvm_int_lib.h"
-
-
-// Returns:  if (a <  b) returns 0
-//           if (a == b) returns 1
-//           if (a >  b) returns 2
-
-UINT32
-__ucmpdi2(UINT64 a, UINT64 b)
-{
-    udwords x;
-    x.all = a;
-    udwords y;
-    y.all = 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/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH THE
-  SOFTWARE.
-**/
-
-
-#include "Llvm_int_lib.h"
-
-// Effects: if rem != 0, *rem = 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 = sizeof(UINT32) * CHAR_BIT;
-    const unsigned n_udword_bits = sizeof(UINT64) * CHAR_BIT;
-    udwords n;
-    n.all = a;
-    udwords d;
-    d.all = b;
-    udwords q;
-    udwords r;
-    unsigned sr;
-
-    if (b == 0) {
-//      ASSERT (FALSE);
-      return 0;
-    }
-
-    // special cases, X is unknown, K != 0
-    if (n.high == 0)
-    {
-        if (d.high == 0)
-        {
-            // 0 X
-            // ---
-            // 0 X
-            if (rem)
-                *rem = n.low % d.low;
-            return n.low / d.low;
-        }
-        // 0 X
-        // ---
-        // K X
-        if (rem)
-            *rem = n.low;
-        return 0;
-    }
-    // n.high != 0
-    if (d.low == 0)
-    {
-        if (d.high == 0)
-        {
-            // K X
-            // ---
-            // 0 0
-            if (rem)
-                *rem = n.high % d.low;
-            return n.high / d.low;
-        }
-        // d.high != 0
-        if (n.low == 0)
-        {
-            // K 0
-            // ---
-            // K 0
-            if (rem)
-            {
-                r.high = n.high % d.high;
-                r.low = 0;
-                *rem = r.all;
-            }
-            return n.high / d.high;
-        }
-        // K K
-        // ---
-        // K 0
-        if ((d.high & (d.high - 1)) == 0)     // if d is a power of 2
-        {
-            if (rem)
-            {
-                r.low = n.low;
-                r.high = n.high & (d.high - 1);
-                *rem = r.all;
-            }
-            return n.high >> COUNT_TRAILING_ZEROS(d.high);
-        }
-        // K K
-        // ---
-        // K 0
-        sr = COUNT_LEADING_ZEROS(d.high) - COUNT_LEADING_ZEROS(n.high);
-        // 0 <= sr <= n_uword_bits - 2 or sr large
-        if (sr > n_uword_bits - 2)
-        {
-           if (rem)
-                *rem = n.all;
-            return 0;
-        }
-        ++sr;
-        // 1 <= sr <= n_uword_bits - 1
-        // q.all = n.all << (n_udword_bits - sr);
-        q.low = 0;
-        q.high = n.low << (n_uword_bits - sr);
-        // r.all = n.all >> sr;
-        r.high = n.high >> sr;
-        r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
-    }
-    else  // d.low != 0
-    {
-        if (d.high == 0)
-        {
-            // K X
-            // ---
-            // 0 K
-            if ((d.low & (d.low - 1)) == 0)     // if d is a power of 2
-            {
-                if (rem)
-                    *rem = n.low & (d.low - 1);
-                if (d.low == 1)
-                    return n.all;
-                unsigned sr = COUNT_TRAILING_ZEROS(d.low);
-                q.high = n.high >> sr;
-                q.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
-                return q.all;
-            }
-            // K X
-            // ---
-            // 0 K
-            sr = 1 + n_uword_bits + COUNT_LEADING_ZEROS(d.low) - COUNT_LEADING_ZEROS(n.high);
-            // 2 <= sr <= n_udword_bits - 1
-            // q.all = n.all << (n_udword_bits - sr);
-            // r.all = n.all >> sr;
-            // if (sr == n_uword_bits)
-            // {
-            //     q.low = 0;
-            //     q.high = n.low;
-            //     r.high = 0;
-            //     r.low = n.high;
-            // }
-            // else if (sr < n_uword_bits)  // 2 <= sr <= n_uword_bits - 1
-            // {
-            //     q.low = 0;
-            //     q.high = n.low << (n_uword_bits - sr);
-            //     r.high = n.high >> sr;
-            //     r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
-            // }
-            // else              // n_uword_bits + 1 <= sr <= n_udword_bits - 1
-            // {
-            //     q.low = n.low << (n_udword_bits - sr);
-            //     q.high = (n.high << (n_udword_bits - sr)) |
-            //              (n.low >> (sr - n_uword_bits));
-            //     r.high = 0;
-            //     r.low = n.high >> (sr - n_uword_bits);
-            // }
-            q.low =  (n.low << (n_udword_bits - sr)) &
-                     ((INT32)(n_uword_bits - sr) >> (n_uword_bits-1));
-            q.high = ((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 = (n.high >> sr) &
-                     ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1));
-            r.low =  ((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 = COUNT_LEADING_ZEROS(d.high) - COUNT_LEADING_ZEROS(n.high);
-            // 0 <= sr <= n_uword_bits - 1 or sr large
-            if (sr > n_uword_bits - 1)
-            {
-               if (rem)
-                    *rem = n.all;
-                return 0;
-            }
-            ++sr;
-            // 1 <= sr <= n_uword_bits
-            // q.all = n.all << (n_udword_bits - sr);
-            q.low = 0;
-            q.high = n.low << (n_uword_bits - sr);
-            // r.all = n.all >> sr;
-            // if (sr < n_uword_bits)
-            // {
-            //     r.high = n.high >> sr;
-            //     r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
-            // }
-            // else
-            // {
-            //     r.high = 0;
-            //     r.low = n.high;
-            // }
-            r.high = (n.high >> sr) &
-                     ((INT32)(sr - n_uword_bits) >> (n_uword_bits-1));
-            r.low = (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 = n.all << (n_udword_bits - sr);
-    // r.all = n.all >> sr;
-    // 1 <= sr <= n_udword_bits - 1
-    UINT32 carry = 0;
-    for (; sr > 0; --sr)
-    {
-        // r:q = ((r:q)  << 1) | carry
-        r.high = (r.high << 1) | (r.low  >> (n_uword_bits - 1));
-        r.low  = (r.low  << 1) | (q.high >> (n_uword_bits - 1));
-        q.high = (q.high << 1) | (q.low  >> (n_uword_bits - 1));
-        q.low  = (q.low  << 1) | carry;
-        // carry = 0;
-        // if (r.all >= d.all)
-        // {
-        //      r.all -= d.all;
-        //      carry = 1;
-        // }
-        const INT64 s = (INT64)(d.all - r.all - 1) >> (n_udword_bits - 1);
-        carry = s & 1;
-        r.all -= d.all & s;
-    }
-    q.all = (q.all << 1) | carry;
-    if (rem)
-        *rem = r.all;
-    return q.all;
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.c b/ArmPkg/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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 = sizeof(UINT32) * CHAR_BIT;
-    UINT32 q;
-    UINT32 r;
-    unsigned sr;
-
-    // special cases
-    if (d == 0) {
-//        ASSERT (FALSE);
-        return 0; // ?!
-        }
-    if (n == 0)
-        return 0;
-
-    sr = COUNT_LEADING_ZEROS(d) - COUNT_LEADING_ZEROS(n);
-    // 0 <= sr <= n_uword_bits - 1 or sr large
-    if (sr > n_uword_bits - 1)  // d > r
-        return 0;
-    if (sr == n_uword_bits - 1)  // d == 1
-        return n;
-    ++sr;
-    // 1 <= sr <= n_uword_bits - 1
-    // Not a special case
-    q = n << (n_uword_bits - sr);
-    r = n >> sr;
-    UINT32 carry = 0;
-    for (; sr > 0; --sr)
-    {
-        // r:q = ((r:q)  << 1) | carry
-        r = (r << 1) | (q >> (n_uword_bits - 1));
-        q = (q << 1) | carry;
-        // carry = 0;
-        // if (r.all >= d.all)
-        // {
-        //      r.all -= d.all;
-        //      carry = 1;
-        // }
-        const INT32 s = (INT32)(d - r - 1) >> (n_uword_bits - 1);
-        carry = s & 1;
-        r -= d & s;
-    }
-    q = (q << 1) | carry;
-    return q;
-}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c b/ArmPkg/Library/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.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "Llvm_int_lib.h"
-#include <Library/BaseLib.h>
-
-
-UINT32 __udivsi3(UINT32 n, UINT32 d);
-UINT32 __umodsi3(UINT32 a, UINT32 b);
-
-
-UINT64
-__aeabi_uidivmod(unsigned numerator, unsigned denominator)
-{
-  UINT64  Return;
-
-  Return = __udivsi3 (numerator, denominator);
-  Return |= 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/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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/Library/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.<BR>
-
-  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 deal with
-  the Software without restriction, including without limitation the rights to
-  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-  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 notice,
-        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 distribution.
-
-      * 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 specific
-        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 OTHER
-  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 WITH 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]
 
 [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
 
 [Sources.ARM]
@@ -38,73 +40,44 @@ [Sources.ARM]
   Arm/uldiv.asm        | RVCT
   Arm/ldivmod.asm      | RVCT
 
-
-#
-# 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
 
 [Packages]
   MdePkg/MdePkg.dec
   ArmPkg/ArmPkg.dec
 
-[LibraryClasses]
-
 [BuildOptions]
-  MSFT:*_*_ARM_CC_FLAGS = /GL-
+  MSFT:*_*_*_CC_FLAGS = /GL-
   MSFT:*_*_ARM_ASM_FLAGS = /oldit
-  MSFT:*_*_AARCH64_CC_FLAGS = /GL-
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] ArmPkg/CompilerIntrinsicsLib: Add memcmp, memmove intrinsics for MSFT
  2019-05-13  8:54 [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Pete Batard
  2019-05-13  8:54 ` [PATCH v2 1/4] ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf Pete Batard
@ 2019-05-13  8:54 ` Pete Batard
  2019-05-13  8:54 ` [PATCH v2 3/4] ArmPkg/CompilerIntrinsicsLib: Add lasr ARM assembly source for GCC Pete Batard
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Pete Batard @ 2019-05-13  8:54 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm

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 <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Pete Batard <pete@akeo.ie>
---
 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]
 
   memcpy_ms.c          | MSFT
   memset_ms.c          | MSFT
+  memcmp_ms.c          | MSFT
+  memmove_ms.c         | MSFT
 
 [Sources.ARM]
   Arm/mullu.asm        | RVCT
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c b/ArmPkg/Library/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 = s1;
+  unsigned char const *t2 = s2;
+
+  while (n--) {
+    if (*t1 != *t2)
+      return (int)*t1 - (int)*t2;
+    t1++;
+    t2++;
+  }
+
+  return 0;
+}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c b/ArmPkg/Library/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 = dest;
+  unsigned char const *s = src;
+
+  if (d < s) {
+    while (n--)
+      *d++ = *s++;
+  } else {
+    d += n;
+    s += n;
+    while (n--)
+      *--d = *--s;
+  }
+
+  return dest;
+}
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] ArmPkg/CompilerIntrinsicsLib: Add lasr ARM assembly source for GCC
  2019-05-13  8:54 [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Pete Batard
  2019-05-13  8:54 ` [PATCH v2 1/4] ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf Pete Batard
  2019-05-13  8:54 ` [PATCH v2 2/4] ArmPkg/CompilerIntrinsicsLib: Add memcmp, memmove intrinsics for MSFT Pete Batard
@ 2019-05-13  8:54 ` Pete Batard
  2019-05-13  8:54 ` [PATCH v2 4/4] ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources Pete Batard
  2019-05-13 15:56 ` [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Leif Lindholm
  4 siblings, 0 replies; 7+ messages in thread
From: Pete Batard @ 2019-05-13  8:54 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm

The new source is a port of the RVCT version.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Pete Batard <pete@akeo.ie>
---
 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/Library/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.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#------------------------------------------------------------------------------
+
+#include <AsmMacroIoLib.h>
+
+#
+#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
 
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources
  2019-05-13  8:54 [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Pete Batard
                   ` (2 preceding siblings ...)
  2019-05-13  8:54 ` [PATCH v2 3/4] ArmPkg/CompilerIntrinsicsLib: Add lasr ARM assembly source for GCC Pete Batard
@ 2019-05-13  8:54 ` Pete Batard
  2019-05-13 15:56 ` [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Leif Lindholm
  4 siblings, 0 replies; 7+ messages in thread
From: Pete Batard @ 2019-05-13  8:54 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm

The new sources are a copy of the RVCT version.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Pete Batard <pete@akeo.ie>
---
 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/Library/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.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#------------------------------------------------------------------------------
+
+#include <AsmMacroIoLib.h>
+
+#
+#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/Library/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.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#------------------------------------------------------------------------------
+
+#include <AsmMacroIoLib.h>
+
+#
+#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
 
   Arm/div.asm          | MSFT
   Arm/uldiv.asm        | MSFT
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics
  2019-05-13  8:54 [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Pete Batard
                   ` (3 preceding siblings ...)
  2019-05-13  8:54 ` [PATCH v2 4/4] ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources Pete Batard
@ 2019-05-13 15:56 ` Leif Lindholm
  2019-05-13 16:29   ` [edk2-devel] " Pete Batard
  4 siblings, 1 reply; 7+ messages in thread
From: Leif Lindholm @ 2019-05-13 15:56 UTC (permalink / raw)
  To: Pete Batard; +Cc: devel, ard.biesheuvel

Hi Pete,

On Mon, May 13, 2019 at 09:54:12AM +0100, Pete Batard wrote:
> This patch series cleans up and updates the CompilerIntrinsicsLib for ArmPkg.
> 
> The first patch removes sources that are no longer used and cleans up the .inf.
> The second patch adds memcmp and memmove for MSFT, as I ran into missing symbols
> for those while compiling a project with VS2017. Note that we are not reusing
> the memmove.asm from ARM and instead adding a separate C source, as we need an
> implemention that applies for both ARM and ARM64.
> The third patch adds a lasr implementation, which I found was needed to fix
> missing symbols when compiling with GCC/ARM on Debian 9.8.
> The last patch premtpively adds references for uread/uwrite for completion.

Many thanks for this cleanup.
For the series - Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Pushed as 4ff689d982..96ef5a8e30.

But. One question:

When building with Visual Studio 2017, I get the following warning:
"cl : Command line warning D9025 : overriding '/GL' with '/GL-'"
(This is not caused by anything in this set.)

Should we also /wd9025 in the .inf (I think so, since we're explicitly
mucking with the toolchain here), and if so could you send an
additional patch to do that since Ard is still away and I can't sign
off my own patches? :)

Best Regards,

Leif

> Regards,
> 
> /Pete
> 
> Pete Batard (4):
>   ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf
>   ArmPkg/CompilerIntrinsicsLib: Add memcmp, memmove intrinsics for MSFT
>   ArmPkg/CompilerIntrinsicsLib: Add lasr ARM assembly source for GCC
>   ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources
> 
>  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/lasr.S                |  30 +++
>  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/Arm/uread.S               |  54 ++++
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S              |  53 ++++
>  ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 108 +++-----
>  ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c               |  31 +++
>  ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c              |  34 +++
>  24 files changed, 245 insertions(+), 1634 deletions(-)
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.c
>  create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.c
>  delete mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.c
>  create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S
>  create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
>  create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
>  create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c
> 
> -- 
> 2.21.0.windows.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics
  2019-05-13 15:56 ` [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Leif Lindholm
@ 2019-05-13 16:29   ` Pete Batard
  0 siblings, 0 replies; 7+ messages in thread
From: Pete Batard @ 2019-05-13 16:29 UTC (permalink / raw)
  To: devel, leif.lindholm; +Cc: ard.biesheuvel

Hi Leif,

On 2019.05.13 16:56, Leif Lindholm wrote:
> Hi Pete,
> 
> On Mon, May 13, 2019 at 09:54:12AM +0100, Pete Batard wrote:
>> This patch series cleans up and updates the CompilerIntrinsicsLib for ArmPkg.
>>
>> The first patch removes sources that are no longer used and cleans up the .inf.
>> The second patch adds memcmp and memmove for MSFT, as I ran into missing symbols
>> for those while compiling a project with VS2017. Note that we are not reusing
>> the memmove.asm from ARM and instead adding a separate C source, as we need an
>> implemention that applies for both ARM and ARM64.
>> The third patch adds a lasr implementation, which I found was needed to fix
>> missing symbols when compiling with GCC/ARM on Debian 9.8.
>> The last patch premtpively adds references for uread/uwrite for completion.
> 
> Many thanks for this cleanup.
> For the series - Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> Pushed as 4ff689d982..96ef5a8e30.

Thanks.

> But. One question:
> 
> When building with Visual Studio 2017, I get the following warning:
> "cl : Command line warning D9025 : overriding '/GL' with '/GL-'"
> (This is not caused by anything in this set.)
> 
> Should we also /wd9025 in the .inf (I think so, since we're explicitly
> mucking with the toolchain here), and if so could you send an
> additional patch to do that since Ard is still away and I can't sign
> off my own patches? :)

Unfortunately, this is a "command line" warnings (D####) and not a 
compiler warning (C####) and MSVC doesn't seem to let you silence 
command line warnings.

Or at least, if they can be silenced, it's not through any option I have 
been able to figure out, as I can definitely report that /wd does not 
accept any of the D#### numbers.

Still, if anybody on this list knows how to silence MSVC command line 
warnings, I'd be very happy to hear from them and produce the patch you 
request, as I too have been wanting to squash these little annoyances 
for a while...

Regards,

/Pete

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-05-13 16:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-13  8:54 [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Pete Batard
2019-05-13  8:54 ` [PATCH v2 1/4] ArmPkg/CompilerIntrinsicsLib: Remove unused sources and clean up .inf Pete Batard
2019-05-13  8:54 ` [PATCH v2 2/4] ArmPkg/CompilerIntrinsicsLib: Add memcmp, memmove intrinsics for MSFT Pete Batard
2019-05-13  8:54 ` [PATCH v2 3/4] ArmPkg/CompilerIntrinsicsLib: Add lasr ARM assembly source for GCC Pete Batard
2019-05-13  8:54 ` [PATCH v2 4/4] ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources Pete Batard
2019-05-13 15:56 ` [PATCH v2 0/4] ArmPkg/CompilerIntrinsicsLib: Update MSFT, GCC intrinsics Leif Lindholm
2019-05-13 16:29   ` [edk2-devel] " Pete Batard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox