• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#include <AsmMacroIoLib.h>
16
17ASM_FUNC(__clzsi2)
18  @ frame_needed = 1, uses_anonymous_args = 0
19  stmfd  sp!, {r7, lr}
20  add  r7, sp, #0
21  movs  r3, r0, lsr #16
22  movne  r3, #16
23  moveq  r3, #0
24  movne  r9, #0
25  moveq  r9, #16
26  mov  r3, r0, lsr r3
27  tst  r3, #65280
28  movne  r0, #8
29  moveq  r0, #0
30  movne  lr, #0
31  moveq  lr, #8
32  mov  r3, r3, lsr r0
33  tst  r3, #240
34  movne  r0, #4
35  moveq  r0, #0
36  movne  ip, #0
37  moveq  ip, #4
38  mov  r3, r3, lsr r0
39  tst  r3, #12
40  movne  r0, #2
41  moveq  r0, #0
42  movne  r1, #0
43  moveq  r1, #2
44  mov  r2, r3, lsr r0
45  add  r3, lr, r9
46  add  r0, r3, ip
47  add  r1, r0, r1
48  mov  r0, r2, lsr #1
49  eor  r0, r0, #1
50  ands  r0, r0, #1
51  mvnne  r0, #0
52  rsb  r3, r2, #2
53  and  r0, r0, r3
54  add  r0, r1, r0
55  ldmfd  sp!, {r7, pc}
56