Added SSE3 support.

pull/1374/head
Jussi Pakkanen 8 years ago
parent 953441badf
commit 0062595e13
  1. 4
      test cases/common/139 simd/meson.build
  2. 26
      test cases/common/139 simd/simd_sse3.c
  3. 6
      test cases/common/139 simd/simdchecker.c
  4. 5
      test cases/common/139 simd/simdfuncs.h

@ -17,7 +17,6 @@ cdata = configuration_data()
# and then have a target that uses the result in links_with.
# The following headers need to be added. Also Thumb and Altivec.
#<pmmintrin.h> SSE3
#<tmmintrin.h> SSSE3
#<smmintrin.h> SSE4.1
#<nmmintrin.h> SSE4.2
@ -28,9 +27,10 @@ cdata = configuration_data()
simdlibs = []
simdarr = [['-mmx', 'HAVE_MMX', 'simd_mmx', 'simd_mmx.c'],
simdarr = [['-mmmx', 'HAVE_MMX', 'simd_mmx', 'simd_mmx.c'],
['-msse', 'HAVE_SSE', 'simd_sse', 'simd_sse.c'],
['-msse2', 'HAVE_SSE2', 'simd_sse2', 'simd_sse2.c'],
['-msse3', 'HAVE_SSE3', 'simd_sse3', 'simd_sse3.c'],
]
foreach ia : simdarr

@ -0,0 +1,26 @@
#include<simdconfig.h>
#include<simdfuncs.h>
#include<pmmintrin.h>
#include<cpuid.h>
#include<stdint.h>
int sse3_available() {
return __builtin_cpu_supports("sse3");
}
void increment_sse3(float arr[4]) {
double darr[4];
__m128d val1 = _mm_set_pd(arr[0], arr[1]);
__m128d val2 = _mm_set_pd(arr[2], arr[3]);
__m128d one = _mm_set_pd1(1.0);
__m128d result = _mm_add_pd(val1, one);
_mm_store_pd(darr, result);
result = _mm_add_pd(val2, one);
_mm_store_pd(&darr[2], result);
result = _mm_hadd_pd(val1, val2); /* This does nothing. Only here so we use an SSE3 instruction. */
arr[0] = (float)darr[1];
arr[1] = (float)darr[0];
arr[2] = (float)darr[3];
arr[3] = (float)darr[2];
}

@ -17,6 +17,12 @@ int main(int argc, char **argv) {
/* Add here. The first matched one is used so put "better" instruction
* sets at the top.
*/
#if HAVE_SSE3
if(fptr == NULL && sse3_available()) {
fptr = increment_sse3;
type = "SSE3";
}
#endif
#if HAVE_SSE2
if(fptr == NULL && sse2_available()) {
fptr = increment_sse2;

@ -24,6 +24,11 @@ int sse2_available();
void increment_sse2(float arr[4]);
#endif
#if HAVE_SSE3
int sse3_available();
void increment_sse3(float arr[4]);
#endif
#if HAVE_AVX
int avx_available();
void increment_avx(float arr[4]);

Loading…
Cancel
Save