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 #if defined(__INTEL_COMPILER) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && \
51 (defined(__BMI__) || !defined(__clang__)))
52 # define ff_ctz(v) _tzcnt_u32(v)
55 # define ff_ctzll(v) _tzcnt_u64(v)
57 # define ff_ctzll ff_ctzll_x86
60 return ((uint32_t)v == 0) ? _tzcnt_u32((uint32_t)(v >> 32)) + 32 : _tzcnt_u32((uint32_t)v);
74 #if defined(__POPCNT__)
75 #define av_popcount __builtin_popcount
77 #define av_popcount64 __builtin_popcountll
84 #if AV_GCC_VERSION_AT_LEAST(5,1)
85 #define av_mod_uintp2 __builtin_ia32_bzhi_si
90 #define av_mod_uintp2 av_mod_uintp2_bmi2
94 return a & ((1 << p) - 1);
97 __asm__ (
"bzhi %2, %1, %0 \n\t" :
"=r"(x) :
"rm"(
a),
"r"(p));
105 #if defined(__SSE2__) && !defined(__INTEL_COMPILER)
107 #define av_clipd av_clipd_sse2
110 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
111 if (amin > amax) abort();
115 :
"+&x"(
a) :
"xm"(amin),
"xm"(amax));
121 #if defined(__SSE__) && !defined(__INTEL_COMPILER)
123 #define av_clipf av_clipf_sse
126 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
127 if (amin > amax) abort();
131 :
"+&x"(
a) :
"xm"(amin),
"xm"(amax));
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
#define av_builtin_constant_p