From c94cf3b8885c8a9e192b95125ce4b8470a1aa3c3 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 8 Jan 2012 00:22:58 +0100 Subject: Move optimized ffs to firmware/asm, using the new automatic-asm-picking infrastructure. Change-Id: I5e7bdc8be7de50ef604c16078857fff1b84650dc --- firmware/target/coldfire/ffs-coldfire.S | 65 --------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 firmware/target/coldfire/ffs-coldfire.S (limited to 'firmware/target/coldfire') diff --git a/firmware/target/coldfire/ffs-coldfire.S b/firmware/target/coldfire/ffs-coldfire.S deleted file mode 100644 index 40a7297802..0000000000 --- a/firmware/target/coldfire/ffs-coldfire.S +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 by Michael Sevakis - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - #include "config.h" - -/**************************************************************************** - * int find_first_set_bit(uint32_t val); - * - * Find the index of the least significant set bit in the 32-bit word. - * - * return values: - * 0 - bit 0 is set - * 1 - bit 1 is set - * ... - * 31 - bit 31 is set - * 32 - no bits set - ****************************************************************************/ - .text - .align 2 - .global find_first_set_bit - .type find_first_set_bit,@function -find_first_set_bit: - | this is a coldfire version of the ffs algorithm devised by D.Seal - | and posted to comp.sys.arm on 16 Feb 1994. - | - | Output modified to suit rockbox purposes. - - | Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry - move.l 4(%sp), %d1 | %d1 = %d1 & -%d1 - lea.l L_ffs_table, %a0 | %a0 = table address - move.l %d1, %d0 | - neg.l %d1 | - and.l %d0, %d1 | - - | now %d1 has at most one set bit, call this X - - move.l #0x0450fbaf, %d0 | %d0 = multiplier - mulu.l %d0, %d1 | %d1 = X * 0x0450fbaf - - | now lookup in table indexed on top 6 bits of %d0 - moveq.l #26, %d0 | %d0 = final shift count - lsr.l %d0, %d1 | - - | the top 24 bits of d0 are 0 so just load the value over it - move.b (%a0, %d1.l), %d0 | - rts | - - .size find_first_set_bit, .-find_first_set_bit -- cgit v1.2.3