]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
3d9025ad1acf6bcc8eaf6ba57186eeb9a6150e67
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / Arm / ctzsi2.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 \s\s.text
16 \s\s.align 2
17 \s\sGCC_ASM_EXPORT(__ctzsi2)
18 \s\s
19 ASM_PFX(__ctzsi2):
20 \s\suxth\s\sr3, r0
21 \s\scmp\s\sr3, #0
22 \s\smoveq\s\sip, #16
23 \s\smovne\s\sip, #0
24 \s\s@ lr needed for prologue
25 \s\smov\s\sr0, r0, lsr ip
26 \s\stst\s\sr0, #255
27 \s\smovne\s\sr3, #0
28 \s\smoveq\s\sr3, #8
29 \s\smov\s\sr0, r0, lsr r3
30 \s\stst\s\sr0, #15
31 \s\smovne\s\sr1, #0
32 \s\smoveq\s\sr1, #4
33 \s\sadd\s\sr3, r3, ip
34 \s\smov\s\sr0, r0, lsr r1
35 \s\stst\s\sr0, #3
36 \s\smovne\s\sr2, #0
37 \s\smoveq\s\sr2, #2
38 \s\sadd\s\sr3, r3, r1
39 \s\smov\s\sr0, r0, lsr r2
40 \s\sand\s\sr0, r0, #3
41 \s\sadd\s\sr2, r3, r2
42 \s\seor\s\sr3, r0, #1
43 \s\smov\s\sr0, r0, lsr #1
44 \s\sands\s\sr3, r3, #1
45 \s\smvnne\s\sr3, #0
46 \s\srsb\s\sr0, r0, #2
47 \s\sand\s\sr0, r3, r0
48 \s\sadd\s\sr0, r2, r0
49 \s\sbx\s\slr