<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [SystemZ] Assertion "Invalid truncate node, src < dst!" failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=41780">41780</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SystemZ]  Assertion "Invalid truncate node, src < dst!" failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: SystemZ
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21901" name="attach_21901" title="reduced test case">attachment 21901</a> <a href="attachment.cgi?id=21901&action=edit" title="reduced test case">[details]</a></span>
reduced test case

llc -mcpu=z13 -O3 -o out.s ./tc_invalidtrunc.ll

SystemZTargetLowering::combineExtract() tries to truncate from i16 to i32.


I am a bit confused about all the implications of extracting a vector element
from a BUILD_VECTOR using possibly another vector type (VecVT) (?), so I have
not attempted a patch yet.

The comment "We're extracting the low part of one operand of the
BUILD_VECTOR.": does this mean we are expecting at this point to truncate the
value always? Or could we make an extension in the integer case, per the
comment:

/// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR
/// identified by the (potentially variable) element number IDX.  If the
/// return type is an integer type larger than the element type of the
/// vector, the result is extended to the width of the return type. In
/// that case, the high bits are undefined.

If we could do an ANY_EXTEND, this test case would be handled here (although I
am not sure if thats beneficial or not), or if not, I guess it should just
"break" (return without doing anything).</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>