The Meson Build System
http://mesonbuild.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1002 B
50 lines
1002 B
7 years ago
|
#include<simdheader.h>
|
||
|
|
||
|
#ifndef I_CAN_HAZ_SIMD
|
||
|
#error The correct internal header was not used
|
||
|
#endif
|
||
|
|
||
8 years ago
|
#include<simdconfig.h>
|
||
|
#include<simdfuncs.h>
|
||
8 years ago
|
#include<stdint.h>
|
||
|
|
||
|
#ifdef _MSC_VER
|
||
|
#include<intrin.h>
|
||
|
int avx_available() {
|
||
|
return 1;
|
||
|
}
|
||
|
#else
|
||
8 years ago
|
#include<immintrin.h>
|
||
|
#include<cpuid.h>
|
||
|
|
||
8 years ago
|
#ifdef __APPLE__
|
||
8 years ago
|
/*
|
||
|
* Apple ships a broken __builtin_cpu_supports and
|
||
|
* some machines in the CI farm seem to be too
|
||
|
* old to have AVX so just always return 0 here.
|
||
|
*/
|
||
|
int avx_available() { return 0; }
|
||
8 years ago
|
#else
|
||
|
|
||
8 years ago
|
int avx_available() {
|
||
|
return __builtin_cpu_supports("avx");
|
||
|
}
|
||
8 years ago
|
#endif
|
||
8 years ago
|
#endif
|
||
8 years ago
|
|
||
|
void increment_avx(float arr[4]) {
|
||
|
double darr[4];
|
||
|
darr[0] = arr[0];
|
||
|
darr[1] = arr[1];
|
||
|
darr[2] = arr[2];
|
||
|
darr[3] = arr[3];
|
||
|
__m256d val = _mm256_loadu_pd(darr);
|
||
|
__m256d one = _mm256_set1_pd(1.0);
|
||
|
__m256d result = _mm256_add_pd(val, one);
|
||
|
_mm256_storeu_pd(darr, result);
|
||
|
arr[0] = (float)darr[0];
|
||
|
arr[1] = (float)darr[1];
|
||
|
arr[2] = (float)darr[2];
|
||
|
arr[3] = (float)darr[3];
|
||
|
}
|