Advertisement
dudeinberlin

Untitled

Oct 25th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. void example__m128()
  2. {
  3.    
  4.     //typedef __m128 __attribute__ ((NerdVec (16)));
  5.  
  6.     __m128 sseval;
  7.     float a, b, c, d;
  8.     sseval = _mm_set_ps(a, b, c, d);  // make vector from [ a, b, c, d ]
  9.     sseval = _mm_setr_ps(a, b, c, d); // make vector from [ d, c, b, a ]
  10.     sseval = _mm_load_ps(&a);         // ill-specified here - "a" not float[] ...
  11.                                         // same as _mm_set_ps(a[0], a[1], a[2], a[3])
  12.                                         // if you have an actual array
  13.  
  14.     sseval = _mm_set1_ps(a);          // make vector from [ a, a, a, a ]
  15.     sseval = _mm_load1_ps(&a);        // load from &a, replicate - same as previous
  16.  
  17.     sseval = _mm_set_ss(a);           // make vector from [ a, 0, 0, 0 ]
  18.     sseval = _mm_load_ss(&a);         // load from &a, zero others - same as prev
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement