Fix checks on MinGW and VS2010.
This commit is contained in:
parent
8396c4f3e6
commit
181510bd6e
|
@ -820,7 +820,7 @@ class VisualStudioCCompiler(CCompiler):
|
|||
'2': ['/W3'],
|
||||
'3': ['/W4']}
|
||||
self.base_options = ['b_pch'] # FIXME add lto, pgo and the like
|
||||
self.is_64 = True
|
||||
self.is_64 = is_64
|
||||
|
||||
# Override CCompiler.get_always_args
|
||||
def get_always_args(self):
|
||||
|
@ -1010,6 +1010,11 @@ class VisualStudioCCompiler(CCompiler):
|
|||
def get_instruction_set_args(self, instruction_set):
|
||||
if self.is_64:
|
||||
return vs64_instruction_set_args.get(instruction_set, None)
|
||||
if self.version.split('.')[0] == '16' and instruction_set == 'avx':
|
||||
# VS documentation says that this exists and should work, but
|
||||
# it does not. The headers do not contain AVX intrinsics
|
||||
# and the can not be called.
|
||||
return None
|
||||
return vs32_instruction_set_args.get(instruction_set, None)
|
||||
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ vs64_instruction_set_args = {'mmx': ['/arch:AVX'],
|
|||
'avx': ['/arch:AVX'],
|
||||
'avx2': ['/arch:AVX2'],
|
||||
'neon': None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def sanitizer_compile_args(value):
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
int mmx_available() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Contrary to MSDN documentation, MMX intrinsics
|
||||
* just plain don't work.
|
||||
*/
|
||||
|
@ -18,7 +17,18 @@ void increment_mmx(float arr[4]) {
|
|||
arr[2]++;
|
||||
arr[3]++;
|
||||
}
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
int mmx_available() {
|
||||
return 1;
|
||||
}
|
||||
/* MinGW does not seem to ship with MMX or it is broken.
|
||||
*/
|
||||
void increment_mmx(float arr[4]) {
|
||||
arr[0]++;
|
||||
arr[1]++;
|
||||
arr[2]++;
|
||||
arr[3]++;
|
||||
}
|
||||
#else
|
||||
#include<mmintrin.h>
|
||||
#include<cpuid.h>
|
||||
|
@ -30,12 +40,13 @@ void increment_mmx(float arr[4]) {
|
|||
/* Super ugly but we know that values in arr are always small
|
||||
* enough to fit in int16;
|
||||
*/
|
||||
int i;
|
||||
__m64 packed = _mm_set_pi16(arr[3], arr[2], arr[1], arr[0]);
|
||||
__m64 incr = _mm_set1_pi16(1);
|
||||
__m64 result = _mm_add_pi16(packed, incr);
|
||||
int64_t unpacker = _m_to_int64(result);
|
||||
_mm_empty();
|
||||
for(int i=0; i<4; i++) {
|
||||
for(i=0; i<4; i++) {
|
||||
arr[i] = (float)(unpacker & ((1<<16)-1));
|
||||
unpacker >>= 16;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue