arm: use optimized find_first_set_bit() on Cortex-M

Use the optimized version based on __buitlin_ctz() which GCC
will compile to two instructions (rbit, ctz) on Cortex-M4/M7;
faster and smaller than the handcoded assembly version.

Change-Id: I33f69ff829b048f1e53fc7ead1bd6ac3c5bd7a4c
This commit is contained in:
Aidan MacDonald 2025-12-30 15:15:24 +00:00 committed by Solomon Peachy
parent 4ceb9e22d6
commit 20d31c114a

View file

@ -163,7 +163,8 @@ int get_cpu_boost_counter(void);
#endif
/* returns index of first set bit or 32 if no bits are set */
#if defined(CPU_ARM) && ARM_ARCH >= 5 && !defined(__thumb__)
#if (defined(CPU_ARM) && ARM_ARCH >= 5 && !defined(__thumb__)) || \
defined(CPU_ARM_MICRO)
static inline int find_first_set_bit(uint32_t val)
{ return LIKELY(val) ? __builtin_ctz(val) : 32; }
#else