Merge pull request #2101 from Tilka/intrinsics

Clean up the intrinsics #ifdef mess with a common header
This commit is contained in:
Pierre Bourdon 2015-02-24 01:31:45 +01:00
commit b8edd8aedc
13 changed files with 62 additions and 76 deletions

View File

@ -6,10 +6,10 @@
#pragma once
#include <intrin.h>
#include <Windows.h>
#include "Common/Common.h"
#include "Common/Intrinsics.h"
// Atomic operations are performed in a single step by the CPU. It is
// impossible for other threads to see the operation "half-done."

View File

@ -129,22 +129,6 @@ private:
// wxWidgets does not have a true dummy macro for this.
#define _trans(a) a
#if defined _M_GENERIC
# define _M_SSE 0x0
#elif defined __GNUC__
# if defined __SSE4_2__
# define _M_SSE 0x402
# elif defined __SSE4_1__
# define _M_SSE 0x401
# elif defined __SSSE3__
# define _M_SSE 0x301
# elif defined __SSE3__
# define _M_SSE 0x300
# endif
#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008
# define _M_SSE 0x402
#endif
// Host communication.
enum HOST_COMM
{

View File

@ -34,24 +34,6 @@ struct ArraySizeImpl : public std::extent<T>
#define b32(x) (b16(x) | (b16(x) >>16) )
#define ROUND_UP_POW2(x) (b32(x - 1) + 1)
#ifndef __GNUC_PREREQ
#define __GNUC_PREREQ(a, b) 0
#endif
#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) && \
!defined __SSSE3__ && defined _M_X86
#include <emmintrin.h>
static __inline __m128i __attribute__((__always_inline__))
_mm_shuffle_epi8(__m128i a, __m128i mask)
{
__m128i result;
__asm__("pshufb %1, %0"
: "=x" (result)
: "xm" (mask), "0" (a));
return result;
}
#endif
#ifndef _WIN32
#include <errno.h>

View File

@ -4,11 +4,9 @@
#include <algorithm>
#include "Common/CommonFuncs.h"
#include "Common/Hash.h"
#if _M_SSE >= 0x402
#include "Common/CPUDetect.h"
#include <nmmintrin.h>
#endif
#include "Common/Hash.h"
#include "Common/Intrinsics.h"
static u64 (*ptrHashFunction)(const u8 *src, u32 len, u32 samples) = &GetMurmurHash3;

View File

@ -0,0 +1,51 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#ifdef _M_X86
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
#ifndef __GNUC_PREREQ
#define __GNUC_PREREQ(maj, min) 0
#endif
#if defined __GNUC__ && !__GNUC_PREREQ(4, 9) && !defined __SSSE3__
// GCC <= 4.8 only enables intrinsics based on the command-line.
// GCC >= 4.9 always declares all intrinsics.
// We only want to require SSE2 and thus compile with -msse2,
// so define the one post-SSE2 intrinsic that we dispatch at runtime.
static __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_shuffle_epi8(__m128i a, __m128i mask)
{
__m128i result;
__asm__("pshufb %1, %0"
: "=x" (result)
: "xm" (mask), "0" (a));
return result;
}
#endif
#if defined _M_GENERIC
# define _M_SSE 0
#elif _MSC_VER || __INTEL_COMPILER
# define _M_SSE 0x402
#elif defined __GNUC__
# if defined __SSE4_2__
# define _M_SSE 0x402
# elif defined __SSE4_1__
# define _M_SSE 0x401
# elif defined __SSSE3__
# define _M_SSE 0x301
# elif defined __SSE3__
# define _M_SSE 0x300
# endif
#endif
#endif // _M_X86

View File

@ -7,13 +7,9 @@
#include "Common/CommonTypes.h"
#include "Common/CPUDetect.h"
#include "Common/Intrinsics.h"
#ifdef _WIN32
#include <intrin.h>
#else
//#include <config/i386/cpuid.h>
#include <xmmintrin.h>
#ifndef _WIN32
#if defined __FreeBSD__
#include <sys/types.h>

View File

@ -7,12 +7,7 @@
#include "Common/CommonTypes.h"
#include "Common/CPUDetect.h"
#include "Common/FPURoundMode.h"
#ifdef _WIN32
# include <mmintrin.h>
#else
# include <xmmintrin.h>
#endif
#include "Common/Intrinsics.h"
namespace FPURoundMode
{

View File

@ -25,6 +25,7 @@
#include "Common/Atomic.h"
#include "Common/CPUDetect.h"
#include "Common/Intrinsics.h"
#include "Common/MemoryUtil.h"
#include "Common/Thread.h"
@ -36,10 +37,6 @@
#include "Core/DSP/DSPInterpreter.h"
#include "Core/DSP/DSPTables.h"
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
#include <tmmintrin.h>
#endif
static void gdsp_do_dma();
void gdsp_ifx_init()

View File

@ -9,6 +9,7 @@
#include <string>
#include "Common/Common.h"
#include "Common/Intrinsics.h"
#include "Common/StdMakeUnique.h"
#include "Common/StringUtil.h"
#include "Core/PatchEngine.h"
@ -135,11 +136,9 @@ ps_adds1
#ifdef _WIN32
#include <windows.h>
#include <intrin.h>
#else
#include <memory>
#include <stdint.h>
#include <x86intrin.h>
#if defined(__clang__)
#if !__has_builtin(__builtin_ia32_rdtsc)

View File

@ -2,9 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <emmintrin.h>
#include "Common/CommonTypes.h"
#include "Common/Intrinsics.h"
#include "Common/MathUtil.h"
#include "Core/HW/MMIO.h"

View File

@ -6,10 +6,6 @@
#include <fstream>
#include <vector>
#ifdef _WIN32
#include <intrin.h>
#endif
#include "Common/CommonPaths.h"
#include "Common/FileUtil.h"
#include "Common/Hash.h"

View File

@ -8,18 +8,12 @@
#include "Common/Common.h"
//#include "VideoCommon.h" // to get debug logs
#include "Common/CPUDetect.h"
#include "Common/Intrinsics.h"
#include "VideoCommon/LookUpTables.h"
#include "VideoCommon/TextureDecoder.h"
#include "VideoCommon/VideoConfig.h"
#if _M_SSE >= 0x401
#include <smmintrin.h>
#include <emmintrin.h>
#elif _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
#include <tmmintrin.h>
#endif
// This avoids a harmless warning from a system header in Clang;
// see http://llvm.org/bugs/show_bug.cgi?id=16093
#if defined(__clang__) && (__clang_major__ * 100 + __clang_minor__ < 304)

View File

@ -1,10 +1,5 @@
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
#include "Common/CPUDetect.h"
#include "Common/Intrinsics.h"
#include "Common/JitRegister.h"
#include "Common/x64ABI.h"
#include "VideoCommon/VertexLoaderX64.h"