title: Visual Studio 2017: _mm_load_ps often compiled to movups
body: <p>I am looking at the generated assembly for my code (using Visual Studio 2017) and noticed that _mm_load_ps is often (always?) compiled to movups. </p>
  
  <p>The data I'm using _mm_load_ps on is defined like this:</p>
  
  <pre><code>struct alignas(16) Vector {
      float v[4];
  }
  
  // often embedded in other structs like this
  struct AABB {
      Vector min;
      Vector max;
      bool intersection(/* parameters */) const;
  }
  </code></pre>
  
  <p>Now when I'm using this construct, the following will happen:</p>
  
  <pre><code>// this code
  __mm128 bb_min = _mm_load_ps(min.v);
  
  // generates this
  movups  xmm4, XMMWORD PTR [r8]
  </code></pre>
  
  <p>I'm expecting movaps because of alignas(16). Do I need something else to convince the compiler to use movaps in this case?</p>
  
  <p>EDIT: My question is different from <a href="https://stackoverflow.com/questions/12502071/sse-intrinsics-and-alignment">this question</a> because I'm not getting any crashes. The struct is specifically aligned and I'm also using aligned allocation. Rather, I'm curious why the compiler is switching  _mm_load_ps (the intrinsic for aligned memory) to movups. If I know struct was allocated at an aligned address and I'm calling it via this* it would be safe to use movaps, right?</p>