<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/150550>150550</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [WebAssembly] Compiler can't recognize avgr_u pattern in C
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:WebAssembly
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          badumbatish
      </td>
    </tr>
</table>

<pre>
    From @lukel97, currently the `avgr_u` is not recognized by the compiler in this godbolt https://godbolt.org/z/r6P1T6x9f

```C
void f(unsigned char *x, unsigned char *y, int n) {
  // should have been vectorized into avgr_u instead of seperated add and logical right shift
  for (int i = 0; i < n; i++)
    x[i] = (x[i] + y[i] + 1) / 2;
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxkksGOqzoMhp_GbKypUtOQsmBBW7G-iyvd5VUgLuRMSKokVNN5-iPojKY6R7JEYhn__uNPp2RHz9yAPIG8FHrJU4hNr80y9zrbNBV9MI-mi2FGOAi3vLOrFdAZhyVG9tk9ME-MUAl9H-P_C1QCbUIfMkYewujtJxvsn1VDmG_WcUTrMU824RhMH1zGKedbgrIF6oC6r-wuxBGo-wTqYvXP_t_qo76CaNeoxDPOINp7sAavQMfFb2YMDpOOCNR-rHP-lX2sWeszeqAaQZ1AtIhPZUxTWJzBSd8Ze2aPdx5yiJsJ63PAp0u0PmXWBsMVE9846swGtTGovUEXRjtoh9GOU8Y02WveNK5hHeC4aluE8oICytN2PKPfjkCnLeqtHvED5MmCvGzVQMefO53w8XrZb2aoQ4JydQTq8vpQhWlKU5e1LrjZK1kehFCqKqamOlaCjiVLlkobNRjVD4NhvpY1CVnrwjYkSApFByoP1b7aVaXaK7UvNbFRlZFwEDxr63bO3ed1Z4VNaeFmL4WUonC6Z5c2wIh6PbyzN1C2_3HfpsRz7x5AtLIXm7XBW7-MaSXNppx-Wmab3Ubp63_ygudvogbtgdQLdN-buumcOfoVuXOxRNf8wZrN09LvhjADdavc1-ftFsMvHjJQt9lJQN2Xo3tDvwMAAP__9PD9mw">