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

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.

take care,
  Gerd

Gerd Hoffmann (3):
  MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
  MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
  MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp

 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/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                 |  15 +++-
 {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
 CryptoPkg/Library/IntrinsicLib/CopyMem.c      |  47 -----------
 .../Library/IntrinsicLib/MemoryIntrinsics.c   |  74 ------------------
 .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |   0
 .../Ia32/MathLShiftS64.c                      |   0
 .../Ia32/MathRShiftU64.c                      |   0
 .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   2 +-
 .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
 .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   2 +-
 .../CompilerIntrinsicsLib/memmove_ms.c        |   2 +-
 .../Library/CompilerIntrinsicsLib/memset.c    |   0
 .../Library/CompilerIntrinsicsLib/memset_ms.c |   2 +-
 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
 MdePkg/MdePkg.ci.yaml                         |   1 +
 93 files changed, 95 insertions(+), 254 deletions(-)
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (84%)
 rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
 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%)
 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 (89%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (90%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c (89%)
 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%)

-- 
2.35.1


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

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

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>
---
 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 a94959169b2f..512c9f6b079f 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] 16+ messages in thread

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

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

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 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] 16+ messages in thread

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

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>
---
 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/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
 27 files changed, 72 insertions(+), 230 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 fd56176796d5..9f735df95546 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -186,7 +186,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 5fa08bebd73c..7dd438d17faa 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -186,7 +186,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 3172100310b1..2a1dced582b8 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -196,7 +196,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/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 1ea43443ae97..1503f506321c 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -193,7 +193,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 85abed24c1a7..bab9b507fb11 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -193,7 +193,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 a9c1daecc1a8..d51254463af5 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.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/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 718399299f57..f12221657adc 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.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/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index efa97f09f32b..351552fabbb0 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -182,7 +182,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 1ce96a51c102..44e7abb8d129 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -179,7 +179,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] 16+ messages in thread

* 回复: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-01  7:18 [PATCH 0/3] [RFC] consolidate compiler intrinsics Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2022-03-01  7:18 ` [PATCH 3/3] MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp Gerd Hoffmann
@ 2022-03-02  2:06 ` gaoliming
  2022-03-02  2:16   ` Yao, Jiewen
  2022-03-02  6:12 ` Ard Biesheuvel
  2022-03-15 12:22 ` Gerd Hoffmann
  5 siblings, 1 reply; 16+ messages in thread
From: gaoliming @ 2022-03-02  2:06 UTC (permalink / raw)
  To: devel, kraxel
  Cc: 'Xiaoyu Lu', 'Bob Feng', 'Rebecca Cran',
	'James Bottomley', 'Sami Mujawar',
	'Jordan Justen', 'Erdem Aktas',
	'Jiewen Yao', 'Supreeth Venkatesh',
	'Sebastien Boeuf', 'Zhichao Gao',
	'Zhiguang Liu', 'Maciej Rabeda',
	'Maurice Ma', 'Andrew Fish',
	'Ard Biesheuvel', 'Tom Lendacky',
	'Peter Grehan', 'Sean Brogan',
	'Guomin Jiang', 'Bret Barkelew',
	'Yuwei Chen', 'Benjamin You',
	'Daniel Schaefer', 'Michael D Kinney',
	'Wei6 Xu', 'Jian J Wang', 'Jiaxin Wu',
	'Siyuan Fu', 'Guo Dong', kilian_kegel,
	'Abner Chang', 'Oliver Steffen',
	'Leif Lindholm', 'Brijesh Singh',
	'Min Xu', 'Ray Ni', 'Alexei Fedorov',
	'Julien Grall', 'Nickle Wang',
	'Pawel Polawski', 'Anthony Perard'

Gerd:
  Thanks for your great work. This is a really good progress. I agree to add CompilerIntrinsicsLib in MdePkg.
  
  I think we can add this CompilerIntrinsicsLib first to meet with current usage. It can be extended in future. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gerd
> Hoffmann
> 发送时间: 2022年3月1日 15:18
> 收件人: devel@edk2.groups.io
> 抄送: Xiaoyu Lu <xiaoyu1.lu@intel.com>; Bob Feng <bob.c.feng@intel.com>;
> Rebecca Cran <rebecca@bsdio.com>; James Bottomley
> <jejb@linux.ibm.com>; Sami Mujawar <Sami.Mujawar@arm.com>; Jordan
> Justen <jordan.l.justen@intel.com>; Erdem Aktas <erdemaktas@google.com>;
> Jiewen Yao <jiewen.yao@intel.com>; Supreeth Venkatesh
> <supreeth.venkatesh@arm.com>; Sebastien Boeuf
> <sebastien.boeuf@intel.com>; Zhichao Gao <zhichao.gao@intel.com>;
> Zhiguang Liu <zhiguang.liu@intel.com>; Maciej Rabeda
> <maciej.rabeda@linux.intel.com>; Maurice Ma <maurice.ma@intel.com>;
> Andrew Fish <afish@apple.com>; Ard Biesheuvel
> <ardb+tianocore@kernel.org>; Tom Lendacky <thomas.lendacky@amd.com>;
> Peter Grehan <grehan@freebsd.org>; Sean Brogan
> <sean.brogan@microsoft.com>; Guomin Jiang <guomin.jiang@intel.com>;
> Bret Barkelew <Bret.Barkelew@microsoft.com>; Yuwei Chen
> <yuwei.chen@intel.com>; Benjamin You <benjamin.you@intel.com>; Daniel
> Schaefer <daniel.schaefer@hpe.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Michael D Kinney
> <michael.d.kinney@intel.com>; Wei6 Xu <wei6.xu@intel.com>; Jian J Wang
> <jian.j.wang@intel.com>; Jiaxin Wu <jiaxin.wu@intel.com>; Siyuan Fu
> <siyuan.fu@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Sami Mujawar
> <sami.mujawar@arm.com>; Guo Dong <guo.dong@intel.com>;
> kilian_kegel@hotmail.com; Abner Chang <abner.chang@hpe.com>; Oliver
> Steffen <osteffen@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>;
> Brijesh Singh <brijesh.singh@amd.com>; Min Xu <min.m.xu@intel.com>; Ray
> Ni <ray.ni@intel.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>; Julien
> Grall <julien@xen.org>; Nickle Wang <nickle.wang@hpe.com>; Pawel
> Polawski <ppolawsk@redhat.com>; Anthony Perard
> <anthony.perard@citrix.com>
> 主题: [edk2-devel] [PATCH 0/3] [RFC] 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.
> 
> take care,
>   Gerd
> 
> Gerd Hoffmann (3):
>   MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
>   MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
>   MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp
> 
>  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/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                 |  15 +++-
>  {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
>  CryptoPkg/Library/IntrinsicLib/CopyMem.c      |  47 -----------
>  .../Library/IntrinsicLib/MemoryIntrinsics.c   |  74 ------------------
>  .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |   0
>  .../Ia32/MathLShiftS64.c                      |   0
>  .../Ia32/MathRShiftU64.c                      |   0
>  .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   2 +-
>  .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
>  .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   2 +-
>  .../CompilerIntrinsicsLib/memmove_ms.c        |   2 +-
>  .../Library/CompilerIntrinsicsLib/memset.c    |   0
>  .../Library/CompilerIntrinsicsLib/memset_ms.c |   2 +-
>  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
>  MdePkg/MdePkg.ci.yaml                         |   1 +
>  93 files changed, 95 insertions(+), 254 deletions(-)
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (84%)
>  rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
>  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%)
>  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
> (89%)
>  rename {ArmPkg =>
> MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (90%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c
> (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c
> (89%)
>  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%)
> 
> --
> 2.35.1
> 
> 
> 
> 
> 




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

* Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-02  2:06 ` 回复: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics gaoliming
@ 2022-03-02  2:16   ` Yao, Jiewen
  2022-03-02  8:39     ` Kilian Kegel
  0 siblings, 1 reply; 16+ messages in thread
From: Yao, Jiewen @ 2022-03-02  2:16 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, kraxel@redhat.com
  Cc: Lu, Xiaoyu1, Feng, Bob C, 'Rebecca Cran',
	'James Bottomley', 'Sami Mujawar',
	Justen, Jordan L, Aktas, Erdem, 'Supreeth Venkatesh',
	Boeuf, Sebastien, Gao, Zhichao, Liu, Zhiguang,
	'Maciej Rabeda', Ma, Maurice, 'Andrew Fish',
	'Ard Biesheuvel', 'Tom Lendacky',
	'Peter Grehan', 'Sean Brogan', Jiang, Guomin,
	'Bret Barkelew', Chen, Christine, You, Benjamin,
	Schaefer, Daniel, Kinney, Michael D, Xu, Wei6, Wang, Jian J,
	Wu, Jiaxin, Fu, Siyuan, Dong, Guo, kilian_kegel@hotmail.com,
	Chang, Abner, 'Oliver Steffen', 'Leif Lindholm',
	'Brijesh Singh', Xu, Min M, Ni, Ray,
	'Alexei Fedorov', 'Julien Grall', Wang, Nickle,
	'Pawel Polawski', 'Anthony Perard'

Acked, for CryptoPkg/OvmfPkg/SecurityPkg/StandaloneMmPkg update.

Thank you
Yao, Jiewen


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> Sent: Wednesday, March 2, 2022 10:06 AM
> To: devel@edk2.groups.io; kraxel@redhat.com
> Cc: Lu, Xiaoyu1 <xiaoyu1.lu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>;
> 'Rebecca Cran' <rebecca@bsdio.com>; 'James Bottomley'
> <jejb@linux.ibm.com>; 'Sami Mujawar' <Sami.Mujawar@arm.com>; Justen,
> Jordan L <jordan.l.justen@intel.com>; Aktas, Erdem
> <erdemaktas@google.com>; Yao, Jiewen <jiewen.yao@intel.com>; 'Supreeth
> Venkatesh' <supreeth.venkatesh@arm.com>; Boeuf, Sebastien
> <sebastien.boeuf@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Liu,
> Zhiguang <zhiguang.liu@intel.com>; 'Maciej Rabeda'
> <maciej.rabeda@linux.intel.com>; Ma, Maurice <maurice.ma@intel.com>;
> 'Andrew Fish' <afish@apple.com>; 'Ard Biesheuvel'
> <ardb+tianocore@kernel.org>; 'Tom Lendacky' <thomas.lendacky@amd.com>;
> 'Peter Grehan' <grehan@freebsd.org>; 'Sean Brogan'
> <sean.brogan@microsoft.com>; Jiang, Guomin <guomin.jiang@intel.com>;
> 'Bret Barkelew' <Bret.Barkelew@microsoft.com>; Chen, Christine
> <yuwei.chen@intel.com>; You, Benjamin <benjamin.you@intel.com>; Schaefer,
> Daniel <daniel.schaefer@hpe.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Xu, Wei6 <wei6.xu@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Fu, Siyuan
> <siyuan.fu@intel.com>; Dong, Guo <guo.dong@intel.com>;
> kilian_kegel@hotmail.com; Chang, Abner <abner.chang@hpe.com>; 'Oliver
> Steffen' <osteffen@redhat.com>; 'Leif Lindholm' <quic_llindhol@quicinc.com>;
> 'Brijesh Singh' <brijesh.singh@amd.com>; Xu, Min M <min.m.xu@intel.com>; Ni,
> Ray <ray.ni@intel.com>; 'Alexei Fedorov' <Alexei.Fedorov@arm.com>; 'Julien
> Grall' <julien@xen.org>; Wang, Nickle <nickle.wang@hpe.com>; 'Pawel
> Polawski' <ppolawsk@redhat.com>; 'Anthony Perard'
> <anthony.perard@citrix.com>
> Subject: 回复: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
> 
> Gerd:
>   Thanks for your great work. This is a really good progress. I agree to add
> CompilerIntrinsicsLib in MdePkg.
> 
>   I think we can add this CompilerIntrinsicsLib first to meet with current usage. It
> can be extended in future.
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gerd
> > Hoffmann
> > 发送时间: 2022年3月1日 15:18
> > 收件人: devel@edk2.groups.io
> > 抄送: Xiaoyu Lu <xiaoyu1.lu@intel.com>; Bob Feng <bob.c.feng@intel.com>;
> > Rebecca Cran <rebecca@bsdio.com>; James Bottomley
> > <jejb@linux.ibm.com>; Sami Mujawar <Sami.Mujawar@arm.com>; Jordan
> > Justen <jordan.l.justen@intel.com>; Erdem Aktas <erdemaktas@google.com>;
> > Jiewen Yao <jiewen.yao@intel.com>; Supreeth Venkatesh
> > <supreeth.venkatesh@arm.com>; Sebastien Boeuf
> > <sebastien.boeuf@intel.com>; Zhichao Gao <zhichao.gao@intel.com>;
> > Zhiguang Liu <zhiguang.liu@intel.com>; Maciej Rabeda
> > <maciej.rabeda@linux.intel.com>; Maurice Ma <maurice.ma@intel.com>;
> > Andrew Fish <afish@apple.com>; Ard Biesheuvel
> > <ardb+tianocore@kernel.org>; Tom Lendacky <thomas.lendacky@amd.com>;
> > Peter Grehan <grehan@freebsd.org>; Sean Brogan
> > <sean.brogan@microsoft.com>; Guomin Jiang <guomin.jiang@intel.com>;
> > Bret Barkelew <Bret.Barkelew@microsoft.com>; Yuwei Chen
> > <yuwei.chen@intel.com>; Benjamin You <benjamin.you@intel.com>; Daniel
> > Schaefer <daniel.schaefer@hpe.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Michael D Kinney
> > <michael.d.kinney@intel.com>; Wei6 Xu <wei6.xu@intel.com>; Jian J Wang
> > <jian.j.wang@intel.com>; Jiaxin Wu <jiaxin.wu@intel.com>; Siyuan Fu
> > <siyuan.fu@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Sami Mujawar
> > <sami.mujawar@arm.com>; Guo Dong <guo.dong@intel.com>;
> > kilian_kegel@hotmail.com; Abner Chang <abner.chang@hpe.com>; Oliver
> > Steffen <osteffen@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>;
> > Brijesh Singh <brijesh.singh@amd.com>; Min Xu <min.m.xu@intel.com>; Ray
> > Ni <ray.ni@intel.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>; Julien
> > Grall <julien@xen.org>; Nickle Wang <nickle.wang@hpe.com>; Pawel
> > Polawski <ppolawsk@redhat.com>; Anthony Perard
> > <anthony.perard@citrix.com>
> > 主题: [edk2-devel] [PATCH 0/3] [RFC] 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.
> >
> > take care,
> >   Gerd
> >
> > Gerd Hoffmann (3):
> >   MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
> >   MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
> >   MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp
> >
> >  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/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                 |  15 +++-
> >  {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
> >  CryptoPkg/Library/IntrinsicLib/CopyMem.c      |  47 -----------
> >  .../Library/IntrinsicLib/MemoryIntrinsics.c   |  74 ------------------
> >  .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |   0
> >  .../Ia32/MathLShiftS64.c                      |   0
> >  .../Ia32/MathRShiftU64.c                      |   0
> >  .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   2 +-
> >  .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
> >  .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   2 +-
> >  .../CompilerIntrinsicsLib/memmove_ms.c        |   2 +-
> >  .../Library/CompilerIntrinsicsLib/memset.c    |   0
> >  .../Library/CompilerIntrinsicsLib/memset_ms.c |   2 +-
> >  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
> >  MdePkg/MdePkg.ci.yaml                         |   1 +
> >  93 files changed, 95 insertions(+), 254 deletions(-)
> >  delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> >  rename {ArmPkg =>
> > MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (84%)
> >  rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
> >  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%)
> >  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
> > (89%)
> >  rename {ArmPkg =>
> > MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (90%)
> >  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c
> > (100%)
> >  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c
> > (89%)
> >  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%)
> >
> > --
> > 2.35.1
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 


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

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

On Tue, 1 Mar 2022 at 08:18, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> 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.
>
> take care,
>   Gerd
>
> Gerd Hoffmann (3):
>   MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
>   MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
>   MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp
>

For the series,

Acked-by: Ard Biesheuvel <ardb@kernel.org>

>  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/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                 |  15 +++-
>  {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
>  CryptoPkg/Library/IntrinsicLib/CopyMem.c      |  47 -----------
>  .../Library/IntrinsicLib/MemoryIntrinsics.c   |  74 ------------------
>  .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |   0
>  .../Ia32/MathLShiftS64.c                      |   0
>  .../Ia32/MathRShiftU64.c                      |   0
>  .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   2 +-
>  .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
>  .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   2 +-
>  .../CompilerIntrinsicsLib/memmove_ms.c        |   2 +-
>  .../Library/CompilerIntrinsicsLib/memset.c    |   0
>  .../Library/CompilerIntrinsicsLib/memset_ms.c |   2 +-
>  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
>  MdePkg/MdePkg.ci.yaml                         |   1 +
>  93 files changed, 95 insertions(+), 254 deletions(-)
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (84%)
>  rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
>  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%)
>  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 (89%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (90%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c (100%)
>  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c (89%)
>  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%)
>
> --
> 2.35.1
>

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

* Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-02  2:16   ` Yao, Jiewen
@ 2022-03-02  8:39     ` Kilian Kegel
  2022-03-02 10:10       ` Gerd Hoffmann
  0 siblings, 1 reply; 16+ messages in thread
From: Kilian Kegel @ 2022-03-02  8:39 UTC (permalink / raw)
  To: devel@edk2.groups.io, jiewen.yao@intel.com, Gao, Liming,
	kraxel@redhat.com
  Cc: Lu, Xiaoyu1, Feng, Bob C, 'Rebecca Cran',
	'James Bottomley', 'Sami Mujawar',
	Justen, Jordan L, Aktas, Erdem, 'Supreeth Venkatesh',
	Boeuf, Sebastien, Gao, Zhichao, Liu, Zhiguang,
	'Maciej Rabeda', Ma, Maurice, 'Andrew Fish',
	'Ard Biesheuvel', 'Tom Lendacky',
	'Peter Grehan', 'Sean Brogan', Jiang, Guomin,
	'Bret Barkelew', Chen, Christine, You, Benjamin,
	Schaefer, Daniel, Kinney, Michael D, Xu, Wei6, Wang, Jian J,
	Wu, Jiaxin, Fu, Siyuan, Dong, Guo, kilian_kegel@hotmail.com,
	Chang, Abner, 'Oliver Steffen', 'Leif Lindholm',
	'Brijesh Singh', Xu, Min M, Ni, Ray,
	'Alexei Fedorov', 'Julien Grall', Wang, Nickle,
	'Pawel Polawski', 'Anthony Perard'


[-- Attachment #1.1: Type: text/plain, Size: 21757 bytes --]

Hi Gerd,

additionally I would suggest once more to adjust the DLINK_FLAGS in tools_def.txt to hold CompilerNameINTRIN32/64.LIB as a search library
as already introduced in https://edk2.groups.io/g/devel/message/86072?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3ACreated%2C%2Ckilian%2C20%2C2%2C0%2C87479913
(here is the entire thread https://edk2.groups.io/g/devel/message/86334?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3ACreated%2C%2Cposterid%3A2193857%2C20%2C2%2C0%2C87479913)

In that case you don’t need to take the IntrinsicLibrary into the .INF file, because the intrinsic library is in the compiler’s library search path.
That has annoyed UEFI developers world wide for more that a decade.

With your solution can you compile + link the body of main() given below in a PEI driver on all targets?
Really?

Best regards,
Kilian

[cid:image001.png@01D82DFC.85319FA0]

typedef unsigned long long uint64_t;                // allow a C99-Standard definition to save ink
typedef          long long  int64_t;                // allow another C99-Standard definition to save ink
typedef struct _BUFFER {
    char buffer[5869];
}BUFFER, *PBUFFER;

int main(int argc, char** argv)
{
    //
    // memset()  http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf#page=345
    //
    BUFFER buffer = { argc };                       // sometimes invokes automatically a function called memset()
    //
    // memcpy()  http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf#page=337
    //
    PBUFFER pBuf = (void*)argv[1];
    *pBuf = buffer;                                 // sometimes invokes automatically a function called memcpy()
    //
    // shift operators  http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf#page=96
    //
    uint64_t ullshl = ((uint64_t)argc) <<  3ULL;    // <<
    uint64_t ullshr = ((uint64_t)argc) >>  5ULL;    // >>
    int64_t  llshl  = (( int64_t)argc) <<  7LL;     // <<
    int64_t  llshr  = (( int64_t)argc) >> 11LL;     // >>
    //
    // multiplicative operators  http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf#page=94
    //
    uint64_t ullmul = ((uint64_t)argc) * 13ULL;     // *
    uint64_t ulldiv = ((uint64_t)argc) / 17ULL;     // /
    uint64_t ullrem = ((uint64_t)argc) % 19ULL;     // %
    int64_t  llmul  = (( int64_t)argc) * 23LL;      // *
    int64_t  lldiv  = (( int64_t)argc) / 29LL;      // /
    int64_t  llrem  = (( int64_t)argc) % 31LL;      // %
    ////
    //// floating point intrinsics
    ////
    //volatile double dblmul = ((double)argc) * 37ULL;
    //volatile double dbldiv = ((double)argc) / 37ULL;

    //__builtin_trap();

    //__debugbreak();

    return (int)(
          ullshl
        + ullshr
        + ullmul
        + ulldiv
        + ullrem
        +  llshl
        +  llshr
        +  llmul
        +  lldiv
        +  llrem
        + (uint64_t)pBuf);
}



From: Yao, Jiewen<mailto:jiewen.yao@intel.com>
Sent: Wednesday, March 2, 2022 03:16 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Gao, Liming<mailto:gaoliming@byosoft.com.cn>; kraxel@redhat.com<mailto:kraxel@redhat.com>
Cc: Lu, Xiaoyu1<mailto:xiaoyu1.lu@intel.com>; Feng, Bob C<mailto:bob.c.feng@intel.com>; 'Rebecca Cran'<mailto:rebecca@bsdio.com>; 'James Bottomley'<mailto:jejb@linux.ibm.com>; 'Sami Mujawar'<mailto:Sami.Mujawar@arm.com>; Justen, Jordan L<mailto:jordan.l.justen@intel.com>; Aktas, Erdem<mailto:erdemaktas@google.com>; 'Supreeth Venkatesh'<mailto:supreeth.venkatesh@arm.com>; Boeuf, Sebastien<mailto:sebastien.boeuf@intel.com>; Gao, Zhichao<mailto:zhichao.gao@intel.com>; Liu, Zhiguang<mailto:zhiguang.liu@intel.com>; 'Maciej Rabeda'<mailto:maciej.rabeda@linux.intel.com>; Ma, Maurice<mailto:maurice.ma@intel.com>; 'Andrew Fish'<mailto:afish@apple.com>; 'Ard Biesheuvel'<mailto:ardb+tianocore@kernel.org>; 'Tom Lendacky'<mailto:thomas.lendacky@amd.com>; 'Peter Grehan'<mailto:grehan@freebsd.org>; 'Sean Brogan'<mailto:sean.brogan@microsoft.com>; Jiang, Guomin<mailto:guomin.jiang@intel.com>; 'Bret Barkelew'<mailto:Bret.Barkelew@microsoft.com>; Chen, Christine<mailto:yuwei.chen@intel.com>; You, Benjamin<mailto:benjamin.you@intel.com>; Schaefer, Daniel<mailto:daniel.schaefer@hpe.com>; Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Xu, Wei6<mailto:wei6.xu@intel.com>; Wang, Jian J<mailto:jian.j.wang@intel.com>; Wu, Jiaxin<mailto:jiaxin.wu@intel.com>; Fu, Siyuan<mailto:siyuan.fu@intel.com>; Dong, Guo<mailto:guo.dong@intel.com>; kilian_kegel@hotmail.com<mailto:kilian_kegel@hotmail.com>; Chang, Abner<mailto:abner.chang@hpe.com>; 'Oliver Steffen'<mailto:osteffen@redhat.com>; 'Leif Lindholm'<mailto:quic_llindhol@quicinc.com>; 'Brijesh Singh'<mailto:brijesh.singh@amd.com>; Xu, Min M<mailto:min.m.xu@intel.com>; Ni, Ray<mailto:ray.ni@intel.com>; 'Alexei Fedorov'<mailto:Alexei.Fedorov@arm.com>; 'Julien Grall'<mailto:julien@xen.org>; Wang, Nickle<mailto:nickle.wang@hpe.com>; 'Pawel Polawski'<mailto:ppolawsk@redhat.com>; 'Anthony Perard'<mailto:anthony.perard@citrix.com>
Subject: Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics

Acked, for CryptoPkg/OvmfPkg/SecurityPkg/StandaloneMmPkg update.

Thank you
Yao, Jiewen


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> Sent: Wednesday, March 2, 2022 10:06 AM
> To: devel@edk2.groups.io; kraxel@redhat.com
> Cc: Lu, Xiaoyu1 <xiaoyu1.lu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>;
> 'Rebecca Cran' <rebecca@bsdio.com>; 'James Bottomley'
> <jejb@linux.ibm.com>; 'Sami Mujawar' <Sami.Mujawar@arm.com>; Justen,
> Jordan L <jordan.l.justen@intel.com>; Aktas, Erdem
> <erdemaktas@google.com>; Yao, Jiewen <jiewen.yao@intel.com>; 'Supreeth
> Venkatesh' <supreeth.venkatesh@arm.com>; Boeuf, Sebastien
> <sebastien.boeuf@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Liu,
> Zhiguang <zhiguang.liu@intel.com>; 'Maciej Rabeda'
> <maciej.rabeda@linux.intel.com>; Ma, Maurice <maurice.ma@intel.com>;
> 'Andrew Fish' <afish@apple.com>; 'Ard Biesheuvel'
> <ardb+tianocore@kernel.org>; 'Tom Lendacky' <thomas.lendacky@amd.com>;
> 'Peter Grehan' <grehan@freebsd.org>; 'Sean Brogan'
> <sean.brogan@microsoft.com>; Jiang, Guomin <guomin.jiang@intel.com>;
> 'Bret Barkelew' <Bret.Barkelew@microsoft.com>; Chen, Christine
> <yuwei.chen@intel.com>; You, Benjamin <benjamin.you@intel.com>; Schaefer,
> Daniel <daniel.schaefer@hpe.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Xu, Wei6 <wei6.xu@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Fu, Siyuan
> <siyuan.fu@intel.com>; Dong, Guo <guo.dong@intel.com>;
> kilian_kegel@hotmail.com; Chang, Abner <abner.chang@hpe.com>; 'Oliver
> Steffen' <osteffen@redhat.com>; 'Leif Lindholm' <quic_llindhol@quicinc.com>;
> 'Brijesh Singh' <brijesh.singh@amd.com>; Xu, Min M <min.m.xu@intel.com>; Ni,
> Ray <ray.ni@intel.com>; 'Alexei Fedorov' <Alexei.Fedorov@arm.com>; 'Julien
> Grall' <julien@xen.org>; Wang, Nickle <nickle.wang@hpe.com>; 'Pawel
> Polawski' <ppolawsk@redhat.com>; 'Anthony Perard'
> <anthony.perard@citrix.com>
> Subject: 回复: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
>
> Gerd:
>   Thanks for your great work. This is a really good progress. I agree to add
> CompilerIntrinsicsLib in MdePkg.
>
>   I think we can add this CompilerIntrinsicsLib first to meet with current usage. It
> can be extended in future.
>
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gerd
> > Hoffmann
> > 发送时间: 2022年3月1日 15:18
> > 收件人: devel@edk2.groups.io
> > 抄送: Xiaoyu Lu <xiaoyu1.lu@intel.com>; Bob Feng <bob.c.feng@intel.com>;
> > Rebecca Cran <rebecca@bsdio.com>; James Bottomley
> > <jejb@linux.ibm.com>; Sami Mujawar <Sami.Mujawar@arm.com>; Jordan
> > Justen <jordan.l.justen@intel.com>; Erdem Aktas <erdemaktas@google.com>;
> > Jiewen Yao <jiewen.yao@intel.com>; Supreeth Venkatesh
> > <supreeth.venkatesh@arm.com>; Sebastien Boeuf
> > <sebastien.boeuf@intel.com>; Zhichao Gao <zhichao.gao@intel.com>;
> > Zhiguang Liu <zhiguang.liu@intel.com>; Maciej Rabeda
> > <maciej.rabeda@linux.intel.com>; Maurice Ma <maurice.ma@intel.com>;
> > Andrew Fish <afish@apple.com>; Ard Biesheuvel
> > <ardb+tianocore@kernel.org>; Tom Lendacky <thomas.lendacky@amd.com>;
> > Peter Grehan <grehan@freebsd.org>; Sean Brogan
> > <sean.brogan@microsoft.com>; Guomin Jiang <guomin.jiang@intel.com>;
> > Bret Barkelew <Bret.Barkelew@microsoft.com>; Yuwei Chen
> > <yuwei.chen@intel.com>; Benjamin You <benjamin.you@intel.com>; Daniel
> > Schaefer <daniel.schaefer@hpe.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Michael D Kinney
> > <michael.d.kinney@intel.com>; Wei6 Xu <wei6.xu@intel.com>; Jian J Wang
> > <jian.j.wang@intel.com>; Jiaxin Wu <jiaxin.wu@intel.com>; Siyuan Fu
> > <siyuan.fu@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Sami Mujawar
> > <sami.mujawar@arm.com>; Guo Dong <guo.dong@intel.com>;
> > kilian_kegel@hotmail.com; Abner Chang <abner.chang@hpe.com>; Oliver
> > Steffen <osteffen@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>;
> > Brijesh Singh <brijesh.singh@amd.com>; Min Xu <min.m.xu@intel.com>; Ray
> > Ni <ray.ni@intel.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>; Julien
> > Grall <julien@xen.org>; Nickle Wang <nickle.wang@hpe.com>; Pawel
> > Polawski <ppolawsk@redhat.com>; Anthony Perard
> > <anthony.perard@citrix.com>
> > 主题: [edk2-devel] [PATCH 0/3] [RFC] 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.
> >
> > take care,
> >   Gerd
> >
> > Gerd Hoffmann (3):
> >   MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg
> >   MdePkg/CompilerIntrinsicsLib: fix msft sources for x64
> >   MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp
> >
> >  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/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                 |  15 +++-
> >  {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h    |   0
> >  CryptoPkg/Library/IntrinsicLib/CopyMem.c      |  47 -----------
> >  .../Library/IntrinsicLib/MemoryIntrinsics.c   |  74 ------------------
> >  .../CompilerIntrinsicsLib}/Ia32/MathFtol.c    |   0
> >  .../Ia32/MathLShiftS64.c                      |   0
> >  .../Ia32/MathRShiftU64.c                      |   0
> >  .../Library/CompilerIntrinsicsLib/memcmp_ms.c |   2 +-
> >  .../Library/CompilerIntrinsicsLib/memcpy.c    |   0
> >  .../Library/CompilerIntrinsicsLib/memcpy_ms.c |   2 +-
> >  .../CompilerIntrinsicsLib/memmove_ms.c        |   2 +-
> >  .../Library/CompilerIntrinsicsLib/memset.c    |   0
> >  .../Library/CompilerIntrinsicsLib/memset_ms.c |   2 +-
> >  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
> >  MdePkg/MdePkg.ci.yaml                         |   1 +
> >  93 files changed, 95 insertions(+), 254 deletions(-)
> >  delete mode 100644 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> >  rename {ArmPkg =>
> > MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (84%)
> >  rename {ArmPkg => MdePkg}/Include/AsmMacroIoLib.h (100%)
> >  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%)
> >  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
> > (89%)
> >  rename {ArmPkg =>
> > MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (90%)
> >  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c
> > (100%)
> >  rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c
> > (89%)
> >  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%)
> >
> > --
> > 2.35.1
> >
> >
> >
> >
> >
>
>
>
>
>
>
>







[-- Attachment #1.2: Type: text/html, Size: 44463 bytes --]

[-- Attachment #2: FC0F4A4534E04C1A8F77C2AC0BB2E981.png --]
[-- Type: image/png, Size: 102559 bytes --]

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

* Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-02  8:39     ` Kilian Kegel
@ 2022-03-02 10:10       ` Gerd Hoffmann
  0 siblings, 0 replies; 16+ messages in thread
From: Gerd Hoffmann @ 2022-03-02 10:10 UTC (permalink / raw)
  To: Kilian Kegel
  Cc: devel@edk2.groups.io, jiewen.yao@intel.com, Gao, Liming,
	Lu, Xiaoyu1, Feng, Bob C, 'Rebecca Cran',
	'James Bottomley', 'Sami Mujawar',
	Justen, Jordan L, Aktas, Erdem, 'Supreeth Venkatesh',
	Boeuf, Sebastien, Gao, Zhichao, Liu, Zhiguang,
	'Maciej Rabeda', Ma, Maurice, 'Andrew Fish',
	'Ard Biesheuvel', 'Tom Lendacky',
	'Peter Grehan', 'Sean Brogan', Jiang, Guomin,
	'Bret Barkelew', Chen, Christine, You, Benjamin,
	Schaefer, Daniel, Kinney, Michael D, Xu, Wei6, Wang, Jian J,
	Wu, Jiaxin, Fu, Siyuan, Dong, Guo, kilian_kegel@hotmail.com,
	Chang, Abner, 'Oliver Steffen', 'Leif Lindholm',
	'Brijesh Singh', Xu, Min M, Ni, Ray,
	'Alexei Fedorov', 'Julien Grall', Wang, Nickle,
	'Pawel Polawski', 'Anthony Perard'

On Wed, Mar 02, 2022 at 08:39:28AM +0000, Kilian Kegel wrote:
> Hi Gerd,
> 
> additionally I would suggest once more to adjust the DLINK_FLAGS in tools_def.txt to hold CompilerNameINTRIN32/64.LIB as a search library
> as already introduced in https://edk2.groups.io/g/devel/message/86072?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3ACreated%2C%2Ckilian%2C20%2C2%2C0%2C87479913
> (here is the entire thread https://edk2.groups.io/g/devel/message/86334?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3ACreated%2C%2Cposterid%3A2193857%2C20%2C2%2C0%2C87479913)
> 
> In that case you don’t need to take the IntrinsicLibrary into the .INF file, because the intrinsic library is in the compiler’s library search path.
> That has annoyed UEFI developers world wide for more that a decade.

Having to add the IntrinsicLibrary to the .inf file is annoying indeed.

Just using the compiler intrinsics doesn't work in all cases though,
so I see no way around providing our own intrinsics library.

> With your solution can you compile + link the body of main() given below in a PEI driver on all targets?
> Really?

Nope.  These patches simply move the existing intrinsics from ArmPkg and
CryptoPkg as starting point.  They are known to be incomplete.

I expect we'll add more functions as needed in the future.

We can surely debate if and how we can use the compiler's intrinsic
library instead our own implementation for the cases where it works.

Having a core intrinsics lib should actually make that kind changes
easier,  There will be one central place where you can tweak which
intrinsic functions are provided by edk2, so coordinating that with
DLINK_FLAGS updates should be easier than today.

take care,
  Gerd


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

* Re: [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-01  7:18 [PATCH 0/3] [RFC] consolidate compiler intrinsics Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2022-03-02  6:12 ` Ard Biesheuvel
@ 2022-03-15 12:22 ` Gerd Hoffmann
  2022-03-15 15:27   ` Michael D Kinney
  2022-03-15 17:08   ` Pedro Falcato
  5 siblings, 2 replies; 16+ messages in thread
From: Gerd Hoffmann @ 2022-03-15 12:22 UTC (permalink / raw)
  To: devel
  Cc: Xiaoyu Lu, Bob Feng, Rebecca Cran, James Bottomley, Sami Mujawar,
	Jordan Justen, Erdem Aktas, Jiewen Yao, Supreeth Venkatesh,
	Sebastien Boeuf, Zhichao Gao, Zhiguang Liu, Maciej Rabeda,
	Maurice Ma, Andrew Fish, Ard Biesheuvel, Tom Lendacky,
	Peter Grehan, Sean Brogan, Guomin Jiang, Bret Barkelew,
	Yuwei Chen, Benjamin You, Daniel Schaefer, Liming Gao,
	Michael D Kinney, Wei6 Xu, Jian J Wang, Jiaxin Wu, Siyuan Fu,
	Guo Dong, kilian_kegel, Abner Chang, Oliver Steffen,
	Leif Lindholm, Brijesh Singh, Min Xu, Ray Ni, Alexei Fedorov,
	Julien Grall, Nickle Wang, Pawel Polawski, Anthony Perard

On Tue, Mar 01, 2022 at 08:18:17AM +0100, Gerd Hoffmann wrote:
> 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.

Ping.  How go forward with this?  I've posted it as RFC because
I expected a more controversial discussion.  But seems everybody
agrees this is a step into the right direction.

So just merge this as-is?

Yes, it passed CI (https://github.com/tianocore/edk2/pull/2542).

take care,
  Gerd


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

* Re: [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-15 12:22 ` Gerd Hoffmann
@ 2022-03-15 15:27   ` Michael D Kinney
  2022-03-16  9:45     ` [edk2-devel] " Gerd Hoffmann
  2022-03-15 17:08   ` Pedro Falcato
  1 sibling, 1 reply; 16+ messages in thread
From: Michael D Kinney @ 2022-03-15 15:27 UTC (permalink / raw)
  To: Gerd Hoffmann, devel@edk2.groups.io, Sean Brogan,
	Kinney, Michael D
  Cc: Lu, Xiaoyu1, Feng, Bob C, Rebecca Cran, James Bottomley,
	Sami Mujawar, Justen, Jordan L, Aktas, Erdem, Yao, Jiewen,
	Supreeth Venkatesh, Boeuf, Sebastien, Gao, Zhichao, Liu, Zhiguang,
	Maciej Rabeda, Ma, Maurice, Andrew Fish, Ard Biesheuvel,
	Tom Lendacky, Peter Grehan, Sean Brogan, Jiang, Guomin,
	Bret Barkelew, Chen, Christine, You, Benjamin, Schaefer, Daniel,
	Gao, Liming, Xu, Wei6, Wang, Jian J, Wu, Jiaxin, Fu, Siyuan,
	Dong, Guo, kilian_kegel@hotmail.com, Chang, Abner, Oliver Steffen,
	Leif Lindholm, Brijesh Singh, Xu, Min M, Ni, Ray, Alexei Fedorov,
	Julien Grall, Wang, Nickle, Pawel Polawski, Anthony Perard

Hi Gerd,

Thanks for working on this.  I raised this topic in the new TianoCore build and CI 
meeting yesterday because the intrinsic libs are closely tied to the toolchains
supported by TianoCore.

I agree with the concept of moving the compiler intrinsics to a library in the MdePkg.

+ Sean Brogan

Sean mentioned that he has some addition work on intrinsic libs for Visual Studio
toolchains.  It would be good to see if this set of changes is aligned with those
efforts.

I see a few items that might be good to clean up at some point
* fltused should go into its own file.  Not related to the strcmp() API
* I see size_t defined in multiple places using different mappings.  Would be good to 
  define that in a single location.

Best regards,

Mike


> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Tuesday, March 15, 2022 5:23 AM
> To: devel@edk2.groups.io
> Cc: Lu, Xiaoyu1 <xiaoyu1.lu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Rebecca Cran <rebecca@bsdio.com>; James
> Bottomley <jejb@linux.ibm.com>; Sami Mujawar <Sami.Mujawar@arm.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Aktas,
> Erdem <erdemaktas@google.com>; Yao, Jiewen <jiewen.yao@intel.com>; Supreeth Venkatesh <supreeth.venkatesh@arm.com>; Boeuf,
> Sebastien <sebastien.boeuf@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Maciej
> Rabeda <maciej.rabeda@linux.intel.com>; Ma, Maurice <maurice.ma@intel.com>; Andrew Fish <afish@apple.com>; Ard Biesheuvel
> <ardb+tianocore@kernel.org>; Tom Lendacky <thomas.lendacky@amd.com>; Peter Grehan <grehan@freebsd.org>; Sean Brogan
> <sean.brogan@microsoft.com>; Jiang, Guomin <guomin.jiang@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Chen,
> Christine <yuwei.chen@intel.com>; You, Benjamin <benjamin.you@intel.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>; Gao,
> Liming <gaoliming@byosoft.com.cn>; Kinney, Michael D <michael.d.kinney@intel.com>; Xu, Wei6 <wei6.xu@intel.com>; Wang, Jian
> J <jian.j.wang@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Dong, Guo
> <guo.dong@intel.com>; kilian_kegel@hotmail.com; Chang, Abner <abner.chang@hpe.com>; Oliver Steffen <osteffen@redhat.com>;
> Leif Lindholm <quic_llindhol@quicinc.com>; Brijesh Singh <brijesh.singh@amd.com>; Xu, Min M <min.m.xu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>; Julien Grall <julien@xen.org>; Wang, Nickle
> <nickle.wang@hpe.com>; Pawel Polawski <ppolawsk@redhat.com>; Anthony Perard <anthony.perard@citrix.com>
> Subject: Re: [PATCH 0/3] [RFC] consolidate compiler intrinsics
> 
> On Tue, Mar 01, 2022 at 08:18:17AM +0100, Gerd Hoffmann wrote:
> > 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.
> 
> Ping.  How go forward with this?  I've posted it as RFC because
> I expected a more controversial discussion.  But seems everybody
> agrees this is a step into the right direction.
> 
> So just merge this as-is?
> 
> Yes, it passed CI (https://github.com/tianocore/edk2/pull/2542).
> 
> take care,
>   Gerd


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

* Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-15 12:22 ` Gerd Hoffmann
  2022-03-15 15:27   ` Michael D Kinney
@ 2022-03-15 17:08   ` Pedro Falcato
  2022-03-16 10:02     ` Gerd Hoffmann
  1 sibling, 1 reply; 16+ messages in thread
From: Pedro Falcato @ 2022-03-15 17:08 UTC (permalink / raw)
  To: edk2-devel-groups-io, kraxel
  Cc: Xiaoyu Lu, Bob Feng, Rebecca Cran, James Bottomley, Sami Mujawar,
	Jordan Justen, Erdem Aktas, Jiewen Yao, Supreeth Venkatesh,
	Sebastien Boeuf, Zhichao Gao, Zhiguang Liu, Maciej Rabeda,
	Maurice Ma, Andrew Fish, Ard Biesheuvel, Tom Lendacky,
	Peter Grehan, Sean Brogan, Guomin Jiang, Bret Barkelew,
	Yuwei Chen, Benjamin You, Daniel Schaefer, Liming Gao,
	Michael D Kinney, Wei6 Xu, Jian J Wang, Jiaxin Wu, Siyuan Fu,
	Guo Dong, kilian_kegel, Abner Chang, Oliver Steffen,
	Leif Lindholm, Brijesh Singh, Min Xu, Ray Ni, Alexei Fedorov,
	Julien Grall, Nickle Wang, Pawel Polawski, Anthony Perard

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

Gerd,

Have you considered just pulling in LLVM's compiler-rt builtins? It
implements essentially everything we'll ever need for a GNU-like toolchain,
for all the architectures we support, and also has unit tests (
https://github.com/llvm/llvm-project/tree/main/compiler-rt/test/builtins/Unit
).

I think it would be a good idea considering it's guaranteed to be correct
and always implements whatever clang requires (and AFAIK clang always
requires what gcc requires).

Best regards,
Pedro

On Tue, Mar 15, 2022 at 12:23 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Tue, Mar 01, 2022 at 08:18:17AM +0100, Gerd Hoffmann wrote:
> > 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.
>
> Ping.  How go forward with this?  I've posted it as RFC because
> I expected a more controversial discussion.  But seems everybody
> agrees this is a step into the right direction.
>
> So just merge this as-is?
>
> Yes, it passed CI (https://github.com/tianocore/edk2/pull/2542).
>
> take care,
>   Gerd
>
>
>
> 
>
>
>

-- 
Pedro Falcato

[-- Attachment #2: Type: text/html, Size: 2563 bytes --]

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

* Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-15 15:27   ` Michael D Kinney
@ 2022-03-16  9:45     ` Gerd Hoffmann
  2022-03-18  1:26       ` 回复: " gaoliming
  0 siblings, 1 reply; 16+ messages in thread
From: Gerd Hoffmann @ 2022-03-16  9:45 UTC (permalink / raw)
  To: devel, michael.d.kinney
  Cc: Sean Brogan, Lu, Xiaoyu1, Feng, Bob C, Rebecca Cran,
	James Bottomley, Sami Mujawar, Justen, Jordan L, Aktas, Erdem,
	Yao, Jiewen, Supreeth Venkatesh, Boeuf, Sebastien, Gao, Zhichao,
	Liu, Zhiguang, Maciej Rabeda, Ma, Maurice, Andrew Fish,
	Ard Biesheuvel, Tom Lendacky, Peter Grehan, Jiang, Guomin,
	Bret Barkelew, Chen, Christine, You, Benjamin, Schaefer, Daniel,
	Gao, Liming, Xu, Wei6, Wang, Jian J, Wu, Jiaxin, Fu, Siyuan,
	Dong, Guo, kilian_kegel@hotmail.com, Chang, Abner, Oliver Steffen,
	Leif Lindholm, Brijesh Singh, Xu, Min M, Ni, Ray, Alexei Fedorov,
	Julien Grall, Wang, Nickle, Pawel Polawski, Anthony Perard

On Tue, Mar 15, 2022 at 03:27:58PM +0000, Michael D Kinney wrote:
> Hi Gerd,
> 
> Thanks for working on this.  I raised this topic in the new TianoCore build and CI 
> meeting yesterday because the intrinsic libs are closely tied to the toolchains
> supported by TianoCore.
> 
> I agree with the concept of moving the compiler intrinsics to a library in the MdePkg.
> 
> + Sean Brogan
> 
> Sean mentioned that he has some addition work on intrinsic libs for Visual Studio
> toolchains.  It would be good to see if this set of changes is aligned with those
> efforts.

Having a single place where all compiler intrinsics are located should
simplify this kind of changes.

> I see a few items that might be good to clean up at some point
> * fltused should go into its own file.  Not related to the strcmp() API
> * I see size_t defined in multiple places using different mappings.  Would be good to 
>   define that in a single location.

Yes, sure.  Both are valid points.

I see this series as first step, consolidating the existing code in a
singe place with (almost) no actual code changes.  There surely will be
incremental improvements and cleanups later on.  I will need a few more
intrinsic functions when moving edk2 to openssl 3.0 for example.

take care,
  Gerd


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

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

On Tue, Mar 15, 2022 at 05:08:55PM +0000, Pedro Falcato wrote:
> Gerd,
> 
> Have you considered just pulling in LLVM's compiler-rt builtins? It
> implements essentially everything we'll ever need for a GNU-like toolchain,
> for all the architectures we support, and also has unit tests (
> https://github.com/llvm/llvm-project/tree/main/compiler-rt/test/builtins/Unit
> ).
> 
> I think it would be a good idea considering it's guaranteed to be correct
> and always implements whatever clang requires (and AFAIK clang always
> requires what gcc requires).

This is beyond the scope of this patch series, I want have a single
intrinsics lib for everybody as first step.

Using llvm's intrinsics certainly is an option for future improvements,
assuming it is ok license-wise (edk2 is bsd, llvm compiler-rt is apache,
as far I know they are compatible).

take care,
  Gerd


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

* 回复: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-16  9:45     ` [edk2-devel] " Gerd Hoffmann
@ 2022-03-18  1:26       ` gaoliming
  2022-03-18  1:54         ` Pedro Falcato
  0 siblings, 1 reply; 16+ messages in thread
From: gaoliming @ 2022-03-18  1:26 UTC (permalink / raw)
  To: 'Gerd Hoffmann', devel, michael.d.kinney
  Cc: 'Sean Brogan', 'Lu, Xiaoyu1',
	'Feng, Bob C', 'Rebecca Cran',
	'James Bottomley', 'Sami Mujawar',
	'Justen, Jordan L', 'Aktas, Erdem',
	'Yao, Jiewen', 'Supreeth Venkatesh',
	'Boeuf, Sebastien', 'Gao, Zhichao',
	'Liu, Zhiguang', 'Maciej Rabeda',
	'Ma, Maurice', 'Andrew Fish',
	'Ard Biesheuvel', 'Tom Lendacky',
	'Peter Grehan', 'Jiang, Guomin',
	'Bret Barkelew', 'Chen, Christine',
	'You, Benjamin', 'Schaefer, Daniel',
	'Xu, Wei6', 'Wang, Jian J', 'Wu, Jiaxin',
	'Fu, Siyuan', 'Dong, Guo', kilian_kegel,
	'Chang, Abner', 'Oliver Steffen',
	'Leif Lindholm', 'Brijesh Singh',
	'Xu, Min M', 'Ni, Ray', 'Alexei Fedorov',
	'Julien Grall', 'Wang, Nickle',
	'Pawel Polawski', 'Anthony Perard'

Gerd:
  I suggest to submit the different BZs for those tasks. This patch set is
the first stage. Future enhancement can be added later.

  If no more comment for the first stage, this patch set can be merged
first.

Thanks
Liming
> -----邮件原件-----
> 发件人: Gerd Hoffmann <kraxel@redhat.com>
> 发送时间: 2022年3月16日 17:46
> 收件人: devel@edk2.groups.io; michael.d.kinney@intel.com
> 抄送: Sean Brogan <sean.brogan@microsoft.com>; Lu, Xiaoyu1
> <xiaoyu1.lu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Rebecca Cran
> <rebecca@bsdio.com>; James Bottomley <jejb@linux.ibm.com>; Sami
> Mujawar <Sami.Mujawar@arm.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; Aktas, Erdem <erdemaktas@google.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Supreeth Venkatesh
> <supreeth.venkatesh@arm.com>; Boeuf, Sebastien
> <sebastien.boeuf@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Liu,
> Zhiguang <zhiguang.liu@intel.com>; Maciej Rabeda
> <maciej.rabeda@linux.intel.com>; Ma, Maurice <maurice.ma@intel.com>;
> Andrew Fish <afish@apple.com>; Ard Biesheuvel
> <ardb+tianocore@kernel.org>; Tom Lendacky <thomas.lendacky@amd.com>;
> Peter Grehan <grehan@freebsd.org>; Jiang, Guomin
> <guomin.jiang@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>;
> Chen, Christine <yuwei.chen@intel.com>; You, Benjamin
> <benjamin.you@intel.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>;
> Gao, Liming <gaoliming@byosoft.com.cn>; Xu, Wei6 <wei6.xu@intel.com>;
> Wang, Jian J <jian.j.wang@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>;
Fu,
> Siyuan <siyuan.fu@intel.com>; Dong, Guo <guo.dong@intel.com>;
> kilian_kegel@hotmail.com; Chang, Abner <abner.chang@hpe.com>; Oliver
> Steffen <osteffen@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>;
> Brijesh Singh <brijesh.singh@amd.com>; Xu, Min M <min.m.xu@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>;
> Julien Grall <julien@xen.org>; Wang, Nickle <nickle.wang@hpe.com>; Pawel
> Polawski <ppolawsk@redhat.com>; Anthony Perard
> <anthony.perard@citrix.com>
> 主题: Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
> 
> On Tue, Mar 15, 2022 at 03:27:58PM +0000, Michael D Kinney wrote:
> > Hi Gerd,
> >
> > Thanks for working on this.  I raised this topic in the new TianoCore
build
> and CI
> > meeting yesterday because the intrinsic libs are closely tied to the
> toolchains
> > supported by TianoCore.
> >
> > I agree with the concept of moving the compiler intrinsics to a library
in the
> MdePkg.
> >
> > + Sean Brogan
> >
> > Sean mentioned that he has some addition work on intrinsic libs for
Visual
> Studio
> > toolchains.  It would be good to see if this set of changes is aligned
with
> those
> > efforts.
> 
> Having a single place where all compiler intrinsics are located should
> simplify this kind of changes.
> 
> > I see a few items that might be good to clean up at some point
> > * fltused should go into its own file.  Not related to the strcmp() API
> > * I see size_t defined in multiple places using different mappings.
Would
> be good to
> >   define that in a single location.
> 
> Yes, sure.  Both are valid points.
> 
> I see this series as first step, consolidating the existing code in a
> singe place with (almost) no actual code changes.  There surely will be
> incremental improvements and cleanups later on.  I will need a few more
> intrinsic functions when moving edk2 to openssl 3.0 for example.
> 
> take care,
>   Gerd




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

* Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
  2022-03-18  1:26       ` 回复: " gaoliming
@ 2022-03-18  1:54         ` Pedro Falcato
  0 siblings, 0 replies; 16+ messages in thread
From: Pedro Falcato @ 2022-03-18  1:54 UTC (permalink / raw)
  To: edk2-devel-groups-io, Liming Gao
  Cc: Gerd Hoffmann, Kinney, Michael D, Sean Brogan, Lu, Xiaoyu1,
	Feng, Bob C, Rebecca Cran, James Bottomley, Sami Mujawar,
	Justen, Jordan L, Aktas, Erdem, Yao, Jiewen, Supreeth Venkatesh,
	Boeuf, Sebastien, Gao, Zhichao, Liu, Zhiguang, Maciej Rabeda,
	Ma, Maurice, Andrew Fish, Ard Biesheuvel, Tom Lendacky,
	Peter Grehan, Jiang, Guomin, Bret Barkelew, Chen, Christine,
	You, Benjamin, Schaefer, Daniel, Xu, Wei6, Wang, Jian J,
	Wu, Jiaxin, Fu, Siyuan, Dong, Guo, kilian_kegel, Chang, Abner,
	Oliver Steffen, Leif Lindholm, Brijesh Singh, Xu, Min M, Ni, Ray,
	Alexei Fedorov, Julien Grall, Wang, Nickle, Pawel Polawski,
	Anthony Perard

[-- Attachment #1: Type: text/plain, Size: 4145 bytes --]

Hi,

Something I've just noticed: edk2-libc also ships its own intrinsics (
https://github.com/tianocore/edk2-libc/blob/master/StdLib/LibC/CRT/Gcc.c)

I know edk2-libc is not part of the core edk2 repo but I think we should
keep this in mind when this patch set gets merged.

On Fri, Mar 18, 2022 at 1:27 AM gaoliming <gaoliming@byosoft.com.cn> wrote:

> Gerd:
>   I suggest to submit the different BZs for those tasks. This patch set is
> the first stage. Future enhancement can be added later.
>
>   If no more comment for the first stage, this patch set can be merged
> first.
>
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: Gerd Hoffmann <kraxel@redhat.com>
> > 发送时间: 2022年3月16日 17:46
> > 收件人: devel@edk2.groups.io; michael.d.kinney@intel.com
> > 抄送: Sean Brogan <sean.brogan@microsoft.com>; Lu, Xiaoyu1
> > <xiaoyu1.lu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Rebecca Cran
> > <rebecca@bsdio.com>; James Bottomley <jejb@linux.ibm.com>; Sami
> > Mujawar <Sami.Mujawar@arm.com>; Justen, Jordan L
> > <jordan.l.justen@intel.com>; Aktas, Erdem <erdemaktas@google.com>; Yao,
> > Jiewen <jiewen.yao@intel.com>; Supreeth Venkatesh
> > <supreeth.venkatesh@arm.com>; Boeuf, Sebastien
> > <sebastien.boeuf@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Liu,
> > Zhiguang <zhiguang.liu@intel.com>; Maciej Rabeda
> > <maciej.rabeda@linux.intel.com>; Ma, Maurice <maurice.ma@intel.com>;
> > Andrew Fish <afish@apple.com>; Ard Biesheuvel
> > <ardb+tianocore@kernel.org>; Tom Lendacky <thomas.lendacky@amd.com>;
> > Peter Grehan <grehan@freebsd.org>; Jiang, Guomin
> > <guomin.jiang@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>;
> > Chen, Christine <yuwei.chen@intel.com>; You, Benjamin
> > <benjamin.you@intel.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>;
> > Gao, Liming <gaoliming@byosoft.com.cn>; Xu, Wei6 <wei6.xu@intel.com>;
> > Wang, Jian J <jian.j.wang@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>;
> Fu,
> > Siyuan <siyuan.fu@intel.com>; Dong, Guo <guo.dong@intel.com>;
> > kilian_kegel@hotmail.com; Chang, Abner <abner.chang@hpe.com>; Oliver
> > Steffen <osteffen@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com
> >;
> > Brijesh Singh <brijesh.singh@amd.com>; Xu, Min M <min.m.xu@intel.com>;
> > Ni, Ray <ray.ni@intel.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>;
> > Julien Grall <julien@xen.org>; Wang, Nickle <nickle.wang@hpe.com>; Pawel
> > Polawski <ppolawsk@redhat.com>; Anthony Perard
> > <anthony.perard@citrix.com>
> > 主题: Re: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics
> >
> > On Tue, Mar 15, 2022 at 03:27:58PM +0000, Michael D Kinney wrote:
> > > Hi Gerd,
> > >
> > > Thanks for working on this.  I raised this topic in the new TianoCore
> build
> > and CI
> > > meeting yesterday because the intrinsic libs are closely tied to the
> > toolchains
> > > supported by TianoCore.
> > >
> > > I agree with the concept of moving the compiler intrinsics to a library
> in the
> > MdePkg.
> > >
> > > + Sean Brogan
> > >
> > > Sean mentioned that he has some addition work on intrinsic libs for
> Visual
> > Studio
> > > toolchains.  It would be good to see if this set of changes is aligned
> with
> > those
> > > efforts.
> >
> > Having a single place where all compiler intrinsics are located should
> > simplify this kind of changes.
> >
> > > I see a few items that might be good to clean up at some point
> > > * fltused should go into its own file.  Not related to the strcmp() API
> > > * I see size_t defined in multiple places using different mappings.
> Would
> > be good to
> > >   define that in a single location.
> >
> > Yes, sure.  Both are valid points.
> >
> > I see this series as first step, consolidating the existing code in a
> > singe place with (almost) no actual code changes.  There surely will be
> > incremental improvements and cleanups later on.  I will need a few more
> > intrinsic functions when moving edk2 to openssl 3.0 for example.
> >
> > take care,
> >   Gerd
>
>
>
>
>
> 
>
>
>

-- 
Pedro Falcato

[-- Attachment #2: Type: text/html, Size: 8033 bytes --]

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

end of thread, other threads:[~2022-03-18  1:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01  7:18 [PATCH 0/3] [RFC] consolidate compiler intrinsics Gerd Hoffmann
2022-03-01  7:18 ` [PATCH 1/3] MdePkg: promote CompilerIntrinsicsLib from ArmPkg to MdePkg Gerd Hoffmann
2022-03-01  7:18 ` [PATCH 2/3] MdePkg/CompilerIntrinsicsLib: fix msft sources for x64 Gerd Hoffmann
2022-03-01  7:18 ` [PATCH 3/3] MdePkg/CompilerIntrinsicsLib: move ia32 intrinsics and strcmp Gerd Hoffmann
2022-03-02  2:06 ` 回复: [edk2-devel] [PATCH 0/3] [RFC] consolidate compiler intrinsics gaoliming
2022-03-02  2:16   ` Yao, Jiewen
2022-03-02  8:39     ` Kilian Kegel
2022-03-02 10:10       ` Gerd Hoffmann
2022-03-02  6:12 ` Ard Biesheuvel
2022-03-15 12:22 ` Gerd Hoffmann
2022-03-15 15:27   ` Michael D Kinney
2022-03-16  9:45     ` [edk2-devel] " Gerd Hoffmann
2022-03-18  1:26       ` 回复: " gaoliming
2022-03-18  1:54         ` Pedro Falcato
2022-03-15 17:08   ` Pedro Falcato
2022-03-16 10:02     ` Gerd Hoffmann

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