Coverage Report

Created: 2026-07-25 07:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libvpx/vpx_ports/x86.h
Line
Count
Source
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
 *  that can be found in the LICENSE file in the root of the source
6
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
9
 */
10
11
#ifndef VPX_VPX_PORTS_X86_H_
12
#define VPX_VPX_PORTS_X86_H_
13
#include <stdlib.h>
14
15
#if defined(_MSC_VER)
16
#include <intrin.h> /* For __cpuidex, __rdtsc */
17
#endif
18
19
#include "vpx_config.h"
20
#include "vpx/vpx_integer.h"
21
22
#ifdef __cplusplus
23
extern "C" {
24
#endif
25
26
typedef enum {
27
  VPX_CPU_UNKNOWN = -1,
28
  VPX_CPU_AMD,
29
  VPX_CPU_AMD_OLD,
30
  VPX_CPU_CENTAUR,
31
  VPX_CPU_CYRIX,
32
  VPX_CPU_INTEL,
33
  VPX_CPU_NEXGEN,
34
  VPX_CPU_NSC,
35
  VPX_CPU_RISE,
36
  VPX_CPU_SIS,
37
  VPX_CPU_TRANSMETA,
38
  VPX_CPU_TRANSMETA_OLD,
39
  VPX_CPU_UMC,
40
  VPX_CPU_VIA,
41
42
  VPX_CPU_LAST
43
} vpx_cpu_t;
44
45
#if defined(__GNUC__) || defined(__ANDROID__)
46
#if VPX_ARCH_X86_64
47
#define cpuid(func, func2, ax, bx, cx, dx)                      \
48
36
  __asm__ __volatile__("cpuid           \n\t"                   \
49
36
                       : "=a"(ax), "=b"(bx), "=c"(cx), "=d"(dx) \
50
36
                       : "a"(func), "c"(func2))
51
#else
52
#define cpuid(func, func2, ax, bx, cx, dx)     \
53
  __asm__ __volatile__(                        \
54
      "mov %%ebx, %%edi   \n\t"                \
55
      "cpuid              \n\t"                \
56
      "xchg %%edi, %%ebx  \n\t"                \
57
      : "=a"(ax), "=D"(bx), "=c"(cx), "=d"(dx) \
58
      : "a"(func), "c"(func2))
59
#endif
60
#elif defined(__SUNPRO_C) || \
61
    defined(__SUNPRO_CC) /* end __GNUC__ or __ANDROID__*/
62
#if VPX_ARCH_X86_64
63
#define cpuid(func, func2, ax, bx, cx, dx)     \
64
  asm volatile(                                \
65
      "xchg %rsi, %rbx \n\t"                   \
66
      "cpuid           \n\t"                   \
67
      "movl %ebx, %edi \n\t"                   \
68
      "xchg %rsi, %rbx \n\t"                   \
69
      : "=a"(ax), "=D"(bx), "=c"(cx), "=d"(dx) \
70
      : "a"(func), "c"(func2))
71
#else
72
#define cpuid(func, func2, ax, bx, cx, dx)     \
73
  asm volatile(                                \
74
      "pushl %ebx       \n\t"                  \
75
      "cpuid            \n\t"                  \
76
      "movl %ebx, %edi  \n\t"                  \
77
      "popl %ebx        \n\t"                  \
78
      : "=a"(ax), "=D"(bx), "=c"(cx), "=d"(dx) \
79
      : "a"(func), "c"(func2))
80
#endif
81
#else /* end __SUNPRO__ */
82
#if VPX_ARCH_X86_64
83
#if defined(_MSC_VER) && _MSC_VER > 1500
84
#define cpuid(func, func2, a, b, c, d) \
85
  do {                                 \
86
    int regs[4];                       \
87
    __cpuidex(regs, func, func2);      \
88
    a = regs[0];                       \
89
    b = regs[1];                       \
90
    c = regs[2];                       \
91
    d = regs[3];                       \
92
  } while (0)
93
#else
94
#define cpuid(func, func2, a, b, c, d) \
95
  do {                                 \
96
    int regs[4];                       \
97
    __cpuid(regs, func);               \
98
    a = regs[0];                       \
99
    b = regs[1];                       \
100
    c = regs[2];                       \
101
    d = regs[3];                       \
102
  } while (0)
103
#endif
104
#else
105
#define cpuid(func, func2, a, b, c, d)                              \
106
  __asm mov eax, func __asm mov ecx, func2 __asm cpuid __asm mov a, \
107
      eax __asm mov b, ebx __asm mov c, ecx __asm mov d, edx
108
#endif
109
#endif /* end others */
110
111
// NaCl has no support for xgetbv or the raw opcode.
112
#if !defined(__native_client__) && (defined(__i386__) || defined(__x86_64__))
113
12
static INLINE uint64_t xgetbv(void) {
114
12
  const uint32_t ecx = 0;
115
12
  uint32_t eax, edx;
116
  // Use the raw opcode for xgetbv for compatibility with older toolchains.
117
12
  __asm__ volatile(".byte 0x0f, 0x01, 0xd0\n"
118
12
                   : "=a"(eax), "=d"(edx)
119
12
                   : "c"(ecx));
120
12
  return ((uint64_t)edx << 32) | eax;
121
12
}
Unexecuted instantiation: vp8_dx_iface.c:xgetbv
Unexecuted instantiation: onyxd_if.c:xgetbv
Unexecuted instantiation: threading.c:xgetbv
vpx_scale_rtcd.c:xgetbv
Line
Count
Source
113
4
static INLINE uint64_t xgetbv(void) {
114
4
  const uint32_t ecx = 0;
115
4
  uint32_t eax, edx;
116
  // Use the raw opcode for xgetbv for compatibility with older toolchains.
117
4
  __asm__ volatile(".byte 0x0f, 0x01, 0xd0\n"
118
4
                   : "=a"(eax), "=d"(edx)
119
4
                   : "c"(ecx));
120
4
  return ((uint64_t)edx << 32) | eax;
121
4
}
vpx_dsp_rtcd.c:xgetbv
Line
Count
Source
113
4
static INLINE uint64_t xgetbv(void) {
114
4
  const uint32_t ecx = 0;
115
4
  uint32_t eax, edx;
116
  // Use the raw opcode for xgetbv for compatibility with older toolchains.
117
4
  __asm__ volatile(".byte 0x0f, 0x01, 0xd0\n"
118
4
                   : "=a"(eax), "=d"(edx)
119
4
                   : "c"(ecx));
120
4
  return ((uint64_t)edx << 32) | eax;
121
4
}
Unexecuted instantiation: systemdependent.c:xgetbv
rtcd.c:xgetbv
Line
Count
Source
113
2
static INLINE uint64_t xgetbv(void) {
114
2
  const uint32_t ecx = 0;
115
2
  uint32_t eax, edx;
116
  // Use the raw opcode for xgetbv for compatibility with older toolchains.
117
2
  __asm__ volatile(".byte 0x0f, 0x01, 0xd0\n"
118
2
                   : "=a"(eax), "=d"(edx)
119
2
                   : "c"(ecx));
120
2
  return ((uint64_t)edx << 32) | eax;
121
2
}
Unexecuted instantiation: vp8_quantize_sse2.c:xgetbv
Unexecuted instantiation: decodeframe.c:xgetbv
Unexecuted instantiation: detokenize.c:xgetbv
vp9_rtcd.c:xgetbv
Line
Count
Source
113
2
static INLINE uint64_t xgetbv(void) {
114
2
  const uint32_t ecx = 0;
115
2
  uint32_t eax, edx;
116
  // Use the raw opcode for xgetbv for compatibility with older toolchains.
117
2
  __asm__ volatile(".byte 0x0f, 0x01, 0xd0\n"
118
2
                   : "=a"(eax), "=d"(edx)
119
2
                   : "c"(ecx));
120
2
  return ((uint64_t)edx << 32) | eax;
121
2
}
Unexecuted instantiation: decodemv.c:xgetbv
Unexecuted instantiation: vpx_encoder.c:xgetbv
Unexecuted instantiation: vp8_cx_iface.c:xgetbv
Unexecuted instantiation: ethreading.c:xgetbv
Unexecuted instantiation: onyx_if.c:xgetbv
Unexecuted instantiation: pickinter.c:xgetbv
Unexecuted instantiation: picklpf.c:xgetbv
Unexecuted instantiation: vp8_quantize.c:xgetbv
Unexecuted instantiation: ratectrl.c:xgetbv
Unexecuted instantiation: rdopt.c:xgetbv
Unexecuted instantiation: segmentation.c:xgetbv
Unexecuted instantiation: vp8_skin_detection.c:xgetbv
Unexecuted instantiation: tokenize.c:xgetbv
Unexecuted instantiation: temporal_filter.c:xgetbv
Unexecuted instantiation: vp8_enc_stubs_sse2.c:xgetbv
Unexecuted instantiation: bitstream.c:xgetbv
Unexecuted instantiation: encodeframe.c:xgetbv
Unexecuted instantiation: encodeintra.c:xgetbv
Unexecuted instantiation: encodemb.c:xgetbv
Unexecuted instantiation: encodemv.c:xgetbv
Unexecuted instantiation: firstpass.c:xgetbv
Unexecuted instantiation: mcomp.c:xgetbv
Unexecuted instantiation: modecosts.c:xgetbv
122
#elif (defined(_M_X64) || defined(_M_IX86)) && defined(_MSC_FULL_VER) && \
123
    _MSC_FULL_VER >= 160040219  // >= VS2010 SP1
124
#include <immintrin.h>
125
#define xgetbv() _xgetbv(0)
126
#elif defined(_MSC_VER) && defined(_M_IX86)
127
static INLINE uint64_t xgetbv(void) {
128
  uint32_t eax_, edx_;
129
  __asm {
130
    xor ecx, ecx  // ecx = 0
131
    // Use the raw opcode for xgetbv for compatibility with older toolchains.
132
    __asm _emit 0x0f __asm _emit 0x01 __asm _emit 0xd0
133
    mov eax_, eax
134
    mov edx_, edx
135
  }
136
  return ((uint64_t)edx_ << 32) | eax_;
137
}
138
#else
139
#define xgetbv() 0U  // no AVX for older x64 or unrecognized toolchains.
140
#endif
141
142
#if defined(_MSC_VER) && _MSC_VER >= 1700
143
#undef NOMINMAX
144
#define NOMINMAX
145
#ifndef WIN32_LEAN_AND_MEAN
146
#define WIN32_LEAN_AND_MEAN
147
#endif
148
#include <windows.h>
149
#if WINAPI_FAMILY_PARTITION(WINAPI_FAMILY_APP)
150
#define getenv(x) NULL
151
#endif
152
#endif
153
154
12
#define HAS_MMX 0x001
155
12
#define HAS_SSE 0x002
156
12
#define HAS_SSE2 0x004
157
14
#define HAS_SSE3 0x008
158
328
#define HAS_SSSE3 0x010
159
68
#define HAS_SSE4_1 0x020
160
20
#define HAS_AVX 0x040
161
512
#define HAS_AVX2 0x080
162
44
#define HAS_AVX512 0x100
163
#ifndef BIT
164
336
#define BIT(n) (1u << (n))
165
#endif
166
167
24
#define MMX_BITS BIT(23)
168
24
#define SSE_BITS BIT(25)
169
24
#define SSE2_BITS BIT(26)
170
24
#define SSE3_BITS BIT(0)
171
24
#define SSSE3_BITS BIT(9)
172
24
#define SSE4_1_BITS BIT(19)
173
// Bits 27 (OSXSAVE) & 28 (256-bit AVX)
174
24
#define AVX_BITS (BIT(27) | BIT(28))
175
24
#define AVX2_BITS BIT(5)
176
// Bits 16 (AVX-512F) & 17 (AVX-512DQ) & 28 (AVX-512CD) & 30 (AVX-512BW)
177
// & 31 (AVX-512VL)
178
24
#define AVX512_BITS (BIT(16) | BIT(17) | BIT(28) | BIT(30) | BIT(31))
179
// Bits 1 (AVX512-VBMI) & 6 (AVX512-VBMI2) & 8 (AVX512-GFNI) & 9 (AVX512-VAES) &
180
// 10 (AVX512-VPCLMULQDQ) & 11 (AVX512-VNNI) & 12 (AVX512-BITALG) &
181
// 14 (AVX512-POPCNTDQ)
182
#define AVX512_DL_BITS \
183
0
  (BIT(1) | BIT(6) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | BIT(12) | BIT(14))
184
185
#define FEATURE_SET(reg, feature) \
186
108
  (((reg) & (feature##_BITS)) == (feature##_BITS))
187
188
12
static INLINE int x86_simd_caps(void) {
189
12
  unsigned int flags = 0;
190
12
  unsigned int mask = ~0u;
191
12
  unsigned int max_cpuid_val, reg_eax, reg_ebx, reg_ecx, reg_edx;
192
12
  char *env;
193
12
  (void)reg_ebx;
194
195
  /* See if the CPU capabilities are being overridden by the environment */
196
12
  env = getenv("VPX_SIMD_CAPS");
197
12
  if (env && *env) return (int)strtol(env, NULL, 0);
198
199
12
  env = getenv("VPX_SIMD_CAPS_MASK");
200
12
  if (env && *env) mask = (unsigned int)strtoul(env, NULL, 0);
201
202
  /* Ensure that the CPUID instruction supports extended features */
203
12
  cpuid(0, 0, max_cpuid_val, reg_ebx, reg_ecx, reg_edx);
204
12
  if (max_cpuid_val < 1) return 0;
205
206
  /* Get the standard feature flags */
207
12
  cpuid(1, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
208
209
12
  flags |= FEATURE_SET(reg_edx, MMX) ? HAS_MMX : 0;
210
12
  flags |= FEATURE_SET(reg_edx, SSE) ? HAS_SSE : 0;
211
12
  flags |= FEATURE_SET(reg_edx, SSE2) ? HAS_SSE2 : 0;
212
12
  flags |= FEATURE_SET(reg_ecx, SSE3) ? HAS_SSE3 : 0;
213
12
  flags |= FEATURE_SET(reg_ecx, SSSE3) ? HAS_SSSE3 : 0;
214
12
  flags |= FEATURE_SET(reg_ecx, SSE4_1) ? HAS_SSE4_1 : 0;
215
216
12
  if (FEATURE_SET(reg_ecx, AVX)) {
217
    // Check for OS-support of YMM state. Necessary for AVX and AVX2.
218
12
    if ((xgetbv() & 0x6) == 0x6) {
219
12
      flags |= HAS_AVX;
220
12
      if (max_cpuid_val >= 7) {
221
        /* Get the leaf 7 feature flags. Needed to check for AVX2 support */
222
12
        cpuid(7, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
223
12
        flags |= FEATURE_SET(reg_ebx, AVX2) ? HAS_AVX2 : 0;
224
12
        if (FEATURE_SET(reg_ebx, AVX512)) {
225
          // Check for OS-support of ZMM and YMM state. Necessary for AVX-512.
226
0
          if ((xgetbv() & 0xe6) == 0xe6) {
227
            // Older AVX512 implementations (such as Skylake) have turbo curves
228
            // that are currently problematic for mixed AVX512/AVX2 code
229
0
            flags |= FEATURE_SET(reg_ecx, AVX512_DL) ? HAS_AVX512 : 0;
230
0
          }
231
0
        }
232
12
      }
233
12
    }
234
12
  }
235
12
  (void)reg_eax;  // Avoid compiler warning on unused-but-set variable.
236
12
  return flags & mask;
237
12
}
Unexecuted instantiation: vp8_dx_iface.c:x86_simd_caps
Unexecuted instantiation: onyxd_if.c:x86_simd_caps
Unexecuted instantiation: threading.c:x86_simd_caps
vpx_scale_rtcd.c:x86_simd_caps
Line
Count
Source
188
4
static INLINE int x86_simd_caps(void) {
189
4
  unsigned int flags = 0;
190
4
  unsigned int mask = ~0u;
191
4
  unsigned int max_cpuid_val, reg_eax, reg_ebx, reg_ecx, reg_edx;
192
4
  char *env;
193
4
  (void)reg_ebx;
194
195
  /* See if the CPU capabilities are being overridden by the environment */
196
4
  env = getenv("VPX_SIMD_CAPS");
197
4
  if (env && *env) return (int)strtol(env, NULL, 0);
198
199
4
  env = getenv("VPX_SIMD_CAPS_MASK");
200
4
  if (env && *env) mask = (unsigned int)strtoul(env, NULL, 0);
201
202
  /* Ensure that the CPUID instruction supports extended features */
203
4
  cpuid(0, 0, max_cpuid_val, reg_ebx, reg_ecx, reg_edx);
204
4
  if (max_cpuid_val < 1) return 0;
205
206
  /* Get the standard feature flags */
207
4
  cpuid(1, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
208
209
4
  flags |= FEATURE_SET(reg_edx, MMX) ? HAS_MMX : 0;
210
4
  flags |= FEATURE_SET(reg_edx, SSE) ? HAS_SSE : 0;
211
4
  flags |= FEATURE_SET(reg_edx, SSE2) ? HAS_SSE2 : 0;
212
4
  flags |= FEATURE_SET(reg_ecx, SSE3) ? HAS_SSE3 : 0;
213
4
  flags |= FEATURE_SET(reg_ecx, SSSE3) ? HAS_SSSE3 : 0;
214
4
  flags |= FEATURE_SET(reg_ecx, SSE4_1) ? HAS_SSE4_1 : 0;
215
216
4
  if (FEATURE_SET(reg_ecx, AVX)) {
217
    // Check for OS-support of YMM state. Necessary for AVX and AVX2.
218
4
    if ((xgetbv() & 0x6) == 0x6) {
219
4
      flags |= HAS_AVX;
220
4
      if (max_cpuid_val >= 7) {
221
        /* Get the leaf 7 feature flags. Needed to check for AVX2 support */
222
4
        cpuid(7, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
223
4
        flags |= FEATURE_SET(reg_ebx, AVX2) ? HAS_AVX2 : 0;
224
4
        if (FEATURE_SET(reg_ebx, AVX512)) {
225
          // Check for OS-support of ZMM and YMM state. Necessary for AVX-512.
226
0
          if ((xgetbv() & 0xe6) == 0xe6) {
227
            // Older AVX512 implementations (such as Skylake) have turbo curves
228
            // that are currently problematic for mixed AVX512/AVX2 code
229
0
            flags |= FEATURE_SET(reg_ecx, AVX512_DL) ? HAS_AVX512 : 0;
230
0
          }
231
0
        }
232
4
      }
233
4
    }
234
4
  }
235
4
  (void)reg_eax;  // Avoid compiler warning on unused-but-set variable.
236
4
  return flags & mask;
237
4
}
vpx_dsp_rtcd.c:x86_simd_caps
Line
Count
Source
188
4
static INLINE int x86_simd_caps(void) {
189
4
  unsigned int flags = 0;
190
4
  unsigned int mask = ~0u;
191
4
  unsigned int max_cpuid_val, reg_eax, reg_ebx, reg_ecx, reg_edx;
192
4
  char *env;
193
4
  (void)reg_ebx;
194
195
  /* See if the CPU capabilities are being overridden by the environment */
196
4
  env = getenv("VPX_SIMD_CAPS");
197
4
  if (env && *env) return (int)strtol(env, NULL, 0);
198
199
4
  env = getenv("VPX_SIMD_CAPS_MASK");
200
4
  if (env && *env) mask = (unsigned int)strtoul(env, NULL, 0);
201
202
  /* Ensure that the CPUID instruction supports extended features */
203
4
  cpuid(0, 0, max_cpuid_val, reg_ebx, reg_ecx, reg_edx);
204
4
  if (max_cpuid_val < 1) return 0;
205
206
  /* Get the standard feature flags */
207
4
  cpuid(1, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
208
209
4
  flags |= FEATURE_SET(reg_edx, MMX) ? HAS_MMX : 0;
210
4
  flags |= FEATURE_SET(reg_edx, SSE) ? HAS_SSE : 0;
211
4
  flags |= FEATURE_SET(reg_edx, SSE2) ? HAS_SSE2 : 0;
212
4
  flags |= FEATURE_SET(reg_ecx, SSE3) ? HAS_SSE3 : 0;
213
4
  flags |= FEATURE_SET(reg_ecx, SSSE3) ? HAS_SSSE3 : 0;
214
4
  flags |= FEATURE_SET(reg_ecx, SSE4_1) ? HAS_SSE4_1 : 0;
215
216
4
  if (FEATURE_SET(reg_ecx, AVX)) {
217
    // Check for OS-support of YMM state. Necessary for AVX and AVX2.
218
4
    if ((xgetbv() & 0x6) == 0x6) {
219
4
      flags |= HAS_AVX;
220
4
      if (max_cpuid_val >= 7) {
221
        /* Get the leaf 7 feature flags. Needed to check for AVX2 support */
222
4
        cpuid(7, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
223
4
        flags |= FEATURE_SET(reg_ebx, AVX2) ? HAS_AVX2 : 0;
224
4
        if (FEATURE_SET(reg_ebx, AVX512)) {
225
          // Check for OS-support of ZMM and YMM state. Necessary for AVX-512.
226
0
          if ((xgetbv() & 0xe6) == 0xe6) {
227
            // Older AVX512 implementations (such as Skylake) have turbo curves
228
            // that are currently problematic for mixed AVX512/AVX2 code
229
0
            flags |= FEATURE_SET(reg_ecx, AVX512_DL) ? HAS_AVX512 : 0;
230
0
          }
231
0
        }
232
4
      }
233
4
    }
234
4
  }
235
4
  (void)reg_eax;  // Avoid compiler warning on unused-but-set variable.
236
4
  return flags & mask;
237
4
}
Unexecuted instantiation: systemdependent.c:x86_simd_caps
rtcd.c:x86_simd_caps
Line
Count
Source
188
2
static INLINE int x86_simd_caps(void) {
189
2
  unsigned int flags = 0;
190
2
  unsigned int mask = ~0u;
191
2
  unsigned int max_cpuid_val, reg_eax, reg_ebx, reg_ecx, reg_edx;
192
2
  char *env;
193
2
  (void)reg_ebx;
194
195
  /* See if the CPU capabilities are being overridden by the environment */
196
2
  env = getenv("VPX_SIMD_CAPS");
197
2
  if (env && *env) return (int)strtol(env, NULL, 0);
198
199
2
  env = getenv("VPX_SIMD_CAPS_MASK");
200
2
  if (env && *env) mask = (unsigned int)strtoul(env, NULL, 0);
201
202
  /* Ensure that the CPUID instruction supports extended features */
203
2
  cpuid(0, 0, max_cpuid_val, reg_ebx, reg_ecx, reg_edx);
204
2
  if (max_cpuid_val < 1) return 0;
205
206
  /* Get the standard feature flags */
207
2
  cpuid(1, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
208
209
2
  flags |= FEATURE_SET(reg_edx, MMX) ? HAS_MMX : 0;
210
2
  flags |= FEATURE_SET(reg_edx, SSE) ? HAS_SSE : 0;
211
2
  flags |= FEATURE_SET(reg_edx, SSE2) ? HAS_SSE2 : 0;
212
2
  flags |= FEATURE_SET(reg_ecx, SSE3) ? HAS_SSE3 : 0;
213
2
  flags |= FEATURE_SET(reg_ecx, SSSE3) ? HAS_SSSE3 : 0;
214
2
  flags |= FEATURE_SET(reg_ecx, SSE4_1) ? HAS_SSE4_1 : 0;
215
216
2
  if (FEATURE_SET(reg_ecx, AVX)) {
217
    // Check for OS-support of YMM state. Necessary for AVX and AVX2.
218
2
    if ((xgetbv() & 0x6) == 0x6) {
219
2
      flags |= HAS_AVX;
220
2
      if (max_cpuid_val >= 7) {
221
        /* Get the leaf 7 feature flags. Needed to check for AVX2 support */
222
2
        cpuid(7, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
223
2
        flags |= FEATURE_SET(reg_ebx, AVX2) ? HAS_AVX2 : 0;
224
2
        if (FEATURE_SET(reg_ebx, AVX512)) {
225
          // Check for OS-support of ZMM and YMM state. Necessary for AVX-512.
226
0
          if ((xgetbv() & 0xe6) == 0xe6) {
227
            // Older AVX512 implementations (such as Skylake) have turbo curves
228
            // that are currently problematic for mixed AVX512/AVX2 code
229
0
            flags |= FEATURE_SET(reg_ecx, AVX512_DL) ? HAS_AVX512 : 0;
230
0
          }
231
0
        }
232
2
      }
233
2
    }
234
2
  }
235
2
  (void)reg_eax;  // Avoid compiler warning on unused-but-set variable.
236
2
  return flags & mask;
237
2
}
Unexecuted instantiation: vp8_quantize_sse2.c:x86_simd_caps
Unexecuted instantiation: decodeframe.c:x86_simd_caps
Unexecuted instantiation: detokenize.c:x86_simd_caps
vp9_rtcd.c:x86_simd_caps
Line
Count
Source
188
2
static INLINE int x86_simd_caps(void) {
189
2
  unsigned int flags = 0;
190
2
  unsigned int mask = ~0u;
191
2
  unsigned int max_cpuid_val, reg_eax, reg_ebx, reg_ecx, reg_edx;
192
2
  char *env;
193
2
  (void)reg_ebx;
194
195
  /* See if the CPU capabilities are being overridden by the environment */
196
2
  env = getenv("VPX_SIMD_CAPS");
197
2
  if (env && *env) return (int)strtol(env, NULL, 0);
198
199
2
  env = getenv("VPX_SIMD_CAPS_MASK");
200
2
  if (env && *env) mask = (unsigned int)strtoul(env, NULL, 0);
201
202
  /* Ensure that the CPUID instruction supports extended features */
203
2
  cpuid(0, 0, max_cpuid_val, reg_ebx, reg_ecx, reg_edx);
204
2
  if (max_cpuid_val < 1) return 0;
205
206
  /* Get the standard feature flags */
207
2
  cpuid(1, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
208
209
2
  flags |= FEATURE_SET(reg_edx, MMX) ? HAS_MMX : 0;
210
2
  flags |= FEATURE_SET(reg_edx, SSE) ? HAS_SSE : 0;
211
2
  flags |= FEATURE_SET(reg_edx, SSE2) ? HAS_SSE2 : 0;
212
2
  flags |= FEATURE_SET(reg_ecx, SSE3) ? HAS_SSE3 : 0;
213
2
  flags |= FEATURE_SET(reg_ecx, SSSE3) ? HAS_SSSE3 : 0;
214
2
  flags |= FEATURE_SET(reg_ecx, SSE4_1) ? HAS_SSE4_1 : 0;
215
216
2
  if (FEATURE_SET(reg_ecx, AVX)) {
217
    // Check for OS-support of YMM state. Necessary for AVX and AVX2.
218
2
    if ((xgetbv() & 0x6) == 0x6) {
219
2
      flags |= HAS_AVX;
220
2
      if (max_cpuid_val >= 7) {
221
        /* Get the leaf 7 feature flags. Needed to check for AVX2 support */
222
2
        cpuid(7, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
223
2
        flags |= FEATURE_SET(reg_ebx, AVX2) ? HAS_AVX2 : 0;
224
2
        if (FEATURE_SET(reg_ebx, AVX512)) {
225
          // Check for OS-support of ZMM and YMM state. Necessary for AVX-512.
226
0
          if ((xgetbv() & 0xe6) == 0xe6) {
227
            // Older AVX512 implementations (such as Skylake) have turbo curves
228
            // that are currently problematic for mixed AVX512/AVX2 code
229
0
            flags |= FEATURE_SET(reg_ecx, AVX512_DL) ? HAS_AVX512 : 0;
230
0
          }
231
0
        }
232
2
      }
233
2
    }
234
2
  }
235
2
  (void)reg_eax;  // Avoid compiler warning on unused-but-set variable.
236
2
  return flags & mask;
237
2
}
Unexecuted instantiation: decodemv.c:x86_simd_caps
Unexecuted instantiation: vpx_encoder.c:x86_simd_caps
Unexecuted instantiation: vp8_cx_iface.c:x86_simd_caps
Unexecuted instantiation: ethreading.c:x86_simd_caps
Unexecuted instantiation: onyx_if.c:x86_simd_caps
Unexecuted instantiation: pickinter.c:x86_simd_caps
Unexecuted instantiation: picklpf.c:x86_simd_caps
Unexecuted instantiation: vp8_quantize.c:x86_simd_caps
Unexecuted instantiation: ratectrl.c:x86_simd_caps
Unexecuted instantiation: rdopt.c:x86_simd_caps
Unexecuted instantiation: segmentation.c:x86_simd_caps
Unexecuted instantiation: vp8_skin_detection.c:x86_simd_caps
Unexecuted instantiation: tokenize.c:x86_simd_caps
Unexecuted instantiation: temporal_filter.c:x86_simd_caps
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x86_simd_caps
Unexecuted instantiation: bitstream.c:x86_simd_caps
Unexecuted instantiation: encodeframe.c:x86_simd_caps
Unexecuted instantiation: encodeintra.c:x86_simd_caps
Unexecuted instantiation: encodemb.c:x86_simd_caps
Unexecuted instantiation: encodemv.c:x86_simd_caps
Unexecuted instantiation: firstpass.c:x86_simd_caps
Unexecuted instantiation: mcomp.c:x86_simd_caps
Unexecuted instantiation: modecosts.c:x86_simd_caps
238
239
// Fine-Grain Measurement Functions
240
//
241
// If you are timing a small region of code, access the timestamp counter
242
// (TSC) via:
243
//
244
// unsigned int start = x86_tsc_start();
245
//   ...
246
// unsigned int end = x86_tsc_end();
247
// unsigned int diff = end - start;
248
//
249
// The start/end functions introduce a few more instructions than using
250
// x86_readtsc directly, but prevent the CPU's out-of-order execution from
251
// affecting the measurement (by having earlier/later instructions be evaluated
252
// in the time interval). See the white paper, "How to Benchmark Code
253
// Execution Times on Intel(R) IA-32 and IA-64 Instruction Set Architectures" by
254
// Gabriele Paoloni for more information.
255
//
256
// If you are timing a large function (CPU time > a couple of seconds), use
257
// x86_readtsc64 to read the timestamp counter in a 64-bit integer. The
258
// out-of-order leakage that can occur is minimal compared to total runtime.
259
0
static INLINE unsigned int x86_readtsc(void) {
260
0
#if defined(__GNUC__)
261
0
  unsigned int tsc;
262
0
  __asm__ __volatile__("rdtsc\n\t" : "=a"(tsc) : : "edx");
263
0
  return tsc;
264
0
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
265
0
  unsigned int tsc;
266
0
  asm volatile("rdtsc\n\t" : "=a"(tsc) : : "edx");
267
0
  return tsc;
268
0
#else
269
0
#if VPX_ARCH_X86_64
270
0
  return (unsigned int)__rdtsc();
271
0
#else
272
0
  __asm rdtsc;
273
0
#endif
274
0
#endif
275
0
}
Unexecuted instantiation: vp8_dx_iface.c:x86_readtsc
Unexecuted instantiation: onyxd_if.c:x86_readtsc
Unexecuted instantiation: threading.c:x86_readtsc
Unexecuted instantiation: vpx_scale_rtcd.c:x86_readtsc
Unexecuted instantiation: vpx_dsp_rtcd.c:x86_readtsc
Unexecuted instantiation: systemdependent.c:x86_readtsc
Unexecuted instantiation: rtcd.c:x86_readtsc
Unexecuted instantiation: vp8_quantize_sse2.c:x86_readtsc
Unexecuted instantiation: decodeframe.c:x86_readtsc
Unexecuted instantiation: detokenize.c:x86_readtsc
Unexecuted instantiation: vp9_rtcd.c:x86_readtsc
Unexecuted instantiation: decodemv.c:x86_readtsc
Unexecuted instantiation: vpx_encoder.c:x86_readtsc
Unexecuted instantiation: vp8_cx_iface.c:x86_readtsc
Unexecuted instantiation: ethreading.c:x86_readtsc
Unexecuted instantiation: onyx_if.c:x86_readtsc
Unexecuted instantiation: pickinter.c:x86_readtsc
Unexecuted instantiation: picklpf.c:x86_readtsc
Unexecuted instantiation: vp8_quantize.c:x86_readtsc
Unexecuted instantiation: ratectrl.c:x86_readtsc
Unexecuted instantiation: rdopt.c:x86_readtsc
Unexecuted instantiation: segmentation.c:x86_readtsc
Unexecuted instantiation: vp8_skin_detection.c:x86_readtsc
Unexecuted instantiation: tokenize.c:x86_readtsc
Unexecuted instantiation: temporal_filter.c:x86_readtsc
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x86_readtsc
Unexecuted instantiation: bitstream.c:x86_readtsc
Unexecuted instantiation: encodeframe.c:x86_readtsc
Unexecuted instantiation: encodeintra.c:x86_readtsc
Unexecuted instantiation: encodemb.c:x86_readtsc
Unexecuted instantiation: encodemv.c:x86_readtsc
Unexecuted instantiation: firstpass.c:x86_readtsc
Unexecuted instantiation: mcomp.c:x86_readtsc
Unexecuted instantiation: modecosts.c:x86_readtsc
276
// 64-bit CPU cycle counter
277
0
static INLINE uint64_t x86_readtsc64(void) {
278
0
#if defined(__GNUC__)
279
0
  uint32_t hi, lo;
280
0
  __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
281
0
  return ((uint64_t)hi << 32) | lo;
282
0
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
283
0
  uint_t hi, lo;
284
0
  asm volatile("rdtsc\n\t" : "=a"(lo), "=d"(hi));
285
0
  return ((uint64_t)hi << 32) | lo;
286
0
#else
287
0
#if VPX_ARCH_X86_64
288
0
  return (uint64_t)__rdtsc();
289
0
#else
290
0
  __asm rdtsc;
291
0
#endif
292
0
#endif
293
0
}
Unexecuted instantiation: vp8_dx_iface.c:x86_readtsc64
Unexecuted instantiation: onyxd_if.c:x86_readtsc64
Unexecuted instantiation: threading.c:x86_readtsc64
Unexecuted instantiation: vpx_scale_rtcd.c:x86_readtsc64
Unexecuted instantiation: vpx_dsp_rtcd.c:x86_readtsc64
Unexecuted instantiation: systemdependent.c:x86_readtsc64
Unexecuted instantiation: rtcd.c:x86_readtsc64
Unexecuted instantiation: vp8_quantize_sse2.c:x86_readtsc64
Unexecuted instantiation: decodeframe.c:x86_readtsc64
Unexecuted instantiation: detokenize.c:x86_readtsc64
Unexecuted instantiation: vp9_rtcd.c:x86_readtsc64
Unexecuted instantiation: decodemv.c:x86_readtsc64
Unexecuted instantiation: vpx_encoder.c:x86_readtsc64
Unexecuted instantiation: vp8_cx_iface.c:x86_readtsc64
Unexecuted instantiation: ethreading.c:x86_readtsc64
Unexecuted instantiation: onyx_if.c:x86_readtsc64
Unexecuted instantiation: pickinter.c:x86_readtsc64
Unexecuted instantiation: picklpf.c:x86_readtsc64
Unexecuted instantiation: vp8_quantize.c:x86_readtsc64
Unexecuted instantiation: ratectrl.c:x86_readtsc64
Unexecuted instantiation: rdopt.c:x86_readtsc64
Unexecuted instantiation: segmentation.c:x86_readtsc64
Unexecuted instantiation: vp8_skin_detection.c:x86_readtsc64
Unexecuted instantiation: tokenize.c:x86_readtsc64
Unexecuted instantiation: temporal_filter.c:x86_readtsc64
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x86_readtsc64
Unexecuted instantiation: bitstream.c:x86_readtsc64
Unexecuted instantiation: encodeframe.c:x86_readtsc64
Unexecuted instantiation: encodeintra.c:x86_readtsc64
Unexecuted instantiation: encodemb.c:x86_readtsc64
Unexecuted instantiation: encodemv.c:x86_readtsc64
Unexecuted instantiation: firstpass.c:x86_readtsc64
Unexecuted instantiation: mcomp.c:x86_readtsc64
Unexecuted instantiation: modecosts.c:x86_readtsc64
294
295
// 32-bit CPU cycle counter with a partial fence against out-of-order execution.
296
0
static INLINE unsigned int x86_readtscp(void) {
297
0
#if defined(__GNUC__)
298
0
  unsigned int tscp;
299
0
  __asm__ __volatile__("rdtscp\n\t" : "=a"(tscp) : : "edx");
300
0
  return tscp;
301
0
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
302
0
  unsigned int tscp;
303
0
  asm volatile("rdtscp\n\t" : "=a"(tscp) : : "edx");
304
0
  return tscp;
305
0
#elif defined(_MSC_VER)
306
0
  unsigned int ui;
307
0
  return (unsigned int)__rdtscp(&ui);
308
0
#else
309
0
#if VPX_ARCH_X86_64
310
0
  return (unsigned int)__rdtscp();
311
0
#else
312
0
  __asm rdtscp;
313
0
#endif
314
0
#endif
315
0
}
Unexecuted instantiation: vp8_dx_iface.c:x86_readtscp
Unexecuted instantiation: onyxd_if.c:x86_readtscp
Unexecuted instantiation: threading.c:x86_readtscp
Unexecuted instantiation: vpx_scale_rtcd.c:x86_readtscp
Unexecuted instantiation: vpx_dsp_rtcd.c:x86_readtscp
Unexecuted instantiation: systemdependent.c:x86_readtscp
Unexecuted instantiation: rtcd.c:x86_readtscp
Unexecuted instantiation: vp8_quantize_sse2.c:x86_readtscp
Unexecuted instantiation: decodeframe.c:x86_readtscp
Unexecuted instantiation: detokenize.c:x86_readtscp
Unexecuted instantiation: vp9_rtcd.c:x86_readtscp
Unexecuted instantiation: decodemv.c:x86_readtscp
Unexecuted instantiation: vpx_encoder.c:x86_readtscp
Unexecuted instantiation: vp8_cx_iface.c:x86_readtscp
Unexecuted instantiation: ethreading.c:x86_readtscp
Unexecuted instantiation: onyx_if.c:x86_readtscp
Unexecuted instantiation: pickinter.c:x86_readtscp
Unexecuted instantiation: picklpf.c:x86_readtscp
Unexecuted instantiation: vp8_quantize.c:x86_readtscp
Unexecuted instantiation: ratectrl.c:x86_readtscp
Unexecuted instantiation: rdopt.c:x86_readtscp
Unexecuted instantiation: segmentation.c:x86_readtscp
Unexecuted instantiation: vp8_skin_detection.c:x86_readtscp
Unexecuted instantiation: tokenize.c:x86_readtscp
Unexecuted instantiation: temporal_filter.c:x86_readtscp
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x86_readtscp
Unexecuted instantiation: bitstream.c:x86_readtscp
Unexecuted instantiation: encodeframe.c:x86_readtscp
Unexecuted instantiation: encodeintra.c:x86_readtscp
Unexecuted instantiation: encodemb.c:x86_readtscp
Unexecuted instantiation: encodemv.c:x86_readtscp
Unexecuted instantiation: firstpass.c:x86_readtscp
Unexecuted instantiation: mcomp.c:x86_readtscp
Unexecuted instantiation: modecosts.c:x86_readtscp
316
317
0
static INLINE unsigned int x86_tsc_start(void) {
318
0
  unsigned int reg_eax, reg_ebx, reg_ecx, reg_edx;
319
0
  // This call should not be removed. See function notes above.
320
0
  cpuid(0, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
321
0
  // Avoid compiler warnings on unused-but-set variables.
322
0
  (void)reg_eax;
323
0
  (void)reg_ebx;
324
0
  (void)reg_ecx;
325
0
  (void)reg_edx;
326
0
  return x86_readtsc();
327
0
}
Unexecuted instantiation: vp8_dx_iface.c:x86_tsc_start
Unexecuted instantiation: onyxd_if.c:x86_tsc_start
Unexecuted instantiation: threading.c:x86_tsc_start
Unexecuted instantiation: vpx_scale_rtcd.c:x86_tsc_start
Unexecuted instantiation: vpx_dsp_rtcd.c:x86_tsc_start
Unexecuted instantiation: systemdependent.c:x86_tsc_start
Unexecuted instantiation: rtcd.c:x86_tsc_start
Unexecuted instantiation: vp8_quantize_sse2.c:x86_tsc_start
Unexecuted instantiation: decodeframe.c:x86_tsc_start
Unexecuted instantiation: detokenize.c:x86_tsc_start
Unexecuted instantiation: vp9_rtcd.c:x86_tsc_start
Unexecuted instantiation: decodemv.c:x86_tsc_start
Unexecuted instantiation: vpx_encoder.c:x86_tsc_start
Unexecuted instantiation: vp8_cx_iface.c:x86_tsc_start
Unexecuted instantiation: ethreading.c:x86_tsc_start
Unexecuted instantiation: onyx_if.c:x86_tsc_start
Unexecuted instantiation: pickinter.c:x86_tsc_start
Unexecuted instantiation: picklpf.c:x86_tsc_start
Unexecuted instantiation: vp8_quantize.c:x86_tsc_start
Unexecuted instantiation: ratectrl.c:x86_tsc_start
Unexecuted instantiation: rdopt.c:x86_tsc_start
Unexecuted instantiation: segmentation.c:x86_tsc_start
Unexecuted instantiation: vp8_skin_detection.c:x86_tsc_start
Unexecuted instantiation: tokenize.c:x86_tsc_start
Unexecuted instantiation: temporal_filter.c:x86_tsc_start
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x86_tsc_start
Unexecuted instantiation: bitstream.c:x86_tsc_start
Unexecuted instantiation: encodeframe.c:x86_tsc_start
Unexecuted instantiation: encodeintra.c:x86_tsc_start
Unexecuted instantiation: encodemb.c:x86_tsc_start
Unexecuted instantiation: encodemv.c:x86_tsc_start
Unexecuted instantiation: firstpass.c:x86_tsc_start
Unexecuted instantiation: mcomp.c:x86_tsc_start
Unexecuted instantiation: modecosts.c:x86_tsc_start
328
329
0
static INLINE unsigned int x86_tsc_end(void) {
330
0
  uint32_t v = x86_readtscp();
331
0
  unsigned int reg_eax, reg_ebx, reg_ecx, reg_edx;
332
0
  // This call should not be removed. See function notes above.
333
0
  cpuid(0, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
334
0
  // Avoid compiler warnings on unused-but-set variables.
335
0
  (void)reg_eax;
336
0
  (void)reg_ebx;
337
0
  (void)reg_ecx;
338
0
  (void)reg_edx;
339
0
  return v;
340
0
}
Unexecuted instantiation: vp8_dx_iface.c:x86_tsc_end
Unexecuted instantiation: onyxd_if.c:x86_tsc_end
Unexecuted instantiation: threading.c:x86_tsc_end
Unexecuted instantiation: vpx_scale_rtcd.c:x86_tsc_end
Unexecuted instantiation: vpx_dsp_rtcd.c:x86_tsc_end
Unexecuted instantiation: systemdependent.c:x86_tsc_end
Unexecuted instantiation: rtcd.c:x86_tsc_end
Unexecuted instantiation: vp8_quantize_sse2.c:x86_tsc_end
Unexecuted instantiation: decodeframe.c:x86_tsc_end
Unexecuted instantiation: detokenize.c:x86_tsc_end
Unexecuted instantiation: vp9_rtcd.c:x86_tsc_end
Unexecuted instantiation: decodemv.c:x86_tsc_end
Unexecuted instantiation: vpx_encoder.c:x86_tsc_end
Unexecuted instantiation: vp8_cx_iface.c:x86_tsc_end
Unexecuted instantiation: ethreading.c:x86_tsc_end
Unexecuted instantiation: onyx_if.c:x86_tsc_end
Unexecuted instantiation: pickinter.c:x86_tsc_end
Unexecuted instantiation: picklpf.c:x86_tsc_end
Unexecuted instantiation: vp8_quantize.c:x86_tsc_end
Unexecuted instantiation: ratectrl.c:x86_tsc_end
Unexecuted instantiation: rdopt.c:x86_tsc_end
Unexecuted instantiation: segmentation.c:x86_tsc_end
Unexecuted instantiation: vp8_skin_detection.c:x86_tsc_end
Unexecuted instantiation: tokenize.c:x86_tsc_end
Unexecuted instantiation: temporal_filter.c:x86_tsc_end
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x86_tsc_end
Unexecuted instantiation: bitstream.c:x86_tsc_end
Unexecuted instantiation: encodeframe.c:x86_tsc_end
Unexecuted instantiation: encodeintra.c:x86_tsc_end
Unexecuted instantiation: encodemb.c:x86_tsc_end
Unexecuted instantiation: encodemv.c:x86_tsc_end
Unexecuted instantiation: firstpass.c:x86_tsc_end
Unexecuted instantiation: mcomp.c:x86_tsc_end
Unexecuted instantiation: modecosts.c:x86_tsc_end
341
342
#if defined(__GNUC__)
343
0
#define x86_pause_hint() __asm__ __volatile__("pause \n\t")
344
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
345
#define x86_pause_hint() asm volatile("pause \n\t")
346
#else
347
#if VPX_ARCH_X86_64
348
#define x86_pause_hint() _mm_pause();
349
#else
350
#define x86_pause_hint() __asm pause
351
#endif
352
#endif
353
354
#if defined(__GNUC__)
355
385k
static void x87_set_control_word(unsigned short mode) {
356
385k
  __asm__ __volatile__("fldcw %0" : : "m"(*&mode));
357
385k
}
Unexecuted instantiation: vp8_dx_iface.c:x87_set_control_word
Unexecuted instantiation: onyxd_if.c:x87_set_control_word
Unexecuted instantiation: threading.c:x87_set_control_word
Unexecuted instantiation: vpx_scale_rtcd.c:x87_set_control_word
Unexecuted instantiation: vpx_dsp_rtcd.c:x87_set_control_word
Unexecuted instantiation: systemdependent.c:x87_set_control_word
Unexecuted instantiation: rtcd.c:x87_set_control_word
Unexecuted instantiation: vp8_quantize_sse2.c:x87_set_control_word
Unexecuted instantiation: decodeframe.c:x87_set_control_word
Unexecuted instantiation: detokenize.c:x87_set_control_word
Unexecuted instantiation: vp9_rtcd.c:x87_set_control_word
Unexecuted instantiation: decodemv.c:x87_set_control_word
vpx_encoder.c:x87_set_control_word
Line
Count
Source
355
385k
static void x87_set_control_word(unsigned short mode) {
356
385k
  __asm__ __volatile__("fldcw %0" : : "m"(*&mode));
357
385k
}
Unexecuted instantiation: vp8_cx_iface.c:x87_set_control_word
Unexecuted instantiation: ethreading.c:x87_set_control_word
Unexecuted instantiation: onyx_if.c:x87_set_control_word
Unexecuted instantiation: pickinter.c:x87_set_control_word
Unexecuted instantiation: picklpf.c:x87_set_control_word
Unexecuted instantiation: vp8_quantize.c:x87_set_control_word
Unexecuted instantiation: ratectrl.c:x87_set_control_word
Unexecuted instantiation: rdopt.c:x87_set_control_word
Unexecuted instantiation: segmentation.c:x87_set_control_word
Unexecuted instantiation: vp8_skin_detection.c:x87_set_control_word
Unexecuted instantiation: tokenize.c:x87_set_control_word
Unexecuted instantiation: temporal_filter.c:x87_set_control_word
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x87_set_control_word
Unexecuted instantiation: bitstream.c:x87_set_control_word
Unexecuted instantiation: encodeframe.c:x87_set_control_word
Unexecuted instantiation: encodeintra.c:x87_set_control_word
Unexecuted instantiation: encodemb.c:x87_set_control_word
Unexecuted instantiation: encodemv.c:x87_set_control_word
Unexecuted instantiation: firstpass.c:x87_set_control_word
Unexecuted instantiation: mcomp.c:x87_set_control_word
Unexecuted instantiation: modecosts.c:x87_set_control_word
358
192k
static unsigned short x87_get_control_word(void) {
359
192k
  unsigned short mode;
360
192k
  __asm__ __volatile__("fstcw %0\n\t" : "=m"(*&mode) :);
361
192k
  return mode;
362
192k
}
Unexecuted instantiation: vp8_dx_iface.c:x87_get_control_word
Unexecuted instantiation: onyxd_if.c:x87_get_control_word
Unexecuted instantiation: threading.c:x87_get_control_word
Unexecuted instantiation: vpx_scale_rtcd.c:x87_get_control_word
Unexecuted instantiation: vpx_dsp_rtcd.c:x87_get_control_word
Unexecuted instantiation: systemdependent.c:x87_get_control_word
Unexecuted instantiation: rtcd.c:x87_get_control_word
Unexecuted instantiation: vp8_quantize_sse2.c:x87_get_control_word
Unexecuted instantiation: decodeframe.c:x87_get_control_word
Unexecuted instantiation: detokenize.c:x87_get_control_word
Unexecuted instantiation: vp9_rtcd.c:x87_get_control_word
Unexecuted instantiation: decodemv.c:x87_get_control_word
vpx_encoder.c:x87_get_control_word
Line
Count
Source
358
192k
static unsigned short x87_get_control_word(void) {
359
192k
  unsigned short mode;
360
192k
  __asm__ __volatile__("fstcw %0\n\t" : "=m"(*&mode) :);
361
192k
  return mode;
362
192k
}
Unexecuted instantiation: vp8_cx_iface.c:x87_get_control_word
Unexecuted instantiation: ethreading.c:x87_get_control_word
Unexecuted instantiation: onyx_if.c:x87_get_control_word
Unexecuted instantiation: pickinter.c:x87_get_control_word
Unexecuted instantiation: picklpf.c:x87_get_control_word
Unexecuted instantiation: vp8_quantize.c:x87_get_control_word
Unexecuted instantiation: ratectrl.c:x87_get_control_word
Unexecuted instantiation: rdopt.c:x87_get_control_word
Unexecuted instantiation: segmentation.c:x87_get_control_word
Unexecuted instantiation: vp8_skin_detection.c:x87_get_control_word
Unexecuted instantiation: tokenize.c:x87_get_control_word
Unexecuted instantiation: temporal_filter.c:x87_get_control_word
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x87_get_control_word
Unexecuted instantiation: bitstream.c:x87_get_control_word
Unexecuted instantiation: encodeframe.c:x87_get_control_word
Unexecuted instantiation: encodeintra.c:x87_get_control_word
Unexecuted instantiation: encodemb.c:x87_get_control_word
Unexecuted instantiation: encodemv.c:x87_get_control_word
Unexecuted instantiation: firstpass.c:x87_get_control_word
Unexecuted instantiation: mcomp.c:x87_get_control_word
Unexecuted instantiation: modecosts.c:x87_get_control_word
363
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
364
static void x87_set_control_word(unsigned short mode) {
365
  asm volatile("fldcw %0" : : "m"(*&mode));
366
}
367
static unsigned short x87_get_control_word(void) {
368
  unsigned short mode;
369
  asm volatile("fstcw %0\n\t" : "=m"(*&mode) :);
370
  return mode;
371
}
372
#elif VPX_ARCH_X86_64
373
/* No fldcw intrinsics on Windows x64, punt to external asm */
374
extern void vpx_winx64_fldcw(unsigned short mode);
375
extern unsigned short vpx_winx64_fstcw(void);
376
#define x87_set_control_word vpx_winx64_fldcw
377
#define x87_get_control_word vpx_winx64_fstcw
378
#else
379
static void x87_set_control_word(unsigned short mode) {
380
  __asm { fldcw mode }
381
}
382
static unsigned short x87_get_control_word(void) {
383
  unsigned short mode;
384
  __asm { fstcw mode }
385
  return mode;
386
}
387
#endif
388
389
192k
static INLINE unsigned int x87_set_double_precision(void) {
390
192k
  unsigned int mode = x87_get_control_word();
391
  // Intel 64 and IA-32 Architectures Developer's Manual: Vol. 1
392
  // https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-1-manual.pdf
393
  // 8.1.5.2 Precision Control Field
394
  // Bits 8 and 9 (0x300) of the x87 FPU Control Word ("Precision Control")
395
  // determine the number of bits used in floating point calculations. To match
396
  // later SSE instructions restrict x87 operations to Double Precision (0x200).
397
  // Precision                     PC Field
398
  // Single Precision (24-Bits)    00B
399
  // Reserved                      01B
400
  // Double Precision (53-Bits)    10B
401
  // Extended Precision (64-Bits)  11B
402
192k
  x87_set_control_word((mode & ~0x300u) | 0x200u);
403
192k
  return mode;
404
192k
}
Unexecuted instantiation: vp8_dx_iface.c:x87_set_double_precision
Unexecuted instantiation: onyxd_if.c:x87_set_double_precision
Unexecuted instantiation: threading.c:x87_set_double_precision
Unexecuted instantiation: vpx_scale_rtcd.c:x87_set_double_precision
Unexecuted instantiation: vpx_dsp_rtcd.c:x87_set_double_precision
Unexecuted instantiation: systemdependent.c:x87_set_double_precision
Unexecuted instantiation: rtcd.c:x87_set_double_precision
Unexecuted instantiation: vp8_quantize_sse2.c:x87_set_double_precision
Unexecuted instantiation: decodeframe.c:x87_set_double_precision
Unexecuted instantiation: detokenize.c:x87_set_double_precision
Unexecuted instantiation: vp9_rtcd.c:x87_set_double_precision
Unexecuted instantiation: decodemv.c:x87_set_double_precision
vpx_encoder.c:x87_set_double_precision
Line
Count
Source
389
192k
static INLINE unsigned int x87_set_double_precision(void) {
390
192k
  unsigned int mode = x87_get_control_word();
391
  // Intel 64 and IA-32 Architectures Developer's Manual: Vol. 1
392
  // https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-1-manual.pdf
393
  // 8.1.5.2 Precision Control Field
394
  // Bits 8 and 9 (0x300) of the x87 FPU Control Word ("Precision Control")
395
  // determine the number of bits used in floating point calculations. To match
396
  // later SSE instructions restrict x87 operations to Double Precision (0x200).
397
  // Precision                     PC Field
398
  // Single Precision (24-Bits)    00B
399
  // Reserved                      01B
400
  // Double Precision (53-Bits)    10B
401
  // Extended Precision (64-Bits)  11B
402
192k
  x87_set_control_word((mode & ~0x300u) | 0x200u);
403
192k
  return mode;
404
192k
}
Unexecuted instantiation: vp8_cx_iface.c:x87_set_double_precision
Unexecuted instantiation: ethreading.c:x87_set_double_precision
Unexecuted instantiation: onyx_if.c:x87_set_double_precision
Unexecuted instantiation: pickinter.c:x87_set_double_precision
Unexecuted instantiation: picklpf.c:x87_set_double_precision
Unexecuted instantiation: vp8_quantize.c:x87_set_double_precision
Unexecuted instantiation: ratectrl.c:x87_set_double_precision
Unexecuted instantiation: rdopt.c:x87_set_double_precision
Unexecuted instantiation: segmentation.c:x87_set_double_precision
Unexecuted instantiation: vp8_skin_detection.c:x87_set_double_precision
Unexecuted instantiation: tokenize.c:x87_set_double_precision
Unexecuted instantiation: temporal_filter.c:x87_set_double_precision
Unexecuted instantiation: vp8_enc_stubs_sse2.c:x87_set_double_precision
Unexecuted instantiation: bitstream.c:x87_set_double_precision
Unexecuted instantiation: encodeframe.c:x87_set_double_precision
Unexecuted instantiation: encodeintra.c:x87_set_double_precision
Unexecuted instantiation: encodemb.c:x87_set_double_precision
Unexecuted instantiation: encodemv.c:x87_set_double_precision
Unexecuted instantiation: firstpass.c:x87_set_double_precision
Unexecuted instantiation: mcomp.c:x87_set_double_precision
Unexecuted instantiation: modecosts.c:x87_set_double_precision
405
406
#ifdef __cplusplus
407
}  // extern "C"
408
#endif
409
410
#endif  // VPX_VPX_PORTS_X86_H_