<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 - DAGCombine incorrecly eliminates vector extension/truncation sequence"
   href="https://bugs.llvm.org/show_bug.cgi?id=33368">33368</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DAGCombine incorrecly eliminates vector extension/truncation sequence
          </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>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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Wolfgang_Pieb@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>// The following test case (derived from a randomly generated
// case) fails with -O2 (Linux):

typedef char __attribute__((ext_vector_type(2))) char2;
typedef char __attribute__((ext_vector_type(8))) char8;

extern "C" int printf(const char *, ...);

__attribute__((noinline)) void use(char2 c) {
  volatile char2 cc = c;
}

__attribute__((noinline)) void test(char8 vec) {
  char2 b2 = vec.zxxx.wx;
  volatile char2 c2 = b2;
  printf("c2:%x %x => ", c2[0], c2[1]);
  if (c2[1] == 3)
    printf("PASSED\n");
  else
    printf("FAILED\n");
  use(b2);
}

int main() {
  char8 vec = {1, 2, 3, 4, 5, 6, 7, 8};
  test(vec);
}
// ====== end here ==========

DAGcombine incorrectly eliminates a combination of vector extension/
vector truncation because it only examines the element sizes of the
respective source and target vectors without considering the scales
of extension and truncation. The failing case extends by 2 (i8->i16)
and subsequently truncates by 8 (i64->i8), so the intermediate 
operations cannot be eliminated.</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>