1 /* 2 * https://www.codeproject.com/Articles/874396/Crunching-Numbers-with-AVX-and-AVX 3 * 2016, Matt Scarpino, released under the Code Project Open License 4 * https://www.codeproject.com/info/cpol10.aspx 5 */ 6 7 #include <immintrin.h> 8 #include <stdio.h> 9 10 int main() { 11 12 /* Initialize the two argument vectors */ 13 __m256 evens = _mm256_set_ps(2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0); 14 __m256 odds = _mm256_set_ps(1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0); 15 16 /* Compute the difference between the two vectors */ 17 __m256 result = _mm256_sub_ps(evens, odds); 18 19 /* Display the elements of the result vector */ 20 float* f = (float*)&result; 21 printf("%f %f %f %f %f %f %f %f\n", 22 f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]); 23 24 return 0; 25 } 26