[haiku-commits] Re: BRANCH pdziepak-github.scheduler [8ec8973] src/system/kernel/arch/x86 headers/private/kernel src/system/boot/platform/bios_ia32 src/add-ons/kernel src/system/kernel/arch/x86/32

  • From: Pawel Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 2 Oct 2013 21:33:39 +0200

2013/10/2 pulkomandy <pulkomandy@xxxxxxxxxxxxx>:
> On Wed, Oct 02, 2013 at 09:01:50PM +0200, Pawel Dziepak wrote:
>> I am going to, as Axel suggested, move those functions to kernel/util
>> since it is not the first place in the kernel when they are used (and
>> certainly not the last). However, I don't really think that
>> unconditional use of builtins is a good idea.
>
> Of course. It's worth checking on each architecture to know if we should
> enable them. For example, the x86_64 compiler can use most SSE
> instructions without checking if they are available first.

bsr (i.e. __builtin_clz) is available at least since 386 and it is
still slower than the C implemenation. popcnt (i.e.
__builtin_popcount) is introduced in SSE4 so even on x86_64 we can't
be sure that it is present.

Obviously, the situation may look different on the non-x86
architectures but I think they have more important problems at the
moment than optimizing bit hacks.

Paweł

Other related posts: