public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH 1/1] ArmPkg/CompilerIntrinsicsLib: provide __ashlti3
@ 2024-02-01  2:05 Jeff Brasen via groups.io
  2024-02-02 17:26 ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Brasen via groups.io @ 2024-02-01  2:05 UTC (permalink / raw)
  To: devel; +Cc: ardb+tianocore, quic_llindhol, sami.mujawar, Jeff Brasen

The compiler will use this function if it is left shifting a 128 bit
value.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 .../CompilerIntrinsicsLib.inf                 |  1 +
 .../CompilerIntrinsicsLib/AArch64/ashlti3.S   | 33 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/AArch64/ashlti3.S

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
index 7e22e6f67bff..054e68130730 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@@ -66,6 +66,7 @@ [Sources.ARM]
 
 [Sources.AARCH64]
   AArch64/Atomics.S    | GCC
+  AArch64/ashlti3.S    | GCC
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/AArch64/ashlti3.S b/ArmPkg/Library/CompilerIntrinsicsLib/AArch64/ashlti3.S
new file mode 100644
index 000000000000..79a7b3514c57
--- /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
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114926): https://edk2.groups.io/g/devel/message/114926
Mute This Topic: https://groups.io/mt/104088827/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2024-02-02 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01  2:05 [edk2-devel] [PATCH 1/1] ArmPkg/CompilerIntrinsicsLib: provide __ashlti3 Jeff Brasen via groups.io
2024-02-02 17:26 ` Ard Biesheuvel
2024-02-02 17:44   ` Jeff Brasen via groups.io

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