mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Make the SSE3.1 VideoCommon code available in GCC builds.
The GCC model for extended instructions like these is that you compile with -msse3 etc. These affect code generation for whole compilation units, so the idea is that you have a separate .c file for each instruction set class and then indirect to the desired one at runtime. Without e.g. -msse4.1, the GCC built-ins used by <foointrin.h> are not available. However, in our specific case of compiling with -msse2 and wanting to use SSE3.1 code, enough built-ins are available that we only need to provide a little hack for pshufb. Upgrading this to also use SSE4.1 instructions doesn't appear feasible without a lot of undesirable duplication of GCC built-in functions and headers, so we'd probably have to move to the GCC model of separate source files for that. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6014 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -27,6 +27,19 @@
|
||||
template <bool> struct CompileTimeAssert;
|
||||
template<> struct CompileTimeAssert<true> {};
|
||||
|
||||
#if defined __GNUC__ && !defined __SSSE3__
|
||||
#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>
|
||||
@ -44,6 +57,7 @@ size_t strnlen(const char *s, size_t n);
|
||||
#define Crash() {asm ("int $3");}
|
||||
#endif
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
@ -65,7 +79,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
|
||||
unsigned int n = shift % 64;
|
||||
return (x >> n) | (x << (64 - n));
|
||||
}
|
||||
#define SLEEP(x) usleep(x*1000)
|
||||
|
||||
#else // WIN32
|
||||
// Function Cross-Compatibility
|
||||
#define strcasecmp _stricmp
|
||||
@ -80,7 +94,6 @@ char* strndup (char const *s, size_t n);
|
||||
#define ftell _ftelli64
|
||||
#define atoll _atoi64
|
||||
#define stat64 _stat64
|
||||
#define SLEEP(x) Sleep(x)
|
||||
|
||||
#if _M_IX86
|
||||
#define Crash() {__asm int 3}
|
||||
|
Reference in New Issue
Block a user