Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323955
b: refs/heads/master
c: e26a44a
h: refs/heads/master
i:
  323953: e54de66
  323951: 123c334
v: v3
  • Loading branch information
Jan Beulich authored and Ingo Molnar committed Sep 19, 2012
1 parent 91b867f commit fe9aa37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5870661c091e827973674cc3469b50c959008c2b
refs/heads/master: e26a44a2d618a491d5c6a2a8aaf66ee03a94739f
19 changes: 2 additions & 17 deletions trunk/arch/x86/include/asm/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,19 +347,6 @@ static int test_bit(int nr, const volatile unsigned long *addr);
? constant_test_bit((nr), (addr)) \
: variable_test_bit((nr), (addr)))

#if (defined(CONFIG_X86_GENERIC) || defined(CONFIG_GENERIC_CPU)) \
&& !defined(CONFIG_CC_OPTIMIZE_FOR_SIZE)
/*
* Since BSF and TZCNT have sufficiently similar semantics for the purposes
* for which we use them here, BMI-capable hardware will decode the prefixed
* variant as 'tzcnt ...' and may execute that faster than 'bsf ...', while
* older hardware will ignore the REP prefix and decode it as 'bsf ...'.
*/
# define BSF_PREFIX "rep;"
#else
# define BSF_PREFIX
#endif

/**
* __ffs - find first set bit in word
* @word: The word to search
Expand All @@ -368,7 +355,7 @@ static int test_bit(int nr, const volatile unsigned long *addr);
*/
static inline unsigned long __ffs(unsigned long word)
{
asm(BSF_PREFIX "bsf %1,%0"
asm("rep; bsf %1,%0"
: "=r" (word)
: "rm" (word));
return word;
Expand All @@ -382,14 +369,12 @@ static inline unsigned long __ffs(unsigned long word)
*/
static inline unsigned long ffz(unsigned long word)
{
asm(BSF_PREFIX "bsf %1,%0"
asm("rep; bsf %1,%0"
: "=r" (word)
: "r" (~word));
return word;
}

#undef BSF_PREFIX

/*
* __fls: find last set bit in word
* @word: The word to search
Expand Down

0 comments on commit fe9aa37

Please sign in to comment.