Presumably because gcc can't generate bt... whether or not it is worth it is another matter.
On August 30, 2015 11:05:49 PM PDT, Ingo Molnar <mi...@kernel.org> wrote: > >* Michael S. Tsirkin <m...@redhat.com> wrote: > >> +static __always_inline int __constant_test_bit(long nr, const >unsigned long *addr) >> +{ >> + return ((1UL << (nr & (BITS_PER_LONG-1))) & >> + (addr[nr >> _BITOPS_LONG_SHIFT])) != 0; >> +} >> + >> +static inline int __variable_test_bit(long nr, const unsigned long >*addr) >> +{ >> + int oldbit; >> + >> + asm volatile("bt %2,%1\n\t" >> + "sbb %0,%0" >> + : "=r" (oldbit) >> + : "m" (*addr), "Ir" (nr)); >> + >> + return oldbit; >> +} > >Color me confused, why use assembly for this at all? > >Why not just use C for testing the bit (i.e. turn __constant_test_bit() >into >__test_bit()) - that would also allow the compiler to propagate the >result, >potentially more optimally than we can do it via SBB... > >Thanks, > > Ingo -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/