Created
December 22, 2016 07:56
-
-
Save dtoma/cee2cfebaa892e4f70277ace71166882 to your computer and use it in GitHub Desktop.
SSE add 2 arrays
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 <cstdio> | |
#include <array> | |
#include <x86intrin.h> | |
int main() { | |
__m128 vector_a = { 1, 2, 3, 4 }; | |
__m128 vector_b = { 5, 6, 7, 8 }; | |
vector_a = _mm_add_ps(vector_a, vector_b); | |
std::array<float, 4> a; | |
_mm_store_ps(a.data(), vector_a); | |
for (auto f : a) { | |
printf("%d ", (int)f); | |
} | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment