<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 --- - Invalid shufflevector operands" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23800&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=OuJVgeEaAYHw0FIkUFxfFYvYv1O5u5LvlQu_8wIQUMo&s=3j-f7wk-P-muXC4Kc4IlvLh5s1PE-JPjFTsnEXBYBBM&e=">23800</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Invalid shufflevector operands
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>moritz.pflanzer14@imperial.ac.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14452" name="attach_14452" title="Test-case with produces the wrong code">attachment 14452</a> <a href="attachment.cgi?id=14452&action=edit" title="Test-case with produces the wrong code">[details]</a></span>
Test-case with produces the wrong code

The following (OpenCL) code results in undef operands of a shufflevector LLVM
IR instruction when compiled with clang.

$ clang -S -emit-llvm -O0 -o - input.c

Clang and LLVM have been built from trunk. The bug does not occur with "Apple
LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)".

Test-case:

typedef unsigned int uint16 __attribute((ext_vector_type(16)));
typedef unsigned int uint8 __attribute((ext_vector_type(8)));

void test1(void) {
    (uint16)(((uint16)0).s0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}

Part of LLVM IR:

%5 = shufflevector <16 x i32> %3, <16 x i32> undef, <16 x i64> <i64 0, i64
undef, i64 undef, i64 undef, i64 undef, i64 undef, i64 undef, i64 undef, i64
undef, i64 undef, i64 undef, i64 undef, i64 undef, i64 undef, i64 undef, i64
undef></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>