title: Odd memcpy_s behaviour in VS2015
body: <p>recently I was profiling one application, and I have noticed that memcpy_s assembly implementation behaves strangely.
  I'm talking about implementation residing in Microsoft Visual Studio 14.0\VC\crt\src\i386\memcpy.asm
  I'm reaching the CopyUpLargeMov: then I expect it to choose the SSE2 path, or use any other available optimized implementation.
  the code as following:</p>
  
  <pre><code>    CopyUpLargeMov:
          bt      __favor, __FAVOR_ENFSTRG        ; check if Enhanced Fast Strings is supported
          jnc     CopyUpSSE2Check                 ; if not, check for SSE2 support
          rep     movsb
          mov     eax,[esp + 0Ch]                 ; return original destination pointer
          pop     esi
          pop     edi
          M_EXIT
  </code></pre>
  
  <p>Whatever I do with optimization tweaking it never reaches <code>CopyUpSSE2Check</code>. <br>Tested with Release|Win32, VS2015 Upd3, Windows10 x64.</p>
  
  <p>The actual C++ code</p>
  
  <pre><code>std::vector&lt;uint8_t&gt; src(1024*1024*20,0);
  std::vector&lt;uint8_t&gt; dst(1024*1024*20,0);
  for (auto i = 0ul; i &lt; 1000; ++i)
  {
      memcpy_s(dst.data(), dst.size(), src.data(), src.size());
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT001:
  <br>It seems that x64 does not exhibits the strange behavior, it falls into Enhanced Fast Strings optimization part of the code. Maybe the above a x86 limitation?</p>