summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/s390/Kconfig7
-rw-r--r--arch/s390/include/asm/bitops.h8
2 files changed, 15 insertions, 0 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index bf680c26a33c..22862ce7ec68 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -49,6 +49,13 @@ config KASAN_SHADOW_OFFSET
depends on KASAN
default 0x1C000000000000
+config CC_HAS_BUILTIN_FFS
+ def_bool !(CC_IS_GCC && GCC_VERSION < 160000)
+ help
+ GCC versions before 16.0.0 generate library calls to ffs()
+ for __builtin_ffs() even when __has_builtin(__builtin_ffs)
+ is true.
+
config CC_ASM_FLAG_OUTPUT_BROKEN
def_bool CC_IS_GCC && GCC_VERSION < 140200
help
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 8b9060c26c52..1564dd3a5a82 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -122,6 +122,8 @@ static inline bool test_bit_inv(unsigned long nr,
return test_bit(nr ^ (BITS_PER_LONG - 1), ptr);
}
+#ifndef CONFIG_CC_HAS_BUILTIN_FFS
+
/**
* __flogr - find leftmost one
* @word - The word to search
@@ -194,6 +196,12 @@ static __always_inline __flatten int ffs(int word)
return BITS_PER_LONG - __flogr(-val & val);
}
+#else /* CONFIG_CC_HAS_BUILTIN_FFS */
+
+#include <asm-generic/bitops/builtin-ffs.h>
+
+#endif /* CONFIG_CC_HAS_BUILTIN_FFS */
+
#include <asm-generic/bitops/builtin-__ffs.h>
#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/builtin-__fls.h>