I have a rather simple question, but after searching quite some time I found no real answer yet. Microsoft suggests to enable AVX enhanced instruction set in order to also make use of SSE4 optimized code. Unfortunately, despite some readings, this enforces also use of an AVX capable CPU. Is there a way known to enable SSE4 without enforcing AVX in VC2013? Background of this question is obvious I think, SSE4 is longer supported and only requires older CPU's (first from 2006 I think), while AVX requires CPU's from 2011. The dll in question only uses optimizations for SSE4, but for now I have to stick with SSE2 sacrificing performance in order to keep it working.
It seems that /arch:SSE2
flag adds support for SSE2 and later intrinsics. I don't have Visual Studio installed but this example works(_mm_floor_ps
is SSE4 specific) :
#include <smmintrin.h>
#include <iostream>
using namespace std;
int main()
{
__declspec(align(16)) float values[4] = {1.3f, 2.1f, 4.3f, 5.1f};
for(int i = 0; i < 4; i++)
cout << values[i] << ' ';
cout << endl;
__m128 x = _mm_load_ps(values);
x = _mm_floor_ps(x);
_mm_store_ps(values, x);
for(int i = 0; i < 4; i++)
cout << values[i] << ' ';
cout << endl;
}
You can try it online here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With