Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "immintrin.h"
- int main(int argc, char ** argv){
- int numElements = 2000;
- double data[numElements];
- for(int i = 0; i < numElements; ++i){
- data[i] = (double) i;
- }
- __m512d result;
- __m512d summand = _mm512_set1_pd(2.0);
- __m256i offsets = _mm256_set_epi32(7,6,5,4,3,2,1,0);
- for(int i = 0; i < numElements/sizeof(double); ++i){
- result = _mm512_i32gather_pd(offsets, data, sizeof(double));
- result = _mm512_add_pd(result, summand);
- _mm512_i32scatter_pd(data, offsets, result, sizeof(double));
- }
- std::cout << "Value: " << data[1] << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment