daily pastebin goal
82%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <vector>
  2. #include <iostream>
  3. union sse_float4 {
  4.     float __attribute__ ((vector_size (16))) vector;
  5.     float elements[4];
  6. };
  7.  
  8. int main() {
  9.  
  10.     sse_float4 fa;
  11.     fa.elements[0] = 0.0f;
  12.     fa.elements[1] = 1.0f;
  13.     fa.elements[2] = 2.0f;
  14.     fa.elements[3] = 3.0f;
  15.  
  16.     bool doVector = false;
  17.  
  18.     if (doVector) {
  19.         for (int i=0; i<1000000000; i++) {
  20.  
  21.             fa.vector =  fa.vector + fa.vector;
  22.         }
  23.     } else {
  24.         for (int i=0; i<1000000000; i++) {
  25.             fa.elements[0] = fa.elements[0] + fa.elements[0];
  26.             fa.elements[3] = fa.elements[3] + fa.elements[3];
  27.             fa.elements[2] = fa.elements[2] + fa.elements[1];
  28.             fa.elements[1] = fa.elements[1] + fa.elements[1];
  29.         }
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top