aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/alpha/ffs.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/alpha/ffs.S')
-rw-r--r--sysdeps/alpha/ffs.S67
1 files changed, 33 insertions, 34 deletions
diff --git a/sysdeps/alpha/ffs.S b/sysdeps/alpha/ffs.S
index 959d1046d4..23dff6e06b 100644
--- a/sysdeps/alpha/ffs.S
+++ b/sysdeps/alpha/ffs.S
@@ -1,30 +1,29 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Contributed by David Mosberger (davidm@cs.arizona.edu).
+ This file is part of the GNU C Library.
-This file is part of the GNU C Library.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* Finds the first bit set in an integer. Optimized for the Alpha
-architecture. */
+ architecture. */
#include <sysdep.h>
- .set noreorder
- .set noat
+ .set noreorder
+ .set noat
ENTRY(ffs)
#ifdef PROF
@@ -38,36 +37,36 @@ ENTRY(ffs)
ldq_u zero, 0(sp) # on the 21064, this helps dual-issuing
addl a0, zero, a0 # the last insn and reduces the stall
- negq a0, t0 # due to the srl instruction
- and a0, t0, t0
+ negq a0, t0 # due to the srl instruction
+ and a0, t0, t0
clr v0
beq a0, $done
# now do binary search for first non-zero bit
zapnot t0, 0x03, t2
- addq v0, 16, t3
- cmoveq t2, t3, v0
+ addq v0, 16, t3
+ cmoveq t2, t3, v0
zapnot t0, 0x05, t2
- addq v0, 8, t3
- cmoveq t2, t3, v0
+ addq v0, 8, t3
+ cmoveq t2, t3, v0
srl t0, v0, t0
addq v0, 1, v0
- and t0, 0x0f, t2
- addq v0, 4, t3
- cmoveq t2, t3, v0
+ and t0, 0x0f, t2
+ addq v0, 4, t3
+ cmoveq t2, t3, v0
- and t0, 0x33, t2
- addq v0, 2, t3
- cmoveq t2, t3, v0
+ and t0, 0x33, t2
+ addq v0, 2, t3
+ cmoveq t2, t3, v0
- and t0, 0x55, t2
- addq v0, 1, t3
- cmoveq t2, t3, v0
+ and t0, 0x55, t2
+ addq v0, 1, t3
+ cmoveq t2, t3, v0
$done: ret
- END(ffs)
+ END(ffs)