Skip to content

Commit fc8ed2f

Browse files
author
Raghuveer Devulapalli
committed
Define LIKELY and UNLIKELY macros for MSVC
1 parent 8bdea10 commit fc8ed2f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/avx512-common-qsort.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@
6767
#define ZMM_MAX_INT16 _mm512_set1_epi16(X86_SIMD_SORT_MAX_INT16)
6868
#define SHUFFLE_MASK(a, b, c, d) (a << 6) | (b << 4) | (c << 2) | d
6969

70+
/* Compiler specific macros specific */
7071
#ifdef _MSC_VER
7172
#define X86_SIMD_SORT_INLINE static inline
7273
#define X86_SIMD_SORT_FINLINE static __forceinline
74+
#define LIKELY(x)
75+
#define UNLIKELY(x)
7376
#elif defined(__CYGWIN__)
7477
/*
7578
* Force inline in cygwin to work around a compiler bug. See
@@ -80,13 +83,15 @@
8083
#elif defined(__GNUC__)
8184
#define X86_SIMD_SORT_INLINE static inline
8285
#define X86_SIMD_SORT_FINLINE static __attribute__((always_inline))
86+
#define LIKELY(x) __builtin_expect((x), 1)
87+
#define UNLIKELY(x) __builtin_expect((x), 0)
8388
#else
8489
#define X86_SIMD_SORT_INLINE static
8590
#define X86_SIMD_SORT_FINLINE static
91+
#define LIKELY(x)
92+
#define UNLIKELY(x)
8693
#endif
8794

88-
#define LIKELY(x) __builtin_expect((x), 1)
89-
#define UNLIKELY(x) __builtin_expect((x), 0)
9095
#if __GNUC__ >= 8
9196
#define X86_SIMD_SORT_UNROLL_LOOP(num)\
9297
GCC unroll num

0 commit comments

Comments
 (0)