Skip to content

Commit

Permalink
win: Include <intrin.h> instead of manually declaring intrinsics.
Browse files Browse the repository at this point in the history
This helps clang-cl.

BUG=chromium:592745

Change-Id: I49f9b6928c91b2b43567f4336520ba4f1010d3ad
  • Loading branch information
nico committed Jun 22, 2016
1 parent 181988d commit 8c29d33
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions vpx_ports/x86.h
Expand Up @@ -12,6 +12,11 @@
#ifndef VPX_PORTS_X86_H_
#define VPX_PORTS_X86_H_
#include <stdlib.h>

#if defined(_MSC_VER)
#include <intrin.h> /* For __cpuidex, __rdtsc */
#endif

#include "vpx_config.h"
#include "vpx/vpx_integer.h"

Expand Down Expand Up @@ -77,16 +82,12 @@ typedef enum {
#else /* end __SUNPRO__ */
#if ARCH_X86_64
#if defined(_MSC_VER) && _MSC_VER > 1500
void __cpuidex(int CPUInfo[4], int info_type, int ecxvalue);
#pragma intrinsic(__cpuidex)
#define cpuid(func, func2, a, b, c, d) do {\
int regs[4];\
__cpuidex(regs, func, func2); \
a = regs[0]; b = regs[1]; c = regs[2]; d = regs[3];\
} while(0)
#else
void __cpuid(int CPUInfo[4], int info_type);
#pragma intrinsic(__cpuid)
#define cpuid(func, func2, a, b, c, d) do {\
int regs[4];\
__cpuid(regs, func); \
Expand Down Expand Up @@ -212,10 +213,6 @@ x86_simd_caps(void) {
return flags & mask;
}

#if ARCH_X86_64 && defined(_MSC_VER)
unsigned __int64 __rdtsc(void);
#pragma intrinsic(__rdtsc)
#endif
// Note:
// 32-bit CPU cycle counter is light-weighted for most function performance
// measurement. For large function (CPU time > a couple of seconds), 64-bit
Expand Down

0 comments on commit 8c29d33

Please sign in to comment.