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