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