]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
ArmPkg/CompilerIntrinsicsLib: switch to ASM_FUNC() asm macro
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / Arm / clzsi2.S
CommitLineData
3402aac7 1#------------------------------------------------------------------------------\r
1e57a462 2#\r
3# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
4#\r
5# This program and the accompanying materials\r
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12#\r
13#------------------------------------------------------------------------------\r
14\r
903e3124 15#include <AsmMacroIoLib.h>\r
1e57a462 16\r
903e3124 17ASM_FUNC(__clzsi2)\r
1e57a462 18 @ frame_needed = 1, uses_anonymous_args = 0\r
19 stmfd sp!, {r7, lr}\r
20 add r7, sp, #0\r
21 movs r3, r0, lsr #16\r
22 movne r3, #16\r
23 moveq r3, #0\r
24 movne r9, #0\r
25 moveq r9, #16\r
26 mov r3, r0, lsr r3\r
27 tst r3, #65280\r
28 movne r0, #8\r
29 moveq r0, #0\r
30 movne lr, #0\r
31 moveq lr, #8\r
32 mov r3, r3, lsr r0\r
33 tst r3, #240\r
34 movne r0, #4\r
35 moveq r0, #0\r
36 movne ip, #0\r
37 moveq ip, #4\r
38 mov r3, r3, lsr r0\r
39 tst r3, #12\r
40 movne r0, #2\r
41 moveq r0, #0\r
42 movne r1, #0\r
43 moveq r1, #2\r
44 mov r2, r3, lsr r0\r
45 add r3, lr, r9\r
46 add r0, r3, ip\r
47 add r1, r0, r1\r
48 mov r0, r2, lsr #1\r
49 eor r0, r0, #1\r
50 ands r0, r0, #1\r
51 mvnne r0, #0\r
52 rsb r3, r2, #2\r
53 and r0, r0, r3\r
54 add r0, r1, r0\r
55 ldmfd sp!, {r7, pc}\r