<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Wrong alignment with _mm_move_epi64()"
   href="http://llvm.org/bugs/show_bug.cgi?id=22010">22010</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong alignment with _mm_move_epi64()
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vvsed@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This program crashes due to wrong alignment.
_mm_move_epi64() translates to vmovapd instead of movq.
Similar _mm_loadl_epi64() intrinsic works well.
Tested it with -O2 -mavx2 options; perhaps that doesn't matter.


#include <stdlib.h>
#include <stdio.h>
#include <emmintrin.h>

__attribute__((aligned(16))) int    zz[8];

int main()
{
    __m128i r = _mm_move_epi64(*(__m128i *)(zz + 1));
    r = _mm_castpd_si128(_mm_loadh_pd(_mm_castsi128_pd(r), (const double
*)zz));

    printf("%d", _mm_cvtsi128_si32(r));
    return 0;
}

// 64-bit
vmovapd     xmm0,xmmword ptr [13F2422F4h]        //movq
vmovhpd     xmm0,xmm0,qword ptr [13F2422F0h]  

// 32-bit
vmovapd     xmm0,xmmword ptr ds:[0F13034h]        //movq
vmovhpd     xmm0,xmm0,qword ptr ds:[0F13030h]</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>