<html>
    <head>
      <base href="https://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 --- - AVX _mm256_extract_epi8 broken"
   href="https://llvm.org/bugs/show_bug.cgi?id=27594">27594</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AVX _mm256_extract_epi8 broken
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rozhuk.im@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I try port some SSE code to AVX and found that clang instricts
_mm256_extract_epi8 broken:

_mm256_extract_epi8(__aymm0, 0) - BAD result
_mm256_extract_epi8(__aymm0, 0) & 0xff - OK
_mm_extract_epi8(_mm256_extractf128_si256(__aymm0, 0), 0) - OK

Same time: _mm256_extract_epi8(__aymm0, 0) build with GCC - OK.


CLANG:
static __inline int __attribute__((__always_inline__, __nodebug__))
_mm256_extract_epi8(__m256i __a, int const __imm)
{
  __v32qi __b = (__v32qi)__a;
  return __b[__imm & 31];
}


GCC:
extern __inline int __attribute__((__gnu_inline__, __always_inline__,
__artificial__)) 
_mm256_extract_epi8 (__m256i const __X, int const __N) 

  __m128i __Y = _mm256_extractf128_si256 (__X, __N >> 4); 
  return _mm_extract_epi8 (__Y, __N % 16); 
}



_mm256_extract_epi16, _mm256_extract_epi32 may be affected too.
Tested with: Clang 3.4.1, 3.6, 3.7 and GCC 4.8.5</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>