public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 00/10] consolidate compiler intrinsics
@ 2022-04-12 14:07 Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 01/10] MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg Gerd Hoffmann
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

This is an attept to start cleaning up the messy compiler intrinsics
situation.  Today we don't have a core intrinsics library, resulting
in everybody creating their own.  ArmPkg has one, CryptoPkg has one.
I'm sure there are many more.

This doesn't make sense.  Given we can't avoid compiler intrinsics (as
proven by the existence of those libraries) we should better have them
as core library so we have to maintain a single version only.

Given we already have BaseIoLibIntrinsic in MdePkg we can place the
compiler intrinsics there too.  This little patch series does just that:
It moves over the existing ArmPkg intrinsics, fixes them to build on
non-arm too, and adds additional bits from the CryptoPkg intrinsics.

v2 changes:
 - rebase to latest master.
 - add review tags
 - add patch moving size_t to header file (patch #3).
 - add patches copying over more intrinsics from
   edk2-libc repo (patches #5 -> #10).

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3649

take care,
  Gerd

Gerd Hoffmann (10):
  MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
  MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
  MdePkg/CompilerIntrinsicsLib: move size_t typedef to header file
  MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp
  MdePkg/CompilerIntrinsicsLib: copy over intrinsics from edk2-libc repo
  MdePkg/CompilerIntrinsicsLib: add SPDX License tags
  MdePkg/CompilerIntrinsicsLib: drop include from Gcc.c
  MdePkg/CompilerIntrinsicsLib: drop debug logging from Gcc.c
  MdePkg/CompilerIntrinsicsLib: remove duplicate functions from Gcc.c
  MdePkg/CompilerIntrinsicsLib: add new sources to
    CompilerIntrinsicsLib.inf

 ArmVirtPkg/ArmVirt.dsc.inc                    |   4 +-
 .../UnitTestFrameworkPkgTarget.dsc.inc        |   2 +-
 ArmPkg/ArmPkg.dsc                             |   3 +-
 .../ArmCrashDumpDxe/ArmCrashDumpDxe.dsc       |   2 +-
 ArmPlatformPkg/ArmPlatformPkg.dsc             |   2 +-
 CryptoPkg/CryptoPkg.dsc                       |   5 +-
 DynamicTablesPkg/DynamicTablesPkg.dsc         |   2 +-
 EmbeddedPkg/EmbeddedPkg.dsc                   |   2 +-
 EmulatorPkg/EmulatorPkg.dsc                   |   2 +-
 FatPkg/FatPkg.dsc                             |   2 +-
 FmpDevicePkg/FmpDevicePkg.dsc                 |   4 +-
 MdeModulePkg/MdeModulePkg.dsc                 |   2 +-
 MdePkg/MdePkg.dsc                             |   1 +
 NetworkPkg/NetworkPkg.dsc                     |   4 +-
 OvmfPkg/AmdSev/AmdSevX64.dsc                  |   2 +-
 OvmfPkg/Bhyve/BhyveX64.dsc                    |   2 +-
 OvmfPkg/CloudHv/CloudHvX64.dsc                |   2 +-
 OvmfPkg/IntelTdx/IntelTdxX64.dsc              |   2 +-
 OvmfPkg/Microvm/MicrovmX64.dsc                |   2 +-
 OvmfPkg/OvmfPkgIa32.dsc                       |   2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                    |   2 +-
 OvmfPkg/OvmfPkgX64.dsc                        |   2 +-
 OvmfPkg/OvmfXen.dsc                           |   2 +-
 RedfishPkg/RedfishPkg.dsc                     |   2 +-
 SecurityPkg/SecurityPkg.dsc                   |  12 +-
 ShellPkg/ShellPkg.dsc                         |   2 +-
 SignedCapsulePkg/SignedCapsulePkg.dsc         |  14 +-
 StandaloneMmPkg/StandaloneMmPkg.dsc           |   2 +-
 UefiPayloadPkg/UefiPayloadPkg.dsc             |   2 +-
 .../Library/IntrinsicLib/IntrinsicLib.inf     |  67 ------
 .../CompilerIntrinsicsLib.inf                 |  35 ++-
 {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
 .../Library/CompilerIntrinsicsLib/types_ms.h  |  14 ++
 CryptoPkg/Library/IntrinsicLib/CopyMem.c      |  47 ----
 .../Library/IntrinsicLib/MemoryIntrinsics.c   |  74 ------
 .../Library/CompilerIntrinsicsLib/Ia32/Gcc.c  | 215 ++++++++++++++++++
 .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |   0
 .../Ia32/MathLShiftS64.c                      |   0
 .../Ia32/MathRShiftU64.c                      |   0
 .../CompilerIntrinsicsLib/Ia32/lldiv.c        | 100 ++++++++
 .../CompilerIntrinsicsLib/Ia32/lldvrm.c       | 104 +++++++++
 .../CompilerIntrinsicsLib/Ia32/llmul.c        |  84 +++++++
 .../CompilerIntrinsicsLib/Ia32/llrem.c        |  97 ++++++++
 .../CompilerIntrinsicsLib/Ia32/llshl.c        |  10 +-
 .../CompilerIntrinsicsLib/Ia32/llshr.c        |  63 +++++
 .../CompilerIntrinsicsLib/Ia32/ulldiv.c       |  91 ++++++++
 .../CompilerIntrinsicsLib/Ia32/ulldvrm.c      | 104 +++++++++
 .../CompilerIntrinsicsLib/Ia32/ullrem.c       |  97 ++++++++
 .../CompilerIntrinsicsLib/Ia32/ullshr.c       |  10 +-
 .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   2 +-
 .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
 .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   6 +-
 .../CompilerIntrinsicsLib/memmove_ms.c        |   6 +-
 .../Library/CompilerIntrinsicsLib/memset.c    |   0
 .../Library/CompilerIntrinsicsLib/memset_ms.c |   6 +-
 MdePkg/Library/CompilerIntrinsicsLib/strcmp.c |  33 +++
 ArmPkg/ArmPkg.ci.yaml                         |   1 -
 .../DEBUG_XCODE31/CompilerIntrinsicsLib.lib   | Bin 36072 -> 36072 bytes
 .../DEBUG_XCODE32/CompilerIntrinsicsLib.lib   | Bin 36072 -> 36072 bytes
 .../Library/IntrinsicLib/BaseIntrinsicLib.uni |  16 --
 .../CompilerIntrinsicsLib/AArch64/Atomics.S   |   0
 .../CompilerIntrinsicsLib/Arm/ashldi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/ashrdi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/clzsi2.S        |   0
 .../CompilerIntrinsicsLib/Arm/ctzsi2.S        |   0
 .../Library/CompilerIntrinsicsLib/Arm/div.S   |   0
 .../Library/CompilerIntrinsicsLib/Arm/div.asm |   0
 .../CompilerIntrinsicsLib/Arm/divdi3.S        |   0
 .../CompilerIntrinsicsLib/Arm/divsi3.S        |   0
 .../Library/CompilerIntrinsicsLib/Arm/lasr.S  |   0
 .../CompilerIntrinsicsLib/Arm/lasr.asm        |   0
 .../CompilerIntrinsicsLib/Arm/ldivmod.S       |   0
 .../CompilerIntrinsicsLib/Arm/ldivmod.asm     |   0
 .../Library/CompilerIntrinsicsLib/Arm/llsl.S  |   0
 .../CompilerIntrinsicsLib/Arm/llsl.asm        |   0
 .../Library/CompilerIntrinsicsLib/Arm/llsr.S  |   0
 .../CompilerIntrinsicsLib/Arm/llsr.asm        |   0
 .../CompilerIntrinsicsLib/Arm/lshrdi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/memmove.S       |   0
 .../CompilerIntrinsicsLib/Arm/memmove.asm     |   0
 .../CompilerIntrinsicsLib/Arm/moddi3.S        |   0
 .../CompilerIntrinsicsLib/Arm/modsi3.S        |   0
 .../CompilerIntrinsicsLib/Arm/muldi3.S        |   0
 .../Library/CompilerIntrinsicsLib/Arm/mullu.S |   0
 .../CompilerIntrinsicsLib/Arm/mullu.asm       |   0
 .../CompilerIntrinsicsLib/Arm/sourcery.S      |   0
 .../CompilerIntrinsicsLib/Arm/switch.asm      |   0
 .../CompilerIntrinsicsLib/Arm/switch16.S      |   0
 .../CompilerIntrinsicsLib/Arm/switch32.S      |   0
 .../CompilerIntrinsicsLib/Arm/switch8.S       |   0
 .../CompilerIntrinsicsLib/Arm/switchu8.S      |   0
 .../CompilerIntrinsicsLib/Arm/ucmpdi2.S       |   0
 .../CompilerIntrinsicsLib/Arm/udivdi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/udivmoddi4.S    |   0
 .../CompilerIntrinsicsLib/Arm/udivsi3.S       |   0
 .../Library/CompilerIntrinsicsLib/Arm/uldiv.S |   0
 .../CompilerIntrinsicsLib/Arm/uldiv.asm       |   0
 .../CompilerIntrinsicsLib/Arm/umoddi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/umodsi3.S       |   0
 .../Library/CompilerIntrinsicsLib/Arm/uread.S |   0
 .../CompilerIntrinsicsLib/Arm/uread.asm       |   0
 .../CompilerIntrinsicsLib/Arm/uwrite.S        |   0
 .../CompilerIntrinsicsLib/Arm/uwrite.asm      |   0
 .../Ia32/MathLShiftS64.nasm                   |   0
 .../Ia32/MathRShiftU64.nasm                   |   0
 .../CompilerIntrinsicsLib/Ia32/ashrdi3.S      |  68 ++++++
 .../CompilerIntrinsicsLib/Ia32/mulll.S        |  79 +++++++
 .../CompilerIntrinsicsLib/Ia32/shldi3.S       |  64 ++++++
 .../CompilerIntrinsicsLib/Ia32/udivdi3.S      |  85 +++++++
 .../CompilerIntrinsicsLib/Ia32/umoddi3.S      |  91 ++++++++
 MdePkg/MdePkg.ci.yaml                         |   1 +
 111 files changed, 1490 insertions(+), 269 deletions(-)
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (66%)
 rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/types_ms.h
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/CopyMem.c
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathFtol.c (100%)
 copy {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathLShiftS64.c (100%)
 copy {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathRShiftU64.c (100%)
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
 rename CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c => MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c (61%)
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
 rename CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c => MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c (62%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcmp_ms.c (89%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy_ms.c (82%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (83%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c (80%)
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/strcmp.c
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/AArch64/Atomics.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashldi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/clzsi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/moddi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/modsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/muldi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/sourcery.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch16.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch32.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch8.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switchu8.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umoddi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umodsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.asm (100%)
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathLShiftS64.nasm (100%)
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathRShiftU64.nasm (100%)
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S

-- 
2.35.1


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

* [PATCH v2 01/10] MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 02/10] MdePkg/CompilerIntrinsicsLib: fix msft sources for x64 Gerd Hoffmann
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel, Jiewen Yao, Ard Biesheuvel

First step in creating a single, common compiler intrinsics library for
everybody who needs it.  Move the ArmPkg library to MdePkg, update all
references.  No code changes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
---
 ArmVirtPkg/ArmVirt.dsc.inc                    |   2 +-
 .../UnitTestFrameworkPkgTarget.dsc.inc        |   2 +-
 ArmPkg/ArmPkg.dsc                             |   3 +--
 .../ArmCrashDumpDxe/ArmCrashDumpDxe.dsc       |   2 +-
 ArmPlatformPkg/ArmPlatformPkg.dsc             |   2 +-
 CryptoPkg/CryptoPkg.dsc                       |   2 +-
 DynamicTablesPkg/DynamicTablesPkg.dsc         |   2 +-
 EmbeddedPkg/EmbeddedPkg.dsc                   |   2 +-
 FatPkg/FatPkg.dsc                             |   2 +-
 FmpDevicePkg/FmpDevicePkg.dsc                 |   2 +-
 MdeModulePkg/MdeModulePkg.dsc                 |   2 +-
 MdePkg/MdePkg.dsc                             |   1 +
 NetworkPkg/NetworkPkg.dsc                     |   2 +-
 RedfishPkg/RedfishPkg.dsc                     |   2 +-
 SecurityPkg/SecurityPkg.dsc                   |   2 +-
 ShellPkg/ShellPkg.dsc                         |   2 +-
 SignedCapsulePkg/SignedCapsulePkg.dsc         |   2 +-
 StandaloneMmPkg/StandaloneMmPkg.dsc           |   2 +-
 .../CompilerIntrinsicsLib.inf                 |   1 -
 {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
 .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   0
 .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
 .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   0
 .../CompilerIntrinsicsLib/memmove_ms.c        |   0
 .../Library/CompilerIntrinsicsLib/memset.c    |   0
 .../Library/CompilerIntrinsicsLib/memset_ms.c |   0
 ArmPkg/ArmPkg.ci.yaml                         |   1 -
 .../DEBUG_XCODE31/CompilerIntrinsicsLib.lib   | Bin 36072 -> 36072 bytes
 .../DEBUG_XCODE32/CompilerIntrinsicsLib.lib   | Bin 36072 -> 36072 bytes
 .../CompilerIntrinsicsLib/AArch64/Atomics.S   |   0
 .../CompilerIntrinsicsLib/Arm/ashldi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/ashrdi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/clzsi2.S        |   0
 .../CompilerIntrinsicsLib/Arm/ctzsi2.S        |   0
 .../Library/CompilerIntrinsicsLib/Arm/div.S   |   0
 .../Library/CompilerIntrinsicsLib/Arm/div.asm |   0
 .../CompilerIntrinsicsLib/Arm/divdi3.S        |   0
 .../CompilerIntrinsicsLib/Arm/divsi3.S        |   0
 .../Library/CompilerIntrinsicsLib/Arm/lasr.S  |   0
 .../CompilerIntrinsicsLib/Arm/lasr.asm        |   0
 .../CompilerIntrinsicsLib/Arm/ldivmod.S       |   0
 .../CompilerIntrinsicsLib/Arm/ldivmod.asm     |   0
 .../Library/CompilerIntrinsicsLib/Arm/llsl.S  |   0
 .../CompilerIntrinsicsLib/Arm/llsl.asm        |   0
 .../Library/CompilerIntrinsicsLib/Arm/llsr.S  |   0
 .../CompilerIntrinsicsLib/Arm/llsr.asm        |   0
 .../CompilerIntrinsicsLib/Arm/lshrdi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/memmove.S       |   0
 .../CompilerIntrinsicsLib/Arm/memmove.asm     |   0
 .../CompilerIntrinsicsLib/Arm/moddi3.S        |   0
 .../CompilerIntrinsicsLib/Arm/modsi3.S        |   0
 .../CompilerIntrinsicsLib/Arm/muldi3.S        |   0
 .../Library/CompilerIntrinsicsLib/Arm/mullu.S |   0
 .../CompilerIntrinsicsLib/Arm/mullu.asm       |   0
 .../CompilerIntrinsicsLib/Arm/sourcery.S      |   0
 .../CompilerIntrinsicsLib/Arm/switch.asm      |   0
 .../CompilerIntrinsicsLib/Arm/switch16.S      |   0
 .../CompilerIntrinsicsLib/Arm/switch32.S      |   0
 .../CompilerIntrinsicsLib/Arm/switch8.S       |   0
 .../CompilerIntrinsicsLib/Arm/switchu8.S      |   0
 .../CompilerIntrinsicsLib/Arm/ucmpdi2.S       |   0
 .../CompilerIntrinsicsLib/Arm/udivdi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/udivmoddi4.S    |   0
 .../CompilerIntrinsicsLib/Arm/udivsi3.S       |   0
 .../Library/CompilerIntrinsicsLib/Arm/uldiv.S |   0
 .../CompilerIntrinsicsLib/Arm/uldiv.asm       |   0
 .../CompilerIntrinsicsLib/Arm/umoddi3.S       |   0
 .../CompilerIntrinsicsLib/Arm/umodsi3.S       |   0
 .../Library/CompilerIntrinsicsLib/Arm/uread.S |   0
 .../CompilerIntrinsicsLib/Arm/uread.asm       |   0
 .../CompilerIntrinsicsLib/Arm/uwrite.S        |   0
 .../CompilerIntrinsicsLib/Arm/uwrite.asm      |   0
 MdePkg/MdePkg.ci.yaml                         |   1 +
 73 files changed, 19 insertions(+), 20 deletions(-)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (95%)
 rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcmp_ms.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy_ms.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/AArch64/Atomics.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashldi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/clzsi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/moddi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/modsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/muldi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/sourcery.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch16.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch32.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch8.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switchu8.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umoddi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umodsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.asm (100%)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index ba711deac025..97edf0487964 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -96,7 +96,7 @@ [LibraryClasses.common]
   # It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions.
   # This library provides the instrinsic functions such a compiler may generate calls to.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index 8adf690098ae..9f2b671f7c86 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -37,7 +37,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generated by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   #
   # Since software stack checking may be heuristically enabled by the compiler
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 59fd8f295d4f..f9268de8347e 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -101,7 +101,7 @@ [LibraryClasses.common.PEIM]
   PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
@@ -109,7 +109,6 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
 [Components.common]
   ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
-  ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
   ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
   ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
diff --git a/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc b/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
index 2818ce65db98..ac818f0d98a2 100644
--- a/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
+++ b/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
@@ -43,7 +43,7 @@ [LibraryClasses]
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
 
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 [Components.common]
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
index 661a4cea220d..b146e4fe8a69 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg.dsc
@@ -76,7 +76,7 @@ [LibraryClasses.common]
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
 
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 [LibraryClasses.common.PEIM]
diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 0aa72ed87846..2d4d4c2797e5 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -74,7 +74,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # [LibraryClasses.ARM, LibraryClasses.AARCH64] and NULL mean link this library
   # into all ARM and AARCH64 images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index 068f0bc63080..c30b0f943a60 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -34,7 +34,7 @@ [LibraryClasses]
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
 
diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
index f7ed61545c2e..4c4a6029d6fd 100644
--- a/EmbeddedPkg/EmbeddedPkg.dsc
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
@@ -128,7 +128,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
   ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
   SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/FatPkg/FatPkg.dsc b/FatPkg/FatPkg.dsc
index 4ddb5c3e004b..32708b1e58cf 100644
--- a/FatPkg/FatPkg.dsc
+++ b/FatPkg/FatPkg.dsc
@@ -57,7 +57,7 @@ [LibraryClasses.common.PEIM]
   MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 ###################################################################################################
diff --git a/FmpDevicePkg/FmpDevicePkg.dsc b/FmpDevicePkg/FmpDevicePkg.dsc
index 7b1af285dd65..258b5ce0cded 100644
--- a/FmpDevicePkg/FmpDevicePkg.dsc
+++ b/FmpDevicePkg/FmpDevicePkg.dsc
@@ -78,7 +78,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # [LibraryClasses.ARM, LibraryClasses.AARCH64] and NULL mean link this library
   # into all ARM and AARCH64 images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index b1d83461865e..e3146c378800 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -183,7 +183,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generated by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   #
   # Since software stack checking may be heuristically enabled by the compiler
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index d6a7af412be7..3da5467b430d 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -36,6 +36,7 @@ [LibraryClasses]
 
 [Components]
   MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+  MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
   MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.inf
   MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index 762134023d3f..f69eb3d1d5c2 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -76,7 +76,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generated by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
 
diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index 16139146ff83..0dc120d82699 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -45,7 +45,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   #
   # This library provides the instrinsic functions generated by a given compiler.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
 
diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 73a93c2285b1..2b5ef67016b8 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -79,7 +79,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the intrinsic functions generate by a given compiler.
   # And NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc
index 38fde3dc71dd..a166af0a81ae 100644
--- a/ShellPkg/ShellPkg.dsc
+++ b/ShellPkg/ShellPkg.dsc
@@ -70,7 +70,7 @@ [LibraryClasses.ARM,LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generate by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/SignedCapsulePkg/SignedCapsulePkg.dsc b/SignedCapsulePkg/SignedCapsulePkg.dsc
index 8a27207a6f20..72b533cd04e8 100644
--- a/SignedCapsulePkg/SignedCapsulePkg.dsc
+++ b/SignedCapsulePkg/SignedCapsulePkg.dsc
@@ -104,7 +104,7 @@ [LibraryClasses.AARCH64, LibraryClasses.ARM]
   # This library provides the instrinsic functions generate by a given compiler.
   # And NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index 8012f93b7dcc..e9488538cb21 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -67,7 +67,7 @@ [LibraryClasses.AARCH64, LibraryClasses.ARM]
   CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   PeCoffExtraActionLib|StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
 
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 [LibraryClasses.common.MM_CORE_STANDALONE]
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
similarity index 95%
rename from ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
rename to MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
index fcf48c678119..6fa09e5f0dec 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+++ b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@@ -84,7 +84,6 @@ [Sources.AARCH64]
 
 [Packages]
   MdePkg/MdePkg.dec
-  ArmPkg/ArmPkg.dec
 
 [BuildOptions]
   MSFT:*_*_*_CC_FLAGS = /GL-
diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/MdePkg/Include/AsmMacroIoLib.h
similarity index 100%
rename from ArmPkg/Include/AsmMacroIoLib.h
rename to MdePkg/Include/AsmMacroIoLib.h
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/MdePkg/Library/CompilerIntrinsicsLib/memcpy.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memcpy.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c b/MdePkg/Library/CompilerIntrinsicsLib/memset.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memset.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memset.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
diff --git a/ArmPkg/ArmPkg.ci.yaml b/ArmPkg/ArmPkg.ci.yaml
index b7e07aaef675..cb892894f3b8 100644
--- a/ArmPkg/ArmPkg.ci.yaml
+++ b/ArmPkg/ArmPkg.ci.yaml
@@ -21,7 +21,6 @@
         "IgnoreFiles": [
             "Library/ArmSoftFloatLib/berkeley-softfloat-3",
             "Library/ArmSoftFloatLib/ArmSoftFloatLib.c",
-            "Library/CompilerIntrinsicsLib",
             "Universal/Smbios/SmbiosMiscDxe"
         ]
     },
diff --git a/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE31/CompilerIntrinsicsLib.lib b/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE31/CompilerIntrinsicsLib.lib
index 79964fe1b65afe472af19fdb87c2733f5297d0a4..712aa917bcd0342a4d47923d208cf866992fbe5a 100644
GIT binary patch
delta 369
zcmaDclj+4wrVZcNChyH;pZru!X|p{0WhOAkR3vJ1FxP*COts)<u*_ytk-O|r^{Sig
zWCCI8!#BT``v{iV{8TL+A-YQQ4hyqyO6uf9H|Nb~^u(Fr98Du81gFsS6BAr!rG*?q
z53g+tf^*%m9n9IB=%xr0b=iE<>pM)d`(`e`e=v^AX8%A3eyFkTn{OrrLOis!P<eAm
zx;(;>7c(KA+Pt;U2_YI<G8N`krOm=MOAs=m^^7pvoj1ocZ-!auyg9V(5`vT4iQr6b
H?MVgz__B<&

delta 369
zcmaDclj+4wrVZcNm>r99CqGnE+bqw1nF-7>6p7m$%=I53Q!Tg|EVJ2A<RLp$z2;^+
znLwEO=*@5CK7wU7KUB*`h_2GS!va>H=;plnjGj0%oTF*Pgy0mKeuC%$DO+hFhtR`o
z+k)U+cWei9HYd6%!bDv*pY-|;)9k*P%kLkI<FeU5(19Onq5I~W34ss~Z7fvZ9Fi`N
zaOB0zyAY>uEObMNhL%i)c~xz*aLp2gjA%V0%y#F^G0l*mnGAAzXxk;2?arHXI}x18
Htv$&A)|`a2

diff --git a/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE32/CompilerIntrinsicsLib.lib b/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE32/CompilerIntrinsicsLib.lib
index 79964fe1b65afe472af19fdb87c2733f5297d0a4..712aa917bcd0342a4d47923d208cf866992fbe5a 100644
GIT binary patch
delta 369
zcmaDclj+4wrVZcNChyH;pZru!X|p{0WhOAkR3vJ1FxP*COts)<u*_ytk-O|r^{Sig
zWCCI8!#BT``v{iV{8TL+A-YQQ4hyqyO6uf9H|Nb~^u(Fr98Du81gFsS6BAr!rG*?q
z53g+tf^*%m9n9IB=%xr0b=iE<>pM)d`(`e`e=v^AX8%A3eyFkTn{OrrLOis!P<eAm
zx;(;>7c(KA+Pt;U2_YI<G8N`krOm=MOAs=m^^7pvoj1ocZ-!auyg9V(5`vT4iQr6b
H?MVgz__B<&

delta 369
zcmaDclj+4wrVZcNm>r99CqGnE+bqw1nF-7>6p7m$%=I53Q!Tg|EVJ2A<RLp$z2;^+
znLwEO=*@5CK7wU7KUB*`h_2GS!va>H=;plnjGj0%oTF*Pgy0mKeuC%$DO+hFhtR`o
z+k)U+cWei9HYd6%!bDv*pY-|;)9k*P%kLkI<FeU5(19Onq5I~W34ss~Z7fvZ9Fi`N
zaOB0zyAY>uEObMNhL%i)c~xz*aLp2gjA%V0%y#F^G0l*mnGAAzXxk;2?arHXI}x18
Htv$&A)|`a2

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S b/MdePkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S
rename to MdePkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/div.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/div.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/div.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/div.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch16.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch16.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch16.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch16.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch32.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch32.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch32.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch32.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch8.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch8.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch8.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch8.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml
index 054233ebc7bd..34300c06e36a 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -52,6 +52,7 @@
             "Include/IndustryStandard/UefiTcgPlatform.h",
             "Include/Library/PcdLib.h",
             "Include/Library/SafeIntLib.h",
+            "Library/CompilerIntrinsicsLib",
             "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c"
         ]
     },
-- 
2.35.1


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

* [PATCH v2 02/10] MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 01/10] MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 03/10] MdePkg/CompilerIntrinsicsLib: move size_t typedef to header file Gerd Hoffmann
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel, Jiewen Yao, Ard Biesheuvel

Update #if conditions so the 64bit version is picked for X64 too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
---
 MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c  | 2 +-
 MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c  | 2 +-
 MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c | 2 +-
 MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
index cedbfca47139..2fac8f1e23e3 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
@@ -7,7 +7,7 @@
 //
 // ------------------------------------------------------------------------------
 
-#if defined (_M_ARM64)
+#if defined (_M_ARM64) || defined (_M_X64)
 typedef unsigned __int64 size_t;
 #else
 typedef unsigned __int32 size_t;
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
index 0eafa83ed476..730aa806d50b 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
@@ -7,7 +7,7 @@
 //
 // ------------------------------------------------------------------------------
 
-#if defined (_M_ARM64)
+#if defined (_M_ARM64) || defined (_M_X64)
 typedef unsigned __int64 size_t;
 #else
 typedef unsigned __int32 size_t;
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
index f68eb52a6ca5..3207b94a8675 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
@@ -7,7 +7,7 @@
 //
 // ------------------------------------------------------------------------------
 
-#if defined (_M_ARM64)
+#if defined (_M_ARM64) || defined (_M_X64)
 typedef unsigned __int64 size_t;
 #else
 typedef unsigned __int32 size_t;
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
index 5882cd28b06d..deb902c6ae88 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
@@ -7,7 +7,7 @@
 //
 // ------------------------------------------------------------------------------
 
-#if defined (_M_ARM64)
+#if defined (_M_ARM64) || defined (_M_X64)
 typedef unsigned __int64 size_t;
 #else
 typedef unsigned __int32 size_t;
-- 
2.35.1


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

* [PATCH v2 03/10] MdePkg/CompilerIntrinsicsLib: move size_t typedef to header file
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 01/10] MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 02/10] MdePkg/CompilerIntrinsicsLib: fix msft sources for x64 Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 04/10] MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp Gerd Hoffmann
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../{memset_ms.c => types_ms.h}               | 29 +------------------
 .../Library/CompilerIntrinsicsLib/memcpy_ms.c |  6 +---
 .../CompilerIntrinsicsLib/memmove_ms.c        |  6 +---
 .../Library/CompilerIntrinsicsLib/memset_ms.c |  6 +---
 4 files changed, 4 insertions(+), 43 deletions(-)
 copy MdePkg/Library/CompilerIntrinsicsLib/{memset_ms.c => types_ms.h} (52%)

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/types_ms.h
similarity index 52%
copy from MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
copy to MdePkg/Library/CompilerIntrinsicsLib/types_ms.h
index deb902c6ae88..d8b578be1f46 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/types_ms.h
@@ -1,6 +1,6 @@
 // ------------------------------------------------------------------------------
 //
-// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>
+// Copyright (c) 2019, Pete Batard. All rights reserved.
 // Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
 //
 // SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -12,30 +12,3 @@ typedef unsigned __int64 size_t;
 #else
 typedef unsigned __int32 size_t;
 #endif
-
-void *
-memset (
-  void *,
-  int,
-  size_t
-  );
-
-#pragma intrinsic(memset)
-#pragma function(memset)
-void *
-memset (
-  void    *s,
-  int     c,
-  size_t  n
-  )
-{
-  unsigned char  *d;
-
-  d = s;
-
-  while (n-- != 0) {
-    *d++ = (unsigned char)c;
-  }
-
-  return s;
-}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
index 730aa806d50b..d2c3d7198121 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
@@ -7,11 +7,7 @@
 //
 // ------------------------------------------------------------------------------
 
-#if defined (_M_ARM64) || defined (_M_X64)
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned __int32 size_t;
-#endif
+#include "types_ms.h"
 
 void *
 memcpy (
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
index 3207b94a8675..837744a2920c 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
@@ -7,11 +7,7 @@
 //
 // ------------------------------------------------------------------------------
 
-#if defined (_M_ARM64) || defined (_M_X64)
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned __int32 size_t;
-#endif
+#include "types_ms.h"
 
 void *
 memmove (
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
index deb902c6ae88..3569bebdf80b 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
@@ -7,11 +7,7 @@
 //
 // ------------------------------------------------------------------------------
 
-#if defined (_M_ARM64) || defined (_M_X64)
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned __int32 size_t;
-#endif
+#include "types_ms.h"
 
 void *
 memset (
-- 
2.35.1


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

* [PATCH v2 04/10] MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 03/10] MdePkg/CompilerIntrinsicsLib: move size_t typedef to header file Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 05/10] MdePkg/CompilerIntrinsicsLib: copy over intrinsics from edk2-libc repo Gerd Hoffmann
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel, Jiewen Yao, Ard Biesheuvel

Move intrinsics for ia32 from CryptoPkg/Library/IntrinsicLib
to MdePkg/Library/CompilerIntrinsicsLib.  Also move strcmp.

Remove CryptoPkg/Library/IntrinsicLib.
Use MdePkg/Library/CompilerIntrinsicsLib instead.
Update all references.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
---
 ArmVirtPkg/ArmVirt.dsc.inc                    |  2 +-
 CryptoPkg/CryptoPkg.dsc                       |  3 +-
 EmulatorPkg/EmulatorPkg.dsc                   |  2 +-
 FmpDevicePkg/FmpDevicePkg.dsc                 |  2 +-
 NetworkPkg/NetworkPkg.dsc                     |  2 +-
 OvmfPkg/AmdSev/AmdSevX64.dsc                  |  2 +-
 OvmfPkg/Bhyve/BhyveX64.dsc                    |  2 +-
 OvmfPkg/CloudHv/CloudHvX64.dsc                |  2 +-
 OvmfPkg/IntelTdx/IntelTdxX64.dsc              |  2 +-
 OvmfPkg/Microvm/MicrovmX64.dsc                |  2 +-
 OvmfPkg/OvmfPkgIa32.dsc                       |  2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                    |  2 +-
 OvmfPkg/OvmfPkgX64.dsc                        |  2 +-
 OvmfPkg/OvmfXen.dsc                           |  2 +-
 SecurityPkg/SecurityPkg.dsc                   | 10 +--
 SignedCapsulePkg/SignedCapsulePkg.dsc         | 12 +--
 UefiPayloadPkg/UefiPayloadPkg.dsc             |  2 +-
 .../Library/IntrinsicLib/IntrinsicLib.inf     | 67 -----------------
 .../CompilerIntrinsicsLib.inf                 | 14 ++++
 CryptoPkg/Library/IntrinsicLib/CopyMem.c      | 47 ------------
 .../Library/IntrinsicLib/MemoryIntrinsics.c   | 74 -------------------
 .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |  0
 .../Ia32/MathLShiftS64.c                      |  0
 .../Ia32/MathRShiftU64.c                      |  0
 MdePkg/Library/CompilerIntrinsicsLib/strcmp.c | 33 +++++++++
 .../Library/IntrinsicLib/BaseIntrinsicLib.uni | 16 ----
 .../Ia32/MathLShiftS64.nasm                   |  0
 .../Ia32/MathRShiftU64.nasm                   |  0
 28 files changed, 73 insertions(+), 231 deletions(-)
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/CopyMem.c
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathFtol.c (100%)
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathLShiftS64.c (100%)
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathRShiftU64.c (100%)
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/strcmp.c
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathLShiftS64.nasm (100%)
 rename {CryptoPkg/Library/IntrinsicLib => MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathRShiftU64.nasm (100%)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 97edf0487964..d8b3db4f75ce 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -154,7 +154,7 @@ [LibraryClasses.common]
   #
   # CryptoPkg libraries needed by multiple firmware features
   #
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 2d4d4c2797e5..d593ae0e709c 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -103,7 +103,7 @@ [LibraryClasses]
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf  #???
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf                                          #???
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
 
 [LibraryClasses.ARM]
@@ -240,7 +240,6 @@ [Components]
   CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
   CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
   CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
-  CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
   CryptoPkg/Library/TlsLib/TlsLib.inf
   CryptoPkg/Library/TlsLibNull/TlsLibNull.inf
   CryptoPkg/Library/OpensslLib/OpensslLib.inf
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 554c13ddb500..f3a97b2e4577 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -128,7 +128,7 @@ [LibraryClasses]
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
   PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
   AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
diff --git a/FmpDevicePkg/FmpDevicePkg.dsc b/FmpDevicePkg/FmpDevicePkg.dsc
index 258b5ce0cded..f314548d4066 100644
--- a/FmpDevicePkg/FmpDevicePkg.dsc
+++ b/FmpDevicePkg/FmpDevicePkg.dsc
@@ -57,7 +57,7 @@ [LibraryClasses]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   RngLib|MdePkg/Library/BaseRngLibNull/BaseRngLibNull.inf
diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index f69eb3d1d5c2..95dedad392fb 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -53,7 +53,7 @@ [LibraryClasses]
 !else
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index fcdc3efab204..cacb89e9ba75 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -187,7 +187,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
   RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
 
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index e1b6b8e15f36..5cd621999b4a 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -187,7 +187,7 @@ [LibraryClasses]
   IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index 20f3bc340807..e4f3e0bc9d29 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -197,7 +197,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 245155d41b30..d2b588d69608 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -169,7 +169,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
   RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
 
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 59580ccd4691..8e12c4149c76 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -194,7 +194,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index e4218b01f0fc..4f4eced4ffed 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -194,7 +194,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index a80cdaacb8bc..574c0d3afa06 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -198,7 +198,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index fb2899f8a1be..621027b8646c 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -206,7 +206,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 7bd594c6e263..bf4ec30a13bd 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -183,7 +183,7 @@ [LibraryClasses]
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 !if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 2b5ef67016b8..b71b78f56ca5 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -101,7 +101,7 @@ [LibraryClasses.common.PEIM]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
 !endif
@@ -119,7 +119,7 @@ [LibraryClasses.common.DXE_DRIVER]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
 !endif
@@ -140,7 +140,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
 !endif
@@ -152,7 +152,7 @@ [LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
 !endif
@@ -171,7 +171,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
 !endif
diff --git a/SignedCapsulePkg/SignedCapsulePkg.dsc b/SignedCapsulePkg/SignedCapsulePkg.dsc
index 72b533cd04e8..213e165be5d0 100644
--- a/SignedCapsulePkg/SignedCapsulePkg.dsc
+++ b/SignedCapsulePkg/SignedCapsulePkg.dsc
@@ -126,7 +126,7 @@ [LibraryClasses.common.PEIM]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
 !endif
@@ -141,7 +141,7 @@ [LibraryClasses.common.DXE_DRIVER]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
 !endif
@@ -155,7 +155,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
 !endif
@@ -178,7 +178,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
 !endif
@@ -190,7 +190,7 @@ [LibraryClasses.common.UEFI_DRIVER]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
 !endif
@@ -202,7 +202,7 @@ [LibraryClasses.common.UEFI_APPLICATION]
 !ifdef CONTINUOUS_INTEGRATION
   BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
 !else
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
 !endif
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 17b30589e77c..fa27513c696c 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -182,7 +182,7 @@ [LibraryClasses]
   DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
-  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+  IntrinsicLib|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
   HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf
diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
deleted file mode 100644
index fcbb93316cf7..000000000000
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ /dev/null
@@ -1,67 +0,0 @@
-## @file
-#  Intrinsic Routines Wrapper Library Instance.
-#
-#  Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = BaseIntrinsicLib
-  MODULE_UNI_FILE                = BaseIntrinsicLib.uni
-  FILE_GUID                      = 63850097-3E97-4c4f-A52D-C811A0106105
-  MODULE_TYPE                    = BASE
-  VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = IntrinsicLib
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-#  VALID_ARCHITECTURES           = IA32 X64
-#
-
-[Sources]
-  MemoryIntrinsics.c
-
-[Sources.IA32]
-  CopyMem.c
-
-  Ia32/MathLShiftS64.c      | MSFT
-  Ia32/MathRShiftU64.c      | MSFT
-  Ia32/MathFtol.c           | MSFT
-
-  Ia32/MathLShiftS64.c      | INTEL
-  Ia32/MathRShiftU64.c      | INTEL
-  Ia32/MathFtol.c           | INTEL
-
-  Ia32/MathLShiftS64.nasm   | GCC
-  Ia32/MathRShiftU64.nasm   | GCC
-
-[Sources.X64]
-  CopyMem.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-
-[BuildOptions]
-   #
-   # Override MSFT build option to remove /Oi and /GL
-   #
-   MSFT:DEBUG_VS2003_IA32_CC_FLAGS        == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- /Zi /Gm
-   MSFT:RELEASE_VS2003_IA32_CC_FLAGS      == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX-
-   MSFT:DEBUG_VS2003xASL_IA32_CC_FLAGS    == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- /Zi /Gm
-   MSFT:RELEASE_VS2003xASL_IA32_CC_FLAGS  == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX-
-   MSFT:DEBUG_DDK3790_IA32_CC_FLAGS       == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
-   MSFT:RELEASE_DDK3790_IA32_CC_FLAGS     == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF
-   MSFT:DEBUG_DDK3790xASL_IA32_CC_FLAGS   == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
-   MSFT:RELEASE_DDK3790xASL_IA32_CC_FLAGS == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF
-   MSFT:DEBUG_*_IA32_CC_FLAGS             == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
-   MSFT:RELEASE_*_IA32_CC_FLAGS           == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF
-   MSFT:DEBUG_*_X64_CC_FLAGS              == /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /O1b2s /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
-   MSFT:RELEASE_*_X64_CC_FLAGS            == /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /O1b2s /Gy /FIAutoGen.h /EHs-c- /GR- /GF
-  INTEL:*_*_*_CC_FLAGS                    =  /Oi-
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
index 6fa09e5f0dec..1604f1ee802f 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+++ b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@@ -29,6 +29,8 @@ [Sources]
   memcmp_ms.c          | MSFT
   memmove_ms.c         | MSFT
 
+  strcmp.c
+
 [Sources.ARM]
   Arm/mullu.asm        | RVCT
   Arm/switch.asm       | RVCT
@@ -82,6 +84,18 @@ [Sources.ARM]
 [Sources.AARCH64]
   AArch64/Atomics.S    | GCC
 
+[Sources.IA32]
+  Ia32/MathLShiftS64.c      | MSFT
+  Ia32/MathRShiftU64.c      | MSFT
+  Ia32/MathFtol.c           | MSFT
+
+  Ia32/MathLShiftS64.c      | INTEL
+  Ia32/MathRShiftU64.c      | INTEL
+  Ia32/MathFtol.c           | INTEL
+
+  Ia32/MathLShiftS64.nasm   | GCC
+  Ia32/MathRShiftU64.nasm   | GCC
+
 [Packages]
   MdePkg/MdePkg.dec
 
diff --git a/CryptoPkg/Library/IntrinsicLib/CopyMem.c b/CryptoPkg/Library/IntrinsicLib/CopyMem.c
deleted file mode 100644
index 14a213d1dadf..000000000000
--- a/CryptoPkg/Library/IntrinsicLib/CopyMem.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file
-  Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
-  Cryptographic Library.
-
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Base.h>
-#include <Library/BaseMemoryLib.h>
-
-#if defined (__clang__) && !defined (__APPLE__)
-
-/* Copies bytes between buffers */
-static __attribute__ ((__used__))
-void *
-__memcpy (
-  void          *dest,
-  const void    *src,
-  unsigned int  count
-  )
-{
-  return CopyMem (dest, src, (UINTN)count);
-}
-
-__attribute__ ((__alias__ ("__memcpy")))
-void *
-memcpy (
-  void          *dest,
-  const void    *src,
-  unsigned int  count
-  );
-
-#else
-/* Copies bytes between buffers */
-void *
-memcpy (
-  void          *dest,
-  const void    *src,
-  unsigned int  count
-  )
-{
-  return CopyMem (dest, src, (UINTN)count);
-}
-
-#endif
diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
deleted file mode 100644
index 611e9fd773b0..000000000000
--- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/** @file
-  Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
-  Cryptographic Library.
-
-Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Base.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/BaseLib.h>
-
-typedef UINTN size_t;
-
-#if defined (__GNUC__) || defined (__clang__)
-#define GLOBAL_USED  __attribute__((used))
-#else
-#define GLOBAL_USED
-#endif
-
-/* OpenSSL will use floating point support, and C compiler produces the _fltused
-   symbol by default. Simply define this symbol here to satisfy the linker. */
-int  GLOBAL_USED  _fltused = 1;
-
-/* Sets buffers to a specified character */
-void *
-memset (
-  void    *dest,
-  int     ch,
-  size_t  count
-  )
-{
-  //
-  // NOTE: Here we use one base implementation for memset, instead of the direct
-  //       optimized SetMem() wrapper. Because the IntrinsicLib has to be built
-  //       without whole program optimization option, and there will be some
-  //       potential register usage errors when calling other optimized codes.
-  //
-
-  //
-  // Declare the local variables that actually move the data elements as
-  // volatile to prevent the optimizer from replacing this function with
-  // the intrinsic memset()
-  //
-  volatile UINT8  *Pointer;
-
-  Pointer = (UINT8 *)dest;
-  while (count-- != 0) {
-    *(Pointer++) = (UINT8)ch;
-  }
-
-  return dest;
-}
-
-/* Compare bytes in two buffers. */
-int
-memcmp (
-  const void  *buf1,
-  const void  *buf2,
-  size_t      count
-  )
-{
-  return (int)CompareMem (buf1, buf2, count);
-}
-
-int
-strcmp (
-  const char  *s1,
-  const char  *s2
-  )
-{
-  return (int)AsciiStrCmp (s1, s2);
-}
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathFtol.c
similarity index 100%
rename from CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c
rename to MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathFtol.c
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathLShiftS64.c
similarity index 100%
rename from CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c
rename to MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathLShiftS64.c
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathRShiftU64.c
similarity index 100%
rename from CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c
rename to MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathRShiftU64.c
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/strcmp.c b/MdePkg/Library/CompilerIntrinsicsLib/strcmp.c
new file mode 100644
index 000000000000..937b19a3dff7
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/strcmp.c
@@ -0,0 +1,33 @@
+/** @file
+  Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
+  Cryptographic Library.
+
+Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BaseLib.h>
+
+typedef UINTN size_t;
+
+#if defined (__GNUC__) || defined (__clang__)
+#define GLOBAL_USED  __attribute__((used))
+#else
+#define GLOBAL_USED
+#endif
+
+/* OpenSSL will use floating point support, and C compiler produces the _fltused
+   symbol by default. Simply define this symbol here to satisfy the linker. */
+int  GLOBAL_USED  _fltused = 1;
+
+int
+strcmp (
+  const char  *s1,
+  const char  *s2
+  )
+{
+  return (int)AsciiStrCmp (s1, s2);
+}
diff --git a/CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni b/CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni
deleted file mode 100644
index 47f19d4080f7..000000000000
--- a/CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni
+++ /dev/null
@@ -1,16 +0,0 @@
-// /** @file
-// Intrinsic Routines Wrapper Library Instance.
-//
-// This module is intrinsic routines wrapper library instance.
-//
-// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT             #language en-US "Intrinsic Routines Wrapper Library Instance"
-
-#string STR_MODULE_DESCRIPTION          #language en-US "This module is intrinsic routines wrapper library instance."
-
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathLShiftS64.nasm
similarity index 100%
rename from CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm
rename to MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathLShiftS64.nasm
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathRShiftU64.nasm
similarity index 100%
rename from CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm
rename to MdePkg/Library/CompilerIntrinsicsLib/Ia32/MathRShiftU64.nasm
-- 
2.35.1


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

* [PATCH v2 05/10] MdePkg/CompilerIntrinsicsLib: copy over intrinsics from edk2-libc repo
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 04/10] MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 06/10] MdePkg/CompilerIntrinsicsLib: add SPDX License tags Gerd Hoffmann
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

Copy over unmodified (except for running through uncrustify), from
https://github.com/tianocore/edk2-libc/tree/master/StdLib/LibC/CRT

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../Library/CompilerIntrinsicsLib/Ia32/Gcc.c  | 283 ++++++++++++++++++
 .../CompilerIntrinsicsLib/Ia32/lldiv.c        |  98 ++++++
 .../CompilerIntrinsicsLib/Ia32/lldvrm.c       | 102 +++++++
 .../CompilerIntrinsicsLib/Ia32/llmul.c        |  82 +++++
 .../CompilerIntrinsicsLib/Ia32/llrem.c        |  95 ++++++
 .../CompilerIntrinsicsLib/Ia32/llshl.c        |  57 ++++
 .../CompilerIntrinsicsLib/Ia32/llshr.c        |  61 ++++
 .../CompilerIntrinsicsLib/Ia32/ulldiv.c       |  89 ++++++
 .../CompilerIntrinsicsLib/Ia32/ulldvrm.c      | 102 +++++++
 .../CompilerIntrinsicsLib/Ia32/ullrem.c       |  95 ++++++
 .../CompilerIntrinsicsLib/Ia32/ullshr.c       |  60 ++++
 .../CompilerIntrinsicsLib/Ia32/ashrdi3.S      |  66 ++++
 .../CompilerIntrinsicsLib/Ia32/mulll.S        |  77 +++++
 .../CompilerIntrinsicsLib/Ia32/shldi3.S       |  62 ++++
 .../CompilerIntrinsicsLib/Ia32/udivdi3.S      |  83 +++++
 .../CompilerIntrinsicsLib/Ia32/umoddi3.S      |  89 ++++++
 16 files changed, 1501 insertions(+)
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
 create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
new file mode 100644
index 000000000000..430139fc5ee0
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
@@ -0,0 +1,283 @@
+/** @file
+  Integer Arithmetic Run-time support functions for GCC.
+  The integer arithmetic routines are used on platforms that don't provide
+  hardware support for arithmetic operations on some modes..
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <sys/EfiCdefs.h>
+
+#include <Library/BaseLib.h>
+
+// Shift Datum left by Count bits.
+// ===========================================================================
+int
+__ashlsi3 (
+  int  Datum,
+  int  Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (int)LShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+long
+__ashldi3 (
+  long  Datum,
+  int   Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long)LShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+long long
+__ashlti3 (
+  long long  Datum,
+  int        Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long long)LShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+// Arithmetically shift Datum right by Count bits.
+// ===========================================================================
+int
+__ashrsi3 (
+  int  Datum,
+  int  Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (int)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+long
+__ashrdi3 (
+  long  Datum,
+  int   Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+long long
+__ashrti3 (
+  long long  Datum,
+  int        Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long long)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+// Return the quotient of the signed division of Dividend and Divisor
+// ===========================================================================
+int
+__divsi3 (
+  int  Dividend,
+  int  Divisor
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (int)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, NULL);
+}
+
+INT64
+__divdi3 (
+  INT64  Dividend,
+  INT64  Divisor
+  )
+{
+  INT64  Quotient;
+
+  Quotient = DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, NULL);
+  DEBUG ((DEBUG_INFO, "%a: %Ld / %Ld = %Ld\n", __func__, Dividend, Divisor, Quotient));
+
+  return Quotient;
+}
+
+long long
+__divti3 (
+  long long  Dividend,
+  long long  Divisor
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long long)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, NULL);
+}
+
+// Logically shift Datum right by Count bits
+// ===========================================================================
+int
+__lshrsi3 (
+  int  Datum,
+  int  Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (int)RShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+long
+__lshrdi3 (
+  int  Datum,
+  int  Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long)RShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+long long
+__lshrti3 (
+  int  Datum,
+  int  Count
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long long)RShiftU64 ((UINT64)Datum, (UINTN)Count);
+}
+
+// Return the remainder of the signed division of Dividend and Divisor
+// ===========================================================================
+int
+__modsi3 (
+  int  Dividend,
+  int  Divisor
+  )
+{
+  INT64  Remainder;
+
+  (void)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, &Remainder);
+  DEBUG ((DEBUG_INFO, "modsi3: %d %% %d = %d\n", Dividend, Divisor, (int)Remainder));
+
+  return (int)Remainder;
+}
+
+INT64
+__moddi3 (
+  INT64  Dividend,
+  INT64  Divisor
+  )
+{
+  INT64  Remainder;
+
+  (void)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, &Remainder);
+  DEBUG ((DEBUG_INFO, "moddi3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder));
+
+  return Remainder;
+}
+
+long long
+__modti3 (
+  long long  Dividend,
+  long long  Divisor
+  )
+{
+  INT64  Remainder;
+
+  (void)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, &Remainder);
+  DEBUG ((DEBUG_INFO, "modti3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder));
+
+  return (long long)Remainder;
+}
+
+// These functions return the product of the Multiplicand and Multiplier.
+// ===========================================================================
+long long
+__multi3 (
+  long long  Multiplicand,
+  long long  Multiplier
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long long)MultS64x64 ((INT64)Multiplicand, (INT64)Multiplier);
+}
+
+// Return the quotient of the unsigned division of a and b.
+// ===========================================================================
+unsigned int
+__udivsi3 (
+  unsigned int  Dividend,
+  unsigned int  Divisor
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (int)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, NULL);
+}
+
+unsigned long
+__udivdi3 (
+  unsigned long  Dividend,
+  unsigned long  Divisor
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, NULL);
+}
+
+unsigned long long
+__udivti3 (
+  unsigned long long  Dividend,
+  unsigned long long  Divisor
+  )
+{
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  return (long long)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, NULL);
+}
+
+// ===========================================================================
+unsigned int
+__umodsi3 (
+  unsigned int  Dividend,
+  unsigned int  Divisor
+  )
+{
+  UINT64  Remainder;
+
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  (void)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, &Remainder);
+
+  return (unsigned int)Remainder;
+}
+
+unsigned long
+__umoddi3 (
+  unsigned long  Dividend,
+  unsigned long  Divisor
+  )
+{
+  UINT64  Remainder;
+
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  (void)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, &Remainder);
+
+  return (unsigned long)Remainder;
+}
+
+unsigned long long
+__umodti3 (
+  unsigned long long  Dividend,
+  unsigned long long  Divisor
+  )
+{
+  UINT64  Remainder;
+
+  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
+  (void)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, &Remainder);
+
+  return (unsigned long long)Remainder;
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
new file mode 100644
index 000000000000..792974d7b119
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
@@ -0,0 +1,98 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/BaseLib.h>
+
+/*
+ * Divides a 64-bit signed value with a 64-bit signed value and returns
+ * a 64-bit signed result.
+ */
+__declspec(naked) void __cdecl
+_alldiv (
+  void
+  )
+{
+  //
+  // Wrapper Implementation over EDKII DivS64x64Remainder() routine
+  //    INT64
+  //    EFIAPI
+  //    DivS64x64Remainder (
+  //      IN      UINT64     Dividend,
+  //      IN      UINT64     Divisor,
+  //      OUT     UINT64     *Remainder  OPTIONAL
+  //      )
+  //
+  _asm {
+    ;Entry:
+    ;       Arguments are passed on the stack:
+    ;               1st pushed: divisor (QWORD)
+    ;               2nd pushed: dividend (QWORD)
+    ;
+    ;Exit:
+    ;       EDX:EAX contains the quotient (dividend/  divisor)
+    ;       NOTE: this routine removes the parameters from the stack.
+      ;
+    ; Original local stack when calling _alldiv
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Divisor  --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Dividend --|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+
+    ;
+    ; Set up the local stack for NULL Reminder pointer
+    ;
+    xor  eax, eax
+    push eax
+
+    ;
+    ; Set up the local stack for Divisor parameter
+    ;
+    mov  eax, [esp + 20]
+    push eax
+    mov  eax, [esp + 20]
+    push eax
+
+    ;
+    ; Set up the local stack for Dividend parameter
+    ;
+    mov  eax, [esp + 20]
+    push eax
+    mov  eax, [esp + 20]
+    push eax
+
+    ;
+    ; Call native DivS64x64Remainder of BaseLib
+    ;
+    call DivS64x64Remainder
+
+    ;
+    ; Adjust stack
+    ;
+    add  esp, 20
+
+    ret  16
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
new file mode 100644
index 000000000000..a1f87f6af5c3
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
@@ -0,0 +1,102 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/BaseLib.h>
+
+/*
+ * Divides a 64-bit signed value by another 64-bit signed value and returns
+ * the 64-bit signed result and the 64-bit signed remainder.
+ */
+__declspec(naked) void __cdecl
+_alldvrm (
+  void
+  )
+{
+  //
+  // Wrapper Implementation over EDKII DivS64x64Remainder() routine
+  //    INT64
+  //    EFIAPI
+  //    DivS64x64Remainder (
+  //      IN      INT64     Dividend,
+  //      IN      INT64     Divisor,
+  //      OUT     INT64     *Remainder
+  //      )
+  //
+  _asm {
+    ; Original local stack when calling _alldvrm
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Divisor  --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Dividend --|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+    ;
+    ; On Exit:
+    ;       EDX:EAX contains the quotient (dividend/  divisor)
+    ;       EBX:ECX contains the remainder (divided %  divisor)
+    ;       NOTE: this routine removes the parameters from the stack.
+      ;
+
+    ;
+    ; Set up the local stack for Reminder pointer
+    ;
+    sub  esp, 8
+    push esp
+
+    ;
+    ; Set up the local stack for Divisor parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Set up the local stack for Dividend parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Call native DivS64x64Remainder of BaseLib
+    ;
+    call DivS64x64Remainder
+
+    ;
+    ; EDX:EAX contains the quotient (dividend/  divisor)
+    ; Put the Remainder in EBX:ECX
+    ;
+    mov  ecx, [esp + 20]
+    mov  ebx, [esp + 24]
+
+    ;
+    ; Adjust stack
+    ;
+    add  esp, 28
+
+    ret  16
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
new file mode 100644
index 000000000000..61a5c416b912
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
@@ -0,0 +1,82 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/BaseLib.h>
+
+/*
+ * Multiplies a 64-bit signed or unsigned value by a 64-bit signed or unsigned value
+ * and returns a 64-bit result.
+ */
+__declspec(naked) void __cdecl
+_allmul (
+  void
+  )
+{
+  //
+  // Wrapper Implementation over EDKII MultS64x64() routine
+  //    INT64
+  //    EFIAPI
+  //    MultS64x64 (
+  //      IN      INT64      Multiplicand,
+  //      IN      INT64      Multiplier
+  //      )
+  //
+  _asm {
+    ; Original local stack when calling _allmul
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--Multiplier --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--Multiplicand-|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+
+    ;
+    ; Set up the local stack for Multiplicand parameter
+    ;
+    mov  eax, [esp + 16]
+    push eax
+    mov  eax, [esp + 16]
+    push eax
+
+    ;
+    ; Set up the local stack for Multiplier parameter
+    ;
+    mov  eax, [esp + 16]
+    push eax
+    mov  eax, [esp + 16]
+    push eax
+
+    ;
+    ; Call native MulS64x64 of BaseLib
+    ;
+    call MultS64x64
+
+    ;
+    ; Adjust stack
+    ;
+    add  esp, 16
+
+    ret  16
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
new file mode 100644
index 000000000000..f415fe82dd59
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
@@ -0,0 +1,95 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/BaseLib.h>
+
+/*
+ * Divides a 64-bit signed value by another 64-bit signed value and returns
+ * the 64-bit signed remainder.
+ */
+__declspec(naked) void __cdecl
+_allrem (
+  void
+  )
+{
+  //
+  // Wrapper Implementation over EDKII DivS64x64Remainder() routine
+  //    UINT64
+  //    EFIAPI
+  //    DivS64x64Remainder (
+  //      IN      UINT64     Dividend,
+  //      IN      UINT64     Divisor,
+  //      OUT     UINT64     *Remainder
+  //      )
+  //
+  _asm {
+    ; Original local stack when calling _allrem
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Divisor  --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Dividend --|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+
+    ;
+    ; Set up the local stack for Reminder pointer
+    ;
+    sub  esp, 8
+    push esp
+
+    ;
+    ; Set up the local stack for Divisor parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Set up the local stack for Dividend parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Call native DivS64x64Remainder of BaseLib
+    ;
+    call DivS64x64Remainder
+
+    ;
+    ; Put the Reminder in EDX:EAX as return value
+    ;
+    mov  eax, [esp + 20]
+    mov  edx, [esp + 24]
+
+    ;
+    ; Adjust stack
+    ;
+    add  esp, 28
+
+    ret  16
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c
new file mode 100644
index 000000000000..f2121a713bd7
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c
@@ -0,0 +1,57 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+/*
+ * Shifts a 64-bit signed value left by a particular number of bits.
+ */
+__declspec(naked) void __cdecl
+_allshl (
+  void
+  )
+{
+  _asm {
+    ;
+    ; Handle shifting of 64 or more bits (return 0)
+    ;
+
+    cmp     cl, 64
+    jae     short ReturnZero
+
+    ;
+    ; Handle shifting of between 0 and 31 bits
+    ;
+    cmp     cl, 32
+    jae     short More32
+    shld    edx, eax, cl
+    shl     eax, cl
+    ret
+
+    ;
+    ; Handle shifting of between 32 and 63 bits
+    ;
+More32:
+    mov     edx, eax
+    xor     eax, eax
+    and     cl, 31
+    shl     edx, cl
+    ret
+
+ReturnZero:
+    xor     eax,eax
+    xor     edx,edx
+    ret
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
new file mode 100644
index 000000000000..ba60aaafada5
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
@@ -0,0 +1,61 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+/*
+ * Shifts a 64-bit signed value right by a particular number of bits.
+ */
+__declspec(naked) void __cdecl
+_allshr (
+  void
+  )
+{
+  _asm {
+    ;
+    ; Handle shifts of 64 bits or more (if shifting 64 bits or more, the result
+      ; depends only on the high order bit of edx).
+      ;
+
+    cmp     cl,64
+    jae     short SIGNRETURN
+
+    ;
+    ; Handle shifts of between 0 and 31 bits
+    ;
+    cmp     cl, 32
+    jae     short MORE32
+    shrd    eax,edx,cl
+    sar     edx,cl
+    ret
+
+    ;
+    ; Handle shifts of between 32 and 63 bits
+    ;
+MORE32:
+    mov     eax,edx
+    sar     edx,31
+    and     cl,31
+    sar     eax,cl
+    ret
+
+    ;
+    ; Return double precision 0 or -1, depending on the sign of edx
+    ;
+SIGNRETURN:
+    sar     edx,31
+    mov     eax,edx
+    ret
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
new file mode 100644
index 000000000000..287af8562839
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
@@ -0,0 +1,89 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/BaseLib.h>
+
+/*
+ * Divides a 64-bit unsigned value with a 64-bit unsigned value and returns
+ * a 64-bit unsigned result.
+ */
+__declspec(naked) void __cdecl
+_aulldiv (
+  void
+  )
+{
+  //
+  // Wrapper Implementation over EDKII DivU64x64Reminder() routine
+  //    UINT64
+  //    EFIAPI
+  //    DivU64x64Remainder (
+  //      IN      UINT64     Dividend,
+  //      IN      UINT64     Divisor,
+  //      OUT     UINT64     *Remainder  OPTIONAL
+  //      )
+  //
+  _asm {
+    ; Original local stack when calling _aulldiv
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Divisor  --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Dividend --|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+
+    ;
+    ; Set up the local stack for NULL Reminder pointer
+    ;
+    xor  eax, eax
+    push eax
+
+    ;
+    ; Set up the local stack for Divisor parameter
+    ;
+    mov  eax, [esp + 20]
+    push eax
+    mov  eax, [esp + 20]
+    push eax
+
+    ;
+    ; Set up the local stack for Dividend parameter
+    ;
+    mov  eax, [esp + 20]
+    push eax
+    mov  eax, [esp + 20]
+    push eax
+
+    ;
+    ; Call native DivU64x64Remainder of BaseLib
+    ;
+    call DivU64x64Remainder
+
+    ;
+    ; Adjust stack
+    ;
+    add  esp, 20
+
+    ret  16
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
new file mode 100644
index 000000000000..378cdec115e5
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
@@ -0,0 +1,102 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/BaseLib.h>
+
+/*
+ * Divides a 64-bit signed value by another 64-bit signed value and returns
+ * the 64-bit signed result and the 64-bit signed remainder.
+ */
+__declspec(naked) void __cdecl
+_aulldvrm (
+  void
+  )
+{
+  //
+  // Wrapper Implementation over EDKII DivU64x64Remainder() routine
+  //    UINT64
+  //    EFIAPI
+  //    DivU64x64Remainder (
+  //      IN      UINT64     Dividend,
+  //      IN      UINT64     Divisor,
+  //      OUT     UINT64     *Remainder
+  //      )
+  //
+  _asm {
+    ; Original local stack when calling _aulldvrm
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Divisor  --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Dividend --|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+    ;
+    ; On Exit:
+    ;       EDX:EAX contains the quotient (dividend/  divisor)
+    ;       EBX:ECX contains the remainder (divided %  divisor)
+    ;       NOTE: this routine removes the parameters from the stack.
+      ;
+
+    ;
+    ; Set up the local stack for Remainder pointer
+    ;
+    sub  esp, 8
+    push esp
+
+    ;
+    ; Set up the local stack for Divisor parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Set up the local stack for Dividend parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Call native DivU64x64Remainder of BaseLib
+    ;
+    call DivU64x64Remainder
+
+    ;
+    ; EDX:EAX contains the quotient (dividend/  divisor)
+    ; Put the Remainder in EBX:ECX
+    ;
+    mov  ecx, [esp + 20]
+    mov  ebx, [esp + 24]
+
+    ;
+    ; Adjust stack
+    ;
+    add  esp, 28
+
+    ret  16
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
new file mode 100644
index 000000000000..49d0064b0f03
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
@@ -0,0 +1,95 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/BaseLib.h>
+
+/*
+ * Divides a 64-bit unsigned value by another 64-bit unsigned value and returns
+ * the 64-bit unsigned remainder.
+ */
+__declspec(naked) void __cdecl
+_aullrem (
+  void
+  )
+{
+  //
+  // Wrapper Implementation over EDKII DivU64x64Remainder() routine
+  //    UINT64
+  //    EFIAPI
+  //    DivU64x64Remainder (
+  //      IN      UINT64     Dividend,
+  //      IN      UINT64     Divisor,
+  //      OUT     UINT64     *Remainder  OPTIONAL
+  //      )
+  //
+  _asm {
+    ; Original local stack when calling _aullrem
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Divisor  --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Dividend --|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+
+    ;
+    ; Set up the local stack for Reminder pointer
+    ;
+    sub  esp, 8
+    push esp
+
+    ;
+    ; Set up the local stack for Divisor parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Set up the local stack for Dividend parameter
+    ;
+    mov  eax, [esp + 28]
+    push eax
+    mov  eax, [esp + 28]
+    push eax
+
+    ;
+    ; Call native DivU64x64Remainder of BaseLib
+    ;
+    call DivU64x64Remainder
+
+    ;
+    ; Put the Reminder in EDX:EAX as return value
+    ;
+    mov  eax, [esp + 20]
+    mov  edx, [esp + 24]
+
+    ;
+    ; Adjust stack
+    ;
+    add  esp, 28
+
+    ret  16
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c
new file mode 100644
index 000000000000..3c21b45941a1
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c
@@ -0,0 +1,60 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+/*
+ * Shifts a 64-bit unsigned value right by a certain number of bits.
+ */
+__declspec(naked) void __cdecl
+_aullshr (
+  void
+  )
+{
+  _asm {
+    ;
+    ; Checking: Only handle 64bit shifting or more
+    ;
+    cmp     cl, 64
+    jae     _Exit
+
+    ;
+    ; Handle shifting between 0 and 31 bits
+    ;
+    cmp     cl, 32
+    jae     More32
+    shrd    eax, edx, cl
+    shr     edx, cl
+    ret
+
+    ;
+    ; Handle shifting of 32-63 bits
+    ;
+More32:
+    mov     eax, edx
+    xor     edx, edx
+    and     cl, 31
+    shr     eax, cl
+    ret
+
+    ;
+    ; Invalid number (less  then 32bits), return 0
+    ;
+
+_Exit:
+    xor     eax, eax
+    xor     edx, edx
+    ret
+  }
+}
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
new file mode 100644
index 000000000000..1c629dc23bf5
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
@@ -0,0 +1,66 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   MathRShiftU64.S
+#
+# Abstract:
+#
+#   64-bit Math Worker Function.
+#   Shifts a 64-bit unsigned value right by a certain number of bits.
+#
+#------------------------------------------------------------------------------
+
+
+    .686:
+    .code:
+
+ASM_GLOBAL ASM_PFX(__ashrdi3)
+
+#------------------------------------------------------------------------------
+#
+# void __cdecl __ashrdi3 (void)
+#
+#------------------------------------------------------------------------------
+ASM_PFX(__ashrdi3):
+    #
+    # Checking: Only handle 64bit shifting or more
+    #
+    cmpb    $64, %cl
+    jae     _Exit
+
+    #
+    # Handle shifting between 0 and 31 bits
+    #
+    cmpb    $32, %cl
+    jae     More32
+    shrd    %cl, %edx, %eax
+    shr     %cl, %edx
+    ret
+
+    #
+    # Handle shifting of 32-63 bits
+    #
+More32:
+    movl    %edx, %eax
+    xor     %edx, %edx
+    and     $32, %cl
+    shr     %cl, %eax
+    ret
+
+    #
+    # Invalid number (less then 32bits), return 0
+    #
+_Exit:
+    xor     %eax, %eax
+    xor     %edx, %edx
+    ret
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
new file mode 100644
index 000000000000..333fdfbb9f58
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
@@ -0,0 +1,77 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   MathMultS64x64.S
+#
+# Abstract:
+#
+#   64-bit Math Worker Function.
+#   Multiplies a 64-bit signed or unsigned value by a 64-bit signed or unsigned value
+#   and returns a 64-bit result
+#
+#------------------------------------------------------------------------------
+
+    .686:
+    .code:
+
+ASM_GLOBAL ASM_PFX(_mulll), ASM_PFX(MultS64x64)
+
+#------------------------------------------------------------------------------
+#
+# void __cdecl __mulll (void)
+#
+#------------------------------------------------------------------------------
+ASM_PFX(__mulll):
+    # Original local stack when calling __mulll
+    #               -----------------
+    #               |               |
+    #               |---------------|
+    #               |               |
+    #               |--Multiplier --|
+    #               |               |
+    #               |---------------|
+    #               |               |
+    #               |--Multiplicand-|
+    #               |               |
+    #               |---------------|
+    #               |  ReturnAddr** |
+    #       ESP---->|---------------|
+    #
+
+    #
+    # Set up the local stack for Multiplicand parameter
+    #
+    movl    16(%esp), %eax
+    push    %eax
+    movl    16(%esp), %eax
+    push    %eax
+
+    #
+    # Set up the local stack for Multiplier parameter
+    #
+    movl    16(%esp), %eax
+    push    %eax
+    movl    16(%esp), %eax
+    push    %eax
+
+    #
+    # Call native MulS64x64 of BaseLib
+    #
+    jmp     ASM_PFX(MultS64x64)
+
+    #
+    # Adjust stack
+    #
+    add     $16, %esp
+
+    ret     $16
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
new file mode 100644
index 000000000000..b2a03d98337e
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
@@ -0,0 +1,62 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   MathLShiftS64.S
+#
+# Abstract:
+#
+#   64-bit Math Worker Function.
+#   Shifts a 64-bit signed value left by a certain number of bits.
+#
+#------------------------------------------------------------------------------
+
+    .686:
+    .code:
+
+ASM_GLOBAL ASM_PFX(__ashldi3)
+
+#------------------------------------------------------------------------------
+#
+# void __cdecl __ashldi3 (void)
+#
+#------------------------------------------------------------------------------
+ASM_PFX(__ashldi3):
+    #
+    # Handle shifting of 64 or more bits (return 0)
+    #
+    cmpb    $64, %cl
+    jae     ReturnZero
+
+    #
+    # Handle shifting of between 0 and 31 bits
+    #
+    cmpb    $32, %cl
+    jae     More32
+    shld    %cl, %eax, %edx
+    shl     %cl, %eax
+    ret
+
+    #
+    # Handle shifting of between 32 and 63 bits
+    #
+More32:
+    movl    %eax, %edx
+    xor     %eax, %eax
+    and     $31, %cl
+    shl     %cl, %edx
+    ret
+
+ReturnZero:
+    xor     %eax, %eax
+    xor     %edx, %edx
+    ret
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
new file mode 100644
index 000000000000..336d75ee7c30
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
@@ -0,0 +1,83 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   MathDivU64x64.S
+#
+# Abstract:
+#
+#   64-bit Math Worker Function.
+#   Divides a 64-bit unsigned value with a 64-bit unsigned value and returns
+#   a 64-bit unsigned result.
+#
+#------------------------------------------------------------------------------
+
+    .686:
+    .code:
+
+ASM_GLOBAL ASM_PFX(__udivdi3), ASM_PFX(DivU64x64Remainder)
+
+#------------------------------------------------------------------------------
+#
+# void __cdecl __udivdi3 (void)
+#
+#------------------------------------------------------------------------------
+ASM_PFX(__udivdi3):
+    # Original local stack when calling __udivdi3
+    #               -----------------
+    #               |               |
+    #               |---------------|
+    #               |               |
+    #               |--  Divisor  --|
+    #               |               |
+    #               |---------------|
+    #               |               |
+    #               |--  Dividend --|
+    #               |               |
+    #               |---------------|
+    #               |  ReturnAddr** |
+    #       ESP---->|---------------|
+    #
+
+    #
+    # Set up the local stack for NULL Reminder pointer
+    #
+    xorl    %eax, %eax
+    push    %eax
+
+    #
+    # Set up the local stack for Divisor parameter
+    #
+    movl    20(%esp), %eax
+    push    %eax
+    movl    20(%esp), %eax
+    push    %eax
+
+    #
+    # Set up the local stack for Dividend parameter
+    #
+    movl    20(%esp), %eax
+    push    %eax
+    movl    20(%esp), %eax
+    push    %eax
+
+    #
+    # Call native DivU64x64Remainder of BaseLib
+    #
+    jmp     ASM_PFX(DivU64x64Remainder)
+
+    #
+    # Adjust stack
+    #
+    addl    $20, %esp
+
+    ret     $16
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S
new file mode 100644
index 000000000000..9b72e918a4ba
--- /dev/null
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S
@@ -0,0 +1,89 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   MathReminderU64x64.S
+#
+# Abstract:
+#
+#   64-bit Math Worker Function.
+#   Divides a 64-bit unsigned value by another 64-bit unsigned value and returns
+#   the 64-bit unsigned remainder
+#
+#------------------------------------------------------------------------------
+
+    .686:
+    .code:
+
+ASM_GLOBAL ASM_PFX(__umoddi3), ASM_PFX(DivU64x64Remainder)
+
+#------------------------------------------------------------------------------
+#
+# void __cdecl __umoddi3 (void)
+#
+#------------------------------------------------------------------------------
+ASM_PFX(__umoddi3):
+    # Original local stack when calling __umoddi3
+    #               -----------------
+    #               |               |
+    #               |---------------|
+    #               |               |
+    #               |--  Divisor  --|
+    #               |               |
+    #               |---------------|
+    #               |               |
+    #               |--  Dividend --|
+    #               |               |
+    #               |---------------|
+    #               |  ReturnAddr** |
+    #       ESP---->|---------------|
+    #
+
+    #
+    # Set up the local stack for Reminder pointer
+    #
+    sub     $8, %esp
+    push    %esp
+
+    #
+    # Set up the local stack for Divisor parameter
+    #
+    movl    28(%esp), %eax
+    push    %eax
+    movl    28(%esp), %eax
+    push    %eax
+
+    #
+    # Set up the local stack for Dividend parameter
+    #
+    movl    28(%esp), %eax
+    push    %eax
+    movl    28(%esp), %eax
+    push    %eax
+
+    #
+    # Call native DivU64x64Remainder of BaseLib
+    #
+    jmp     ASM_PFX(DivU64x64Remainder)
+
+    #
+    # Put the Reminder in EDX:EAX as return value
+    #
+    movl    20(%esp), %eax
+    movl    24(%esp), %edx
+
+    #
+    # Adjust stack
+    #
+    add     $28, %esp
+
+    ret     $16
-- 
2.35.1


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

* [PATCH v2 06/10] MdePkg/CompilerIntrinsicsLib: add SPDX License tags
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 05/10] MdePkg/CompilerIntrinsicsLib: copy over intrinsics from edk2-libc repo Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 07/10] MdePkg/CompilerIntrinsicsLib: drop include from Gcc.c Gerd Hoffmann
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

It's not an exact match, edk2 expects "BSD-2-Clause-Patent" but
http://opensource.org/licenses/bsd-license.php references in comments
is "BSD-2-Clause".

Guess I need an explicit Intel explicitly agreeing to this even though
that is a rather minor change ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c     | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c   | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c  | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c   | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c   | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c   | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c   | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c  | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c  | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c  | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S   | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S  | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S | 2 ++
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S | 2 ++
 16 files changed, 32 insertions(+)

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
index 430139fc5ee0..bb211022c0e4 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
index 792974d7b119..cf2eec2a70b4 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
index a1f87f6af5c3..1fbe11bea751 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
index 61a5c416b912..3f9c54454128 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
index f415fe82dd59..5a73d539a650 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c
index f2121a713bd7..665b628b4014 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
index ba60aaafada5..94b91d4ea3c7 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
index 287af8562839..064e0e109b1d 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
index 378cdec115e5..37946b4edc94 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
index 49d0064b0f03..a5b65e600415 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c
index 3c21b45941a1..1cfe781720ac 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c
@@ -9,6 +9,8 @@
   distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
 
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
index 1c629dc23bf5..f671d419e1f9 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
@@ -6,6 +6,8 @@
 # distribution.  The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php.
 #
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
index 333fdfbb9f58..c46d4ab82311 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
@@ -6,6 +6,8 @@
 # distribution.  The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php.
 #
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
index b2a03d98337e..4e5ce03c40e6 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
@@ -6,6 +6,8 @@
 # distribution.  The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php.
 #
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
index 336d75ee7c30..7dbae9c438a4 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
@@ -6,6 +6,8 @@
 # distribution.  The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php.
 #
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S
index 9b72e918a4ba..6907eaabccc7 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S
@@ -6,6 +6,8 @@
 # distribution.  The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php.
 #
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
-- 
2.35.1


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

* [PATCH v2 07/10] MdePkg/CompilerIntrinsicsLib: drop include from Gcc.c
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 06/10] MdePkg/CompilerIntrinsicsLib: add SPDX License tags Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 08/10] MdePkg/CompilerIntrinsicsLib: drop debug logging " Gerd Hoffmann
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

Does not exist and is not needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
index bb211022c0e4..d0996d6276bc 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
@@ -17,7 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 #include <Uefi.h>
 #include <Library/DebugLib.h>
-#include <sys/EfiCdefs.h>
 
 #include <Library/BaseLib.h>
 
-- 
2.35.1


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

* [PATCH v2 08/10] MdePkg/CompilerIntrinsicsLib: drop debug logging from Gcc.c
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 07/10] MdePkg/CompilerIntrinsicsLib: drop include from Gcc.c Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 09/10] MdePkg/CompilerIntrinsicsLib: remove duplicate functions " Gerd Hoffmann
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../Library/CompilerIntrinsicsLib/Ia32/Gcc.c  | 22 -------------------
 1 file changed, 22 deletions(-)

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
index d0996d6276bc..3c47bef63c4d 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
@@ -28,7 +28,6 @@ __ashlsi3 (
   int  Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (int)LShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -38,7 +37,6 @@ __ashldi3 (
   int   Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long)LShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -48,7 +46,6 @@ __ashlti3 (
   int        Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long long)LShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -60,7 +57,6 @@ __ashrsi3 (
   int  Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (int)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -70,7 +66,6 @@ __ashrdi3 (
   int   Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -80,7 +75,6 @@ __ashrti3 (
   int        Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long long)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -92,7 +86,6 @@ __divsi3 (
   int  Divisor
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (int)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, NULL);
 }
 
@@ -105,7 +98,6 @@ __divdi3 (
   INT64  Quotient;
 
   Quotient = DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, NULL);
-  DEBUG ((DEBUG_INFO, "%a: %Ld / %Ld = %Ld\n", __func__, Dividend, Divisor, Quotient));
 
   return Quotient;
 }
@@ -116,7 +108,6 @@ __divti3 (
   long long  Divisor
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long long)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, NULL);
 }
 
@@ -128,7 +119,6 @@ __lshrsi3 (
   int  Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (int)RShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -138,7 +128,6 @@ __lshrdi3 (
   int  Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long)RShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -148,7 +137,6 @@ __lshrti3 (
   int  Count
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long long)RShiftU64 ((UINT64)Datum, (UINTN)Count);
 }
 
@@ -163,7 +151,6 @@ __modsi3 (
   INT64  Remainder;
 
   (void)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, &Remainder);
-  DEBUG ((DEBUG_INFO, "modsi3: %d %% %d = %d\n", Dividend, Divisor, (int)Remainder));
 
   return (int)Remainder;
 }
@@ -177,7 +164,6 @@ __moddi3 (
   INT64  Remainder;
 
   (void)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, &Remainder);
-  DEBUG ((DEBUG_INFO, "moddi3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder));
 
   return Remainder;
 }
@@ -191,7 +177,6 @@ __modti3 (
   INT64  Remainder;
 
   (void)DivS64x64Remainder ((INT64)Dividend, (INT64)Divisor, &Remainder);
-  DEBUG ((DEBUG_INFO, "modti3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder));
 
   return (long long)Remainder;
 }
@@ -204,7 +189,6 @@ __multi3 (
   long long  Multiplier
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long long)MultS64x64 ((INT64)Multiplicand, (INT64)Multiplier);
 }
 
@@ -216,7 +200,6 @@ __udivsi3 (
   unsigned int  Divisor
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (int)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, NULL);
 }
 
@@ -226,7 +209,6 @@ __udivdi3 (
   unsigned long  Divisor
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, NULL);
 }
 
@@ -236,7 +218,6 @@ __udivti3 (
   unsigned long long  Divisor
   )
 {
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   return (long long)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, NULL);
 }
 
@@ -249,7 +230,6 @@ __umodsi3 (
 {
   UINT64  Remainder;
 
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   (void)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, &Remainder);
 
   return (unsigned int)Remainder;
@@ -263,7 +243,6 @@ __umoddi3 (
 {
   UINT64  Remainder;
 
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   (void)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, &Remainder);
 
   return (unsigned long)Remainder;
@@ -277,7 +256,6 @@ __umodti3 (
 {
   UINT64  Remainder;
 
-  DEBUG ((DEBUG_INFO, "%a:\n", __func__));
   (void)DivU64x64Remainder ((UINT64)Dividend, (UINT64)Divisor, &Remainder);
 
   return (unsigned long long)Remainder;
-- 
2.35.1


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

* [PATCH v2 09/10] MdePkg/CompilerIntrinsicsLib: remove duplicate functions from Gcc.c
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (7 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 08/10] MdePkg/CompilerIntrinsicsLib: drop debug logging " Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-12 14:07 ` [PATCH v2 10/10] MdePkg/CompilerIntrinsicsLib: add new sources to CompilerIntrinsicsLib.inf Gerd Hoffmann
  2022-04-29  6:41 ` 回复: [PATCH v2 00/10] consolidate compiler intrinsics gaoliming
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

Implementations for those functions already exist,
so remove them to avoid duplicate symbols.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../Library/CompilerIntrinsicsLib/Ia32/Gcc.c  | 47 -------------------
 1 file changed, 47 deletions(-)

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
index 3c47bef63c4d..7502d5afe65a 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
+++ b/MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
@@ -20,55 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include <Library/BaseLib.h>
 
-// Shift Datum left by Count bits.
-// ===========================================================================
-int
-__ashlsi3 (
-  int  Datum,
-  int  Count
-  )
-{
-  return (int)LShiftU64 ((UINT64)Datum, (UINTN)Count);
-}
-
-long
-__ashldi3 (
-  long  Datum,
-  int   Count
-  )
-{
-  return (long)LShiftU64 ((UINT64)Datum, (UINTN)Count);
-}
-
-long long
-__ashlti3 (
-  long long  Datum,
-  int        Count
-  )
-{
-  return (long long)LShiftU64 ((UINT64)Datum, (UINTN)Count);
-}
-
 // Arithmetically shift Datum right by Count bits.
 // ===========================================================================
-int
-__ashrsi3 (
-  int  Datum,
-  int  Count
-  )
-{
-  return (int)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
-}
-
-long
-__ashrdi3 (
-  long  Datum,
-  int   Count
-  )
-{
-  return (long)ARShiftU64 ((UINT64)Datum, (UINTN)Count);
-}
-
 long long
 __ashrti3 (
   long long  Datum,
-- 
2.35.1


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

* [PATCH v2 10/10] MdePkg/CompilerIntrinsicsLib: add new sources to CompilerIntrinsicsLib.inf
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (8 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 09/10] MdePkg/CompilerIntrinsicsLib: remove duplicate functions " Gerd Hoffmann
@ 2022-04-12 14:07 ` Gerd Hoffmann
  2022-04-29  6:41 ` 回复: [PATCH v2 00/10] consolidate compiler intrinsics gaoliming
  10 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-12 14:07 UTC (permalink / raw)
  To: devel
  Cc: Maurice Ma, Andrew Fish, Pawel Polawski, Benjamin You, Yuwei Chen,
	Zhiguang Liu, Rebecca Cran, Xiaoyu Lu, Supreeth Venkatesh,
	Zhichao Gao, Brijesh Singh, Julien Grall, Erdem Aktas,
	Maciej Rabeda, Liming Gao, Michael D Kinney, kilian_kegel,
	Siyuan Fu, Oliver Steffen, Ray Ni, Abner Chang, James Bottomley,
	Sean Brogan, Alexei Fedorov, Tom Lendacky, Guo Dong, Jiewen Yao,
	Sami Mujawar, Sebastien Boeuf, Peter Grehan, Min Xu,
	Anthony Perard, Jordan Justen, Jian J Wang, Gerd Hoffmann,
	Bob Feng, Bret Barkelew, Nickle Wang, Wei6 Xu, Daniel Schaefer,
	Jiaxin Wu, Leif Lindholm, Guomin Jiang, Sami Mujawar,
	Ard Biesheuvel

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../CompilerIntrinsicsLib.inf                 | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
index 1604f1ee802f..448ec56b94e1 100644
--- a/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+++ b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@@ -96,6 +96,26 @@ [Sources.IA32]
   Ia32/MathLShiftS64.nasm   | GCC
   Ia32/MathRShiftU64.nasm   | GCC
 
+  Ia32/llmul.c              | MSFT    # __allmul
+  Ia32/llshr.c              | MSFT    # __allshr
+  Ia32/ulldiv.c             | MSFT    # __aulldiv
+  Ia32/ullrem.c             | MSFT    # __aullrem
+  Ia32/lldiv.c              | MSFT    # __alldiv
+  Ia32/llrem.c              | MSFT    # __allrem
+  Ia32/lldvrm.c             | MSFT    # __alldvrm
+  Ia32/ulldvrm.c            | MSFT    # __aulldvrm
+
+  Ia32/llmul.c              | INTEL
+  Ia32/llshr.c              | INTEL
+  Ia32/ulldiv.c             | INTEL
+  Ia32/ullrem.c             | INTEL
+  Ia32/lldiv.c              | INTEL
+  Ia32/llrem.c              | INTEL
+  Ia32/lldvrm.c             | INTEL
+  Ia32/ulldvrm.c            | INTEL
+
+  Ia32/Gcc.c                | GCC
+
 [Packages]
   MdePkg/MdePkg.dec
 
-- 
2.35.1


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

* 回复: [PATCH v2 00/10] consolidate compiler intrinsics
  2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
                   ` (9 preceding siblings ...)
  2022-04-12 14:07 ` [PATCH v2 10/10] MdePkg/CompilerIntrinsicsLib: add new sources to CompilerIntrinsicsLib.inf Gerd Hoffmann
@ 2022-04-29  6:41 ` gaoliming
  2022-04-29  8:50   ` [edk2-devel] " Gerd Hoffmann
  10 siblings, 1 reply; 13+ messages in thread
From: gaoliming @ 2022-04-29  6:41 UTC (permalink / raw)
  To: 'Gerd Hoffmann', devel
  Cc: 'Maurice Ma', 'Andrew Fish',
	'Pawel Polawski', 'Benjamin You',
	'Yuwei Chen', 'Zhiguang Liu',
	'Rebecca Cran', 'Xiaoyu Lu',
	'Supreeth Venkatesh', 'Zhichao Gao',
	'Brijesh Singh', 'Julien Grall',
	'Erdem Aktas', 'Maciej Rabeda',
	'Michael D Kinney', kilian_kegel, 'Siyuan Fu',
	'Oliver Steffen', 'Ray Ni', 'Abner Chang',
	'James Bottomley', 'Sean Brogan',
	'Alexei Fedorov', 'Tom Lendacky',
	'Guo Dong', 'Jiewen Yao', 'Sami Mujawar',
	'Sebastien Boeuf', 'Peter Grehan',
	'Min Xu', 'Anthony Perard',
	'Jordan Justen', 'Jian J Wang',
	'Bob Feng', 'Bret Barkelew',
	'Nickle Wang', 'Wei6 Xu',
	'Daniel Schaefer', 'Jiaxin Wu',
	'Leif Lindholm', 'Guomin Jiang',
	'Sami Mujawar', 'Ard Biesheuvel'

Gerd:
  Do you plan to catch this change into edk2 202205 stable tag? 

  For this patch set,  Acked-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: Gerd Hoffmann <kraxel@redhat.com>
> 发送时间: 2022年4月12日 22:07
> 收件人: devel@edk2.groups.io
> 抄送: Maurice Ma <maurice.ma@intel.com>; Andrew Fish
> <afish@apple.com>; Pawel Polawski <ppolawsk@redhat.com>; Benjamin You
> <benjamin.you@intel.com>; Yuwei Chen <yuwei.chen@intel.com>; Zhiguang
> Liu <zhiguang.liu@intel.com>; Rebecca Cran <rebecca@bsdio.com>; Xiaoyu
> Lu <xiaoyu1.lu@intel.com>; Supreeth Venkatesh
> <supreeth.venkatesh@arm.com>; Zhichao Gao <zhichao.gao@intel.com>;
> Brijesh Singh <brijesh.singh@amd.com>; Julien Grall <julien@xen.org>; Erdem
> Aktas <erdemaktas@google.com>; Maciej Rabeda
> <maciej.rabeda@linux.intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Michael D Kinney <michael.d.kinney@intel.com>; kilian_kegel@hotmail.com;
> Siyuan Fu <siyuan.fu@intel.com>; Oliver Steffen <osteffen@redhat.com>; Ray
> Ni <ray.ni@intel.com>; Abner Chang <abner.chang@hpe.com>; James
> Bottomley <jejb@linux.ibm.com>; Sean Brogan
> <sean.brogan@microsoft.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>;
> Tom Lendacky <thomas.lendacky@amd.com>; Guo Dong
> <guo.dong@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Sami Mujawar
> <Sami.Mujawar@arm.com>; Sebastien Boeuf <sebastien.boeuf@intel.com>;
> Peter Grehan <grehan@freebsd.org>; Min Xu <min.m.xu@intel.com>;
> Anthony Perard <anthony.perard@citrix.com>; Jordan Justen
> <jordan.l.justen@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Gerd
> Hoffmann <kraxel@redhat.com>; Bob Feng <bob.c.feng@intel.com>; Bret
> Barkelew <Bret.Barkelew@microsoft.com>; Nickle Wang
> <nickle.wang@hpe.com>; Wei6 Xu <wei6.xu@intel.com>; Daniel Schaefer
> <daniel.schaefer@hpe.com>; Jiaxin Wu <jiaxin.wu@intel.com>; Leif Lindholm
> <quic_llindhol@quicinc.com>; Guomin Jiang <guomin.jiang@intel.com>; Sami
> Mujawar <sami.mujawar@arm.com>; Ard Biesheuvel
> <ardb+tianocore@kernel.org>
> 主题: [PATCH v2 00/10] consolidate compiler intrinsics
> 
> This is an attept to start cleaning up the messy compiler intrinsics
> situation.  Today we don't have a core intrinsics library, resulting
> in everybody creating their own.  ArmPkg has one, CryptoPkg has one.
> I'm sure there are many more.
> 
> This doesn't make sense.  Given we can't avoid compiler intrinsics (as
> proven by the existence of those libraries) we should better have them
> as core library so we have to maintain a single version only.
> 
> Given we already have BaseIoLibIntrinsic in MdePkg we can place the
> compiler intrinsics there too.  This little patch series does just that:
> It moves over the existing ArmPkg intrinsics, fixes them to build on
> non-arm too, and adds additional bits from the CryptoPkg intrinsics.
> 
> v2 changes:
>  - rebase to latest master.
>  - add review tags
>  - add patch moving size_t to header file (patch #3).
>  - add patches copying over more intrinsics from
>    edk2-libc repo (patches #5 -> #10).
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3649
> 
> take care,
>   Gerd
> 
> Gerd Hoffmann (10):
>   MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
>   MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
>   MdePkg/CompilerIntrinsicsLib: move size_t typedef to header file
>   MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp
>   MdePkg/CompilerIntrinsicsLib: copy over intrinsics from edk2-libc repo
>   MdePkg/CompilerIntrinsicsLib: add SPDX License tags
>   MdePkg/CompilerIntrinsicsLib: drop include from Gcc.c
>   MdePkg/CompilerIntrinsicsLib: drop debug logging from Gcc.c
>   MdePkg/CompilerIntrinsicsLib: remove duplicate functions from Gcc.c
>   MdePkg/CompilerIntrinsicsLib: add new sources to
>     CompilerIntrinsicsLib.inf
> 
>  ArmVirtPkg/ArmVirt.dsc.inc                    |   4 +-
>  .../UnitTestFrameworkPkgTarget.dsc.inc        |   2 +-
>  ArmPkg/ArmPkg.dsc                             |   3 +-
>  .../ArmCrashDumpDxe/ArmCrashDumpDxe.dsc       |   2 +-
>  ArmPlatformPkg/ArmPlatformPkg.dsc             |   2 +-
>  CryptoPkg/CryptoPkg.dsc                       |   5 +-
>  DynamicTablesPkg/DynamicTablesPkg.dsc         |   2 +-
>  EmbeddedPkg/EmbeddedPkg.dsc                   |   2 +-
>  EmulatorPkg/EmulatorPkg.dsc                   |   2 +-
>  FatPkg/FatPkg.dsc                             |   2 +-
>  FmpDevicePkg/FmpDevicePkg.dsc                 |   4 +-
>  MdeModulePkg/MdeModulePkg.dsc                 |   2 +-
>  MdePkg/MdePkg.dsc                             |   1 +
>  NetworkPkg/NetworkPkg.dsc                     |   4 +-
>  OvmfPkg/AmdSev/AmdSevX64.dsc                  |   2 +-
>  OvmfPkg/Bhyve/BhyveX64.dsc                    |   2 +-
>  OvmfPkg/CloudHv/CloudHvX64.dsc                |   2 +-
>  OvmfPkg/IntelTdx/IntelTdxX64.dsc              |   2 +-
>  OvmfPkg/Microvm/MicrovmX64.dsc                |   2 +-
>  OvmfPkg/OvmfPkgIa32.dsc                       |   2 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc                    |   2 +-
>  OvmfPkg/OvmfPkgX64.dsc                        |   2 +-
>  OvmfPkg/OvmfXen.dsc                           |   2 +-
>  RedfishPkg/RedfishPkg.dsc                     |   2 +-
>  SecurityPkg/SecurityPkg.dsc                   |  12 +-
>  ShellPkg/ShellPkg.dsc                         |   2 +-
>  SignedCapsulePkg/SignedCapsulePkg.dsc         |  14 +-
>  StandaloneMmPkg/StandaloneMmPkg.dsc           |   2 +-
>  UefiPayloadPkg/UefiPayloadPkg.dsc             |   2 +-
>  .../Library/IntrinsicLib/IntrinsicLib.inf     |  67 ------
>  .../CompilerIntrinsicsLib.inf                 |  35 ++-
>  {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
>  .../Library/CompilerIntrinsicsLib/types_ms.h  |  14 ++
>  CryptoPkg/Library/IntrinsicLib/CopyMem.c      |  47 ----
>  .../Library/IntrinsicLib/MemoryIntrinsics.c   |  74 ------
>  .../Library/CompilerIntrinsicsLib/Ia32/Gcc.c  | 215 ++++++++++++++++++
>  .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |   0
>  .../Ia32/MathLShiftS64.c                      |   0
>  .../Ia32/MathRShiftU64.c                      |   0
>  .../CompilerIntrinsicsLib/Ia32/lldiv.c        | 100 ++++++++
>  .../CompilerIntrinsicsLib/Ia32/lldvrm.c       | 104 +++++++++
>  .../CompilerIntrinsicsLib/Ia32/llmul.c        |  84 +++++++
>  .../CompilerIntrinsicsLib/Ia32/llrem.c        |  97 ++++++++
>  .../CompilerIntrinsicsLib/Ia32/llshl.c        |  10 +-
>  .../CompilerIntrinsicsLib/Ia32/llshr.c        |  63 +++++
>  .../CompilerIntrinsicsLib/Ia32/ulldiv.c       |  91 ++++++++
>  .../CompilerIntrinsicsLib/Ia32/ulldvrm.c      | 104 +++++++++
>  .../CompilerIntrinsicsLib/Ia32/ullrem.c       |  97 ++++++++
>  .../CompilerIntrinsicsLib/Ia32/ullshr.c       |  10 +-
>  .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   2 +-
>  .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
>  .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   6 +-
>  .../CompilerIntrinsicsLib/memmove_ms.c        |   6 +-
>  .../Library/CompilerIntrinsicsLib/memset.c    |   0
>  .../Library/CompilerIntrinsicsLib/memset_ms.c |   6 +-
>  MdePkg/Library/CompilerIntrinsicsLib/strcmp.c |  33 +++
>  ArmPkg/ArmPkg.ci.yaml                         |   1 -
>  .../DEBUG_XCODE31/CompilerIntrinsicsLib.lib   | Bin 36072 -> 36072
> bytes
>  .../DEBUG_XCODE32/CompilerIntrinsicsLib.lib   | Bin 36072 -> 36072
> bytes
>  .../Library/IntrinsicLib/BaseIntrinsicLib.uni |  16 --
>  .../CompilerIntrinsicsLib/AArch64/Atomics.S   |   0
>  .../CompilerIntrinsicsLib/Arm/ashldi3.S       |   0
>  .../CompilerIntrinsicsLib/Arm/ashrdi3.S       |   0
>  .../CompilerIntrinsicsLib/Arm/clzsi2.S        |   0
>  .../CompilerIntrinsicsLib/Arm/ctzsi2.S        |   0
>  .../Library/CompilerIntrinsicsLib/Arm/div.S   |   0
>  .../Library/CompilerIntrinsicsLib/Arm/div.asm |   0
>  .../CompilerIntrinsicsLib/Arm/divdi3.S        |   0
>  .../CompilerIntrinsicsLib/Arm/divsi3.S        |   0
>  .../Library/CompilerIntrinsicsLib/Arm/lasr.S  |   0
>  .../CompilerIntrinsicsLib/Arm/lasr.asm        |   0
>  .../CompilerIntrinsicsLib/Arm/ldivmod.S       |   0
>  .../CompilerIntrinsicsLib/Arm/ldivmod.asm     |   0
>  .../Library/CompilerIntrinsicsLib/Arm/llsl.S  |   0
>  .../CompilerIntrinsicsLib/Arm/llsl.asm        |   0
>  .../Library/CompilerIntrinsicsLib/Arm/llsr.S  |   0
>  .../CompilerIntrinsicsLib/Arm/llsr.asm        |   0
>  .../CompilerIntrinsicsLib/Arm/lshrdi3.S       |   0
>  .../CompilerIntrinsicsLib/Arm/memmove.S       |   0
>  .../CompilerIntrinsicsLib/Arm/memmove.asm     |   0
>  .../CompilerIntrinsicsLib/Arm/moddi3.S        |   0
>  .../CompilerIntrinsicsLib/Arm/modsi3.S        |   0
>  .../CompilerIntrinsicsLib/Arm/muldi3.S        |   0
>  .../Library/CompilerIntrinsicsLib/Arm/mullu.S |   0
>  .../CompilerIntrinsicsLib/Arm/mullu.asm       |   0
>  .../CompilerIntrinsicsLib/Arm/sourcery.S      |   0
>  .../CompilerIntrinsicsLib/Arm/switch.asm      |   0
>  .../CompilerIntrinsicsLib/Arm/switch16.S      |   0
>  .../CompilerIntrinsicsLib/Arm/switch32.S      |   0
>  .../CompilerIntrinsicsLib/Arm/switch8.S       |   0
>  .../CompilerIntrinsicsLib/Arm/switchu8.S      |   0
>  .../CompilerIntrinsicsLib/Arm/ucmpdi2.S       |   0
>  .../CompilerIntrinsicsLib/Arm/udivdi3.S       |   0
>  .../CompilerIntrinsicsLib/Arm/udivmoddi4.S    |   0
>  .../CompilerIntrinsicsLib/Arm/udivsi3.S       |   0
>  .../Library/CompilerIntrinsicsLib/Arm/uldiv.S |   0
>  .../CompilerIntrinsicsLib/Arm/uldiv.asm       |   0
>  .../CompilerIntrinsicsLib/Arm/umoddi3.S       |   0
>  .../CompilerIntrinsicsLib/Arm/umodsi3.S       |   0
>  .../Library/CompilerIntrinsicsLib/Arm/uread.S |   0
>  .../CompilerIntrinsicsLib/Arm/uread.asm       |   0
>  .../CompilerIntrinsicsLib/Arm/uwrite.S        |   0
>  .../CompilerIntrinsicsLib/Arm/uwrite.asm      |   0
>  .../Ia32/MathLShiftS64.nasm                   |   0
>  .../Ia32/MathRShiftU64.nasm                   |   0
>  .../CompilerIntrinsicsLib/Ia32/ashrdi3.S      |  68 ++++++
>  .../CompilerIntrinsicsLib/Ia32/mulll.S        |  79 +++++++
>  .../CompilerIntrinsicsLib/Ia32/shldi3.S       |  64 ++++++
>  .../CompilerIntrinsicsLib/Ia32/udivdi3.S      |  85 +++++++
>  .../CompilerIntrinsicsLib/Ia32/umoddi3.S      |  91 ++++++++
>  MdePkg/MdePkg.ci.yaml                         |   1 +
>  111 files changed, 1490 insertions(+), 269 deletions(-)
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (66%)
>  rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/types_ms.h
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/CopyMem.c
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/Gcc.c
>  rename {CryptoPkg/Library/IntrinsicLib =>
> MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathFtol.c (100%)
>  copy {CryptoPkg/Library/IntrinsicLib =>
> MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathLShiftS64.c (100%)
>  copy {CryptoPkg/Library/IntrinsicLib =>
> MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathRShiftU64.c (100%)
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldiv.c
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/lldvrm.c
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llmul.c
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llrem.c
>  rename CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c =>
> MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshl.c (61%)
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/llshr.c
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldiv.c
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ulldvrm.c
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullrem.c
>  rename CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c =>
> MdePkg/Library/CompilerIntrinsicsLib/Ia32/ullshr.c (62%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcmp_ms.c
> (89%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy.c
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy_ms.c
> (82%)
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (83%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c
> (80%)
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/strcmp.c
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/AArch64/Atomics.S (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashldi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divdi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divsi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
> (100%)
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S
> (100%)
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.S (100%)
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.asm (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/moddi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/modsi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/muldi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/sourcery.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch16.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch32.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch8.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switchu8.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivdi3.S
> (100%)
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivsi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umoddi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umodsi3.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.asm
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.S
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
> (100%)
>  rename {CryptoPkg/Library/IntrinsicLib =>
> MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathLShiftS64.nasm (100%)
>  rename {CryptoPkg/Library/IntrinsicLib =>
> MdePkg/Library/CompilerIntrinsicsLib}/Ia32/MathRShiftU64.nasm (100%)
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/ashrdi3.S
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/mulll.S
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/shldi3.S
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/udivdi3.S
>  create mode 100644 MdePkg/Library/CompilerIntrinsicsLib/Ia32/umoddi3.S
> 
> --
> 2.35.1




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

* Re: [edk2-devel] 回复: [PATCH v2 00/10] consolidate compiler intrinsics
  2022-04-29  6:41 ` 回复: [PATCH v2 00/10] consolidate compiler intrinsics gaoliming
@ 2022-04-29  8:50   ` Gerd Hoffmann
  0 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2022-04-29  8:50 UTC (permalink / raw)
  To: devel, gaoliming
  Cc: 'Maurice Ma', 'Andrew Fish',
	'Pawel Polawski', 'Benjamin You',
	'Yuwei Chen', 'Zhiguang Liu',
	'Rebecca Cran', 'Xiaoyu Lu',
	'Supreeth Venkatesh', 'Zhichao Gao',
	'Brijesh Singh', 'Julien Grall',
	'Erdem Aktas', 'Maciej Rabeda',
	'Michael D Kinney', kilian_kegel, 'Siyuan Fu',
	'Oliver Steffen', 'Ray Ni', 'Abner Chang',
	'James Bottomley', 'Sean Brogan',
	'Alexei Fedorov', 'Tom Lendacky',
	'Guo Dong', 'Jiewen Yao', 'Sami Mujawar',
	'Sebastien Boeuf', 'Peter Grehan',
	'Min Xu', 'Anthony Perard',
	'Jordan Justen', 'Jian J Wang',
	'Bob Feng', 'Bret Barkelew',
	'Nickle Wang', 'Wei6 Xu',
	'Daniel Schaefer', 'Jiaxin Wu',
	'Leif Lindholm', 'Guomin Jiang',
	'Ard Biesheuvel'

On Fri, Apr 29, 2022 at 02:41:25PM +0800, gaoliming wrote:
> Gerd:
>   Do you plan to catch this change into edk2 202205 stable tag? 

That would be great, yes.

Working on v3 of the series right now (solving conflicts),
will the update post soon.

>   For this patch set,  Acked-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks,
  Gerd


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

end of thread, other threads:[~2022-04-29  8:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-12 14:07 [PATCH v2 00/10] consolidate compiler intrinsics Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 01/10] MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 02/10] MdePkg/CompilerIntrinsicsLib: fix msft sources for x64 Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 03/10] MdePkg/CompilerIntrinsicsLib: move size_t typedef to header file Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 04/10] MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 05/10] MdePkg/CompilerIntrinsicsLib: copy over intrinsics from edk2-libc repo Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 06/10] MdePkg/CompilerIntrinsicsLib: add SPDX License tags Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 07/10] MdePkg/CompilerIntrinsicsLib: drop include from Gcc.c Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 08/10] MdePkg/CompilerIntrinsicsLib: drop debug logging " Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 09/10] MdePkg/CompilerIntrinsicsLib: remove duplicate functions " Gerd Hoffmann
2022-04-12 14:07 ` [PATCH v2 10/10] MdePkg/CompilerIntrinsicsLib: add new sources to CompilerIntrinsicsLib.inf Gerd Hoffmann
2022-04-29  6:41 ` 回复: [PATCH v2 00/10] consolidate compiler intrinsics gaoliming
2022-04-29  8:50   ` [edk2-devel] " Gerd Hoffmann

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