From: Uros Bizjak Date: Tue, 25 Mar 2025 17:52:01 +0000 (+0100) Subject: x86/bitops: Use TZCNT mnemonic in X-Git-Tag: v6.16-rc1~195^2~32^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0717b1392dc7e3f350e5a5d25ea794aa92210684;p=thirdparty%2Fkernel%2Flinux.git x86/bitops: Use TZCNT mnemonic in Current minimum required version of binutils is 2.25, which supports TZCNT instruction mnemonic. Replace "REP; BSF" in variable__{ffs,ffz}() function with this proper mnemonic. No functional change intended. Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Cc: Andy Lutomirski Cc: Brian Gerst Cc: Juergen Gross Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Josh Poimboeuf Link: https://lore.kernel.org/r/20250325175215.330659-1-ubizjak@gmail.com --- diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 100413aff6402..bbaf75ea6703b 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h @@ -248,7 +248,7 @@ arch_test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) static __always_inline unsigned long variable__ffs(unsigned long word) { - asm("rep; bsf %1,%0" + asm("tzcnt %1,%0" : "=r" (word) : ASM_INPUT_RM (word)); return word; @@ -267,7 +267,7 @@ static __always_inline unsigned long variable__ffs(unsigned long word) static __always_inline unsigned long variable_ffz(unsigned long word) { - asm("rep; bsf %1,%0" + asm("tzcnt %1,%0" : "=r" (word) : "r" (~word)); return word;