From: "Jeff Brasen via groups.io" <jbrasen=nvidia.com@groups.io>
To: <devel@edk2.groups.io>
Cc: <ardb+tianocore@kernel.org>, <quic_llindhol@quicinc.com>,
<sami.mujawar@arm.com>, Jeff Brasen <jbrasen@nvidia.com>
Subject: [edk2-devel] [PATCH 1/1] ArmPkg/CompilerIntrinsicsLib: provide __ashlti3
Date: Wed, 31 Jan 2024 18:05:28 -0800 [thread overview]
Message-ID: <94947568d9796a588337b287055f7fb84f359d97.1706753064.git.jbrasen@nvidia.com> (raw)
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]
-=-=-=-=-=-=-=-=-=-=-=-
next reply other threads:[~2024-02-01 2:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 2:05 Jeff Brasen via groups.io [this message]
2024-02-02 17:26 ` [edk2-devel] [PATCH 1/1] ArmPkg/CompilerIntrinsicsLib: provide __ashlti3 Ard Biesheuvel
2024-02-02 17:44 ` Jeff Brasen via groups.io
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=94947568d9796a588337b287055f7fb84f359d97.1706753064.git.jbrasen@nvidia.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox