<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 - [VectorCombine] Generated code no longer uses horizontal add/sub"
   href="https://bugs.llvm.org/show_bug.cgi?id=45747">45747</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[VectorCombine] Generated code no longer uses horizontal add/sub
          </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>Windows NT
          </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>Scalar Optimizations
          </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>After
<a href="https://github.com/llvm/llvm-project/commit/a69158c12acd635ee4bcb22b1060d92b29483042">https://github.com/llvm/llvm-project/commit/a69158c12acd635ee4bcb22b1060d92b29483042</a>
the following test cases no longer generate horizontal add/sub for the
following test cases:
==========================================================================
typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16)));

__m128 add_ps_002(__m128 a, __m128 b) {
  __m128 r = (__m128){ a[0] + a[1], a[2] + a[3], b[0] + b[1], b[2] + b[3] };
  return __builtin_shufflevector(r, a, -1, 1, -1, -1);
}

__m128 add_ps_013(__m128 a, __m128 b) {
  __m128 r = (__m128){ a[0] + a[1], a[2] + a[3], b[0] + b[1], b[2] + b[3] };
  return __builtin_shufflevector(r, a, 3, -1, -1, -1);
}
==========================================================================
The diffs (old code first):

<       vhaddps %xmm0, %xmm0, %xmm0
<       vmovshdup       %xmm0, %xmm0    # xmm0 = xmm0[1,1,3,3]
---
<span class="quote">>       vmovshdup       %xmm0, %xmm1    # xmm1 = xmm0[1,1,3,3]
>       vaddps  %xmm0, %xmm1, %xmm0
>       vpermilps       $232, %xmm0, %xmm0 # xmm0 = xmm0[0,2,2,3]</span >
24,25c25,27
<       vhaddps %xmm1, %xmm1, %xmm0
<       vmovshdup       %xmm0, %xmm0    # xmm0 = xmm0[1,1,3,3]
---
<span class="quote">>       vmovshdup       %xmm1, %xmm0    # xmm0 = xmm1[1,1,3,3]
>       vaddps  %xmm1, %xmm0, %xmm0
>       vpermilpd       $1, %xmm0, %xmm0 # xmm0 = xmm0[1,0]</span ></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>