28 #ifndef VC_COMMON_BITSCANINTRINSICS_H_
29 #define VC_COMMON_BITSCANINTRINSICS_H_
31 #if defined(Vc_GCC) || defined(Vc_CLANG) || defined(Vc_APPLECLANG)
32 # if Vc_GCC >= 0x40500
34 # include <x86intrin.h>
37 # define _bit_scan_forward(x) __builtin_ctz(x)
39 static Vc_ALWAYS_INLINE Vc_CONST
int _Vc_bit_scan_reverse_asm(
unsigned int x) {
41 __asm__(
"bsr %1,%0" :
"=r"(r) :
"X"(x));
44 # define _bit_scan_reverse(x) _Vc_bit_scan_reverse_asm(x)
48 static inline __forceinline
unsigned long _bit_scan_forward(
unsigned long x) {
50 _BitScanForward(&index, x);
53 static inline __forceinline
unsigned long _bit_scan_reverse(
unsigned long x) {
55 _BitScanReverse(&index, x);
65 #endif // VC_COMMON_BITSCANINTRINSICS_H_