wasmer/lib/emscripten-tests/emtests/test_simd16.c

35 lines
730 B
C
Raw Normal View History

2018-12-27 07:46:41 +00:00
/*
* Copyright 2015 The Emscripten Authors. All rights reserved.
* Emscripten is available under two separate licenses, the MIT license and the
* University of Illinois/NCSA Open Source License. Both these licenses can be
* found in the LICENSE file.
*/
#include <xmmintrin.h>
#include <stdio.h>
class vec
{
public:
__m128 v;
void mul(float s)
{
__m128 vs = _mm_load_ss(&s);
// __m128 vs = _mm_set_ss(s); // _mm_set_ss(s) instead of _mm_load_ss(&s) avoids the problem somehow..?
v = _mm_mul_ps(v, vs);
}
};
int main()
{
vec v;
v.v = _mm_set_ps(8,8,8,8);
v.mul(0.5f);
float f[4];
_mm_storeu_ps(f, v.v);
printf("%f %f %f %f\n", f[0], f[1], f[2], f[3]);
}