Created
February 8, 2023 02:39
-
-
Save ClarkThan/da2911e8665851352056c4633fb1d83e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#ifdef __AVX__ | |
#include <immintrin.h> | |
#else | |
#warning No AVX support - will not compile | |
#endif | |
int main(int argc, char **argv) | |
{ | |
__m256 a = _mm256_set_ps(8.0, 7.0, 6.0, 5.0, | |
4.0, 3.0, 2.0, 1.0); | |
__m256 b = _mm256_set_ps(18.0, 17.0, 16.0, 15.0, | |
14.0, 13.0, 12.0, 11.0); | |
__m256 c = _mm256_add_ps(a, b); | |
float d[8]; | |
_mm256_storeu_ps(d, c); | |
std::cout << "result equals " << d[0] << "," << d[1] | |
<< "," << d[2] << "," << d[3] << "," | |
<< d[4] << "," << d[5] << "," << d[6] << "," | |
<< d[7] << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment