<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 - _mm_avg_epu16 and _mm_avg_epu8 still broken..."
   href="https://bugs.llvm.org/show_bug.cgi?id=41496">41496</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>_mm_avg_epu16 and _mm_avg_epu8 still broken...
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.0
          </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: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jeffr@radgametools.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is a continuation of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - _mm_avg_epu16 preceded by a left shift results in poor code"
   href="show_bug.cgi?id=41316">bug 41316</a>, where we reported that a shift instruction
before mm_avg intrinsics caused terrible code to be generated. Simon fixed this
exact problem, but there are still lots of ways to trigger the terrible
behavior.

For example, try this on clang 5 vs 6 (or anything since, including the current
trunk):

int test(__m128i a, __m128i b)
{
  __m128i c;
  c = _mm_avg_epu8(a, b);
  c = _mm_avg_epu8(c, b);
  return _mm_cvtsi128_si32(c);
}

But it doesn't just trigger with two averages - on real routines, it fails with
other arithmetic instructions that fold into the avg (both 8 and 16) as well.

P.S. Just a data point as a heavy, heavy intrinsics-using company: we don't
want *ANY* of this.  I get that you want this stuff for autovec, but when we
write intrinsics, we want *those* intrinsics.  It would be nice if you flagged
intentional intrinsics and leave them alone.</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>