• 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(__ctzsi2)
18  uxth  r3, r0
19  cmp  r3, #0
20  moveq  ip, #16
21  movne  ip, #0
22  @ lr needed for prologue
23  mov  r0, r0, lsr ip
24  tst  r0, #255
25  movne  r3, #0
26  moveq  r3, #8
27  mov  r0, r0, lsr r3
28  tst  r0, #15
29  movne  r1, #0
30  moveq  r1, #4
31  add  r3, r3, ip
32  mov  r0, r0, lsr r1
33  tst  r0, #3
34  movne  r2, #0
35  moveq  r2, #2
36  add  r3, r3, r1
37  mov  r0, r0, lsr r2
38  and  r0, r0, #3
39  add  r2, r3, r2
40  eor  r3, r0, #1
41  mov  r0, r0, lsr #1
42  ands  r3, r3, #1
43  mvnne  r3, #0
44  rsb  r0, r0, #2
45  and  r0, r3, r0
46  add  r0, r2, r0
47  bx  lr
48