1
0
mirror of https://github.com/RPCS3/soundtouch.git synced 2024-11-10 04:42:50 +01:00

Changed x86 optimization flagging for non-win & non-linux x86 support

This commit is contained in:
oparviai 2009-01-11 11:36:36 +00:00
parent 9aaf4210af
commit 327906e23b
2 changed files with 18 additions and 17 deletions

View File

@ -87,14 +87,16 @@ namespace soundtouch
#endif
/// Define this to allow CPU-specific assembler optimizations. Notice that
/// having this enabled on non-x86 platforms doesn't matter; the compiler can
/// drop unsupported extensions on different platforms automatically.
/// However, if you're having difficulties getting the optimized routines
/// compiled with your compler (e.g. some gcc compiler versions may be picky),
/// you may wish to disable the optimizations to make the library compile.
#define ALLOW_OPTIMIZATIONS 1
#if (WIN32 || __i386__ || __x86_64__)
/// Define this to allow X86-specific assembler/intrinsic optimizations.
/// Notice that library contains also usual C++ versions of each of these
/// these routines, so if you're having difficulties getting the optimized
/// routines compiled for whatever reason, you may disable these optimizations
/// to make the library compile.
#define ALLOW_X86_OPTIMIZATIONS 1
#endif
// If defined, allows the SIMD-optimized routines to take minor shortcuts
// for improved performance. Undefine to require faithfully similar SIMD
@ -113,11 +115,9 @@ namespace soundtouch
#error "conflicting sample types defined"
#endif // FLOAT_SAMPLES
#ifdef ALLOW_OPTIMIZATIONS
#if (WIN32 || __i386__ || __x86_64__)
// Allow MMX optimizations
#define ALLOW_MMX 1
#endif
#ifdef ALLOW_X86_OPTIMIZATIONS
// Allow MMX optimizations
#define ALLOW_MMX 1
#endif
#else
@ -127,15 +127,13 @@ namespace soundtouch
// data type for sample accumulation: Use double to utilize full precision.
typedef double LONG_SAMPLETYPE;
#ifdef ALLOW_OPTIMIZATIONS
#ifdef ALLOW_X86_OPTIMIZATIONS
// Allow 3DNow! and SSE optimizations
#if WIN32
#define ALLOW_3DNOW 1
#endif
#if (WIN32 || __i386__ || __x86_64__)
#define ALLOW_SSE 1
#endif
#define ALLOW_SSE 1
#endif
#endif // INTEGER_SAMPLES

View File

@ -43,6 +43,7 @@
#include <stdexcept>
#include <string>
#include "cpu_detect.h"
#include "STTypes.h"
#ifndef __GNUC__
#error wrong platform - this source code file is for the GNU C compiler.
@ -72,8 +73,10 @@ void disableExtensions(uint dwDisableMask)
/// Checks which instruction set extensions are supported by the CPU.
uint detectCPUextensions(void)
{
#ifndef __i386__
#ifndef ALLOW_X86_OPTIMIZATIONS
return 0; // always disable extensions on non-x86 platforms.
#else
uint res = 0;