summaryrefslogtreecommitdiffstats
path: root/ArmPkg
diff options
context:
space:
mode:
authorJeff Brasen <jbrasen@nvidia.com>2024-01-30 15:05:08 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-06-15 08:53:17 +0000
commitd8095b36abc521970dd930449a8ae8ddc431314c (patch)
treed4ba7144af32358ad9ac8a41c4d8c2a48070657d /ArmPkg
parenta84876ba283176eb683dc84274bc6c66faffc7a0 (diff)
downloadedk2-d8095b36abc521970dd930449a8ae8ddc431314c.tar.gz
edk2-d8095b36abc521970dd930449a8ae8ddc431314c.tar.bz2
edk2-d8095b36abc521970dd930449a8ae8ddc431314c.zip
ArmPkg/CompilerIntrinsicsLib: provide __ashlti3
The compiler will use this function if it is left shifting a 128 bit value. Seen when updating OpenSSL. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/CompilerIntrinsicsLib/AArch64/ashlti3.S33
-rw-r--r--ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf1
2 files changed, 34 insertions, 0 deletions
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/AArch64/ashlti3.S b/ArmPkg/Library/CompilerIntrinsicsLib/AArch64/ashlti3.S
new file mode 100644
index 0000000000..79a7b3514c
--- /dev/null
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/AArch64/ashlti3.S
@@ -0,0 +1,33 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#------------------------------------------------------------------------------
+
+#include <AsmMacroIoLib.h>
+
+ASM_FUNC(__ashlti3)
+ # return if shift is 0
+ cbz x2, 1f
+
+ mov x3, #64
+ sub x3, x3, x2
+ cmp x3, #0
+ b.le 2f
+
+ # shift is <= 64 bits
+ lsr x3, x0, x3
+ lsl x1, x1, x2
+ orr x1, x1, x3
+ lsl x0, x0, x2
+1:
+ ret
+
+2:
+ # shift is > 64
+ neg w3, w3
+ lsl x1, x0, x3
+ mov x0, #0
+ ret
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
index 7e22e6f67b..054e681307 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@@ -66,6 +66,7 @@
[Sources.AARCH64]
AArch64/Atomics.S | GCC
+ AArch64/ashlti3.S | GCC
[Packages]
MdePkg/MdePkg.dec