]>
Commit | Line | Data |
---|---|---|
1 | #------------------------------------------------------------------------------\r | |
2 | #\r | |
3 | # Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r | |
4 | #\r | |
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | #\r | |
7 | #------------------------------------------------------------------------------\r | |
8 | \r | |
9 | #include <AsmMacroIoLib.h>\r | |
10 | \r | |
11 | ASM_FUNC(__ctzsi2)\r | |
12 | uxth r3, r0\r | |
13 | cmp r3, #0\r | |
14 | moveq ip, #16\r | |
15 | movne ip, #0\r | |
16 | @ lr needed for prologue\r | |
17 | mov r0, r0, lsr ip\r | |
18 | tst r0, #255\r | |
19 | movne r3, #0\r | |
20 | moveq r3, #8\r | |
21 | mov r0, r0, lsr r3\r | |
22 | tst r0, #15\r | |
23 | movne r1, #0\r | |
24 | moveq r1, #4\r | |
25 | add r3, r3, ip\r | |
26 | mov r0, r0, lsr r1\r | |
27 | tst r0, #3\r | |
28 | movne r2, #0\r | |
29 | moveq r2, #2\r | |
30 | add r3, r3, r1\r | |
31 | mov r0, r0, lsr r2\r | |
32 | and r0, r0, #3\r | |
33 | add r2, r3, r2\r | |
34 | eor r3, r0, #1\r | |
35 | mov r0, r0, lsr #1\r | |
36 | ands r3, r3, #1\r | |
37 | mvnne r3, #0\r | |
38 | rsb r0, r0, #2\r | |
39 | and r0, r3, r0\r | |
40 | add r0, r2, r0\r | |
41 | bx lr\r |