21 #ifndef AVUTIL_X86_INTMATH_H
22 #define AVUTIL_X86_INTMATH_H
29 #elif defined(__INTEL_COMPILER)
30 #include <immintrin.h>
36 #if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER>=1216)) || defined(_MSC_VER)
37 # if defined(__INTEL_COMPILER)
38 # define ff_log2(x) (_bit_scan_reverse((x)|1))
40 # define ff_log2 ff_log2_x86
44 _BitScanReverse(&n, v|1);
48 # define ff_log2_16bit av_log2
50 # define ff_ctz(v) _tzcnt_u32(v)
53 # define ff_ctzll(v) _tzcnt_u64(v)
55 # define ff_ctzll ff_ctzll_x86
58 return ((uint32_t)v == 0) ? _tzcnt_u32((uint32_t)(v >> 32)) + 32 : _tzcnt_u32((uint32_t)v);
71 #if defined(__POPCNT__)
72 #define av_popcount __builtin_popcount
74 #define av_popcount64 __builtin_popcountll
81 #if AV_GCC_VERSION_AT_LEAST(5,1)
82 #define av_mod_uintp2 __builtin_ia32_bzhi_si
87 #define av_mod_uintp2 av_mod_uintp2_bmi2
91 return a & ((1 << p) - 1);
94 __asm__ (
"bzhi %2, %1, %0 \n\t" :
"=r"(x) :
"rm"(a),
"r"(p));
102 #if defined(__SSE2__) && !defined(__INTEL_COMPILER)
104 #define av_clipd av_clipd_sse2
107 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
108 if (amin > amax) abort();
110 __asm__ (
"minsd %2, %0 \n\t"
112 :
"+&x"(a) :
"xm"(amin),
"xm"(amax));
118 #if defined(__SSE__) && !defined(__INTEL_COMPILER)
120 #define av_clipf av_clipf_sse
123 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
124 if (amin > amax) abort();
126 __asm__ (
"minss %2, %0 \n\t"
128 :
"+&x"(a) :
"xm"(amin),
"xm"(amax));
#define av_builtin_constant_p