Skip to content

Instantly share code, notes, and snippets.

@Daiver
Created June 10, 2019 12:11
Show Gist options
  • Save Daiver/ad4280b4fa4facef7cd4211396402379 to your computer and use it in GitHub Desktop.
Save Daiver/ad4280b4fa4facef7cd4211396402379 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <xmmintrin.h>
void foo(const float num, const float denom)
{
typedef __v4sf Vec4;
//typedef __m128 Vec4;
const Vec4 num4 = {
num,
num,
num,
num,
};
const Vec4 denom4 = {
denom,
denom,
denom,
denom,
};
//float res_arr[4] __attribute__ ((aligned (16)));
Vec4 res;// = (Vec4*)res_arr;
res = num4 / denom4;
float *res_arr=(float*)&res;
std::cout << res_arr[0] << std::endl;
std::cout << res_arr[1] << std::endl;
std::cout << res_arr[2] << std::endl;
std::cout << res_arr[3] << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment