<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 - Combine shuffle(fneg(x),fneg(y)) -> fneg(shuffle(x,y))"
   href="https://bugs.llvm.org/show_bug.cgi?id=46286">46286</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Combine shuffle(fneg(x),fneg(y)) -> fneg(shuffle(x,y))
          </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>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://godbolt.org/z/cHgY_S">https://godbolt.org/z/cHgY_S</a>

For cases such as:

define <4 x float> @fneg_concat_v2f32(<2 x float> %a0, <2 x float> %a1) {
  %1 = fneg <2 x float> %a0
  %2 = fneg <2 x float> %a1
  %3 = shufflevector <2 x float> %1, <2 x float> %2, <4 x i32> <i32 0, i32 1,
i32 2, i32 3>
  ret <4 x float> %3
}
define <4 x float> @fneg_concat_v4f32(<4 x float> %a0, <4 x float> %a1) {
  %1 = fneg <4 x float> %a0
  %2 = fneg <4 x float> %a1
  %3 = shufflevector <4 x float> %1, <4 x float> %2, <4 x i32> <i32 0, i32 1,
i32 4, i32 5>
  ret <4 x float> %3
}

we are almost certainly better off moving the fneg after the shuffle:

define <4 x float> @concat_fneg_v2f32(<2 x float> %a0, <2 x float> %a1) {
  %1 = shufflevector <2 x float> %a0, <2 x float> %a1, <4 x i32> <i32 0, i32 1,
i32 2, i32 3>
  %2 = fneg <4 x float> %1
  ret <4 x float> %2
}
define <4 x float> @concat_fneg_v4f32(<4 x float> %a0, <4 x float> %a1) {
  %1 = shufflevector <4 x float> %a0, <4 x float> %a1, <4 x i32> <i32 0, i32 1,
i32 4, i32 5>
  %2 = fneg <4 x float> %1
  ret <4 x float> %2
}

Binops would probably benefit in some cases (constant operand?) as well.

The issue that vectorcombine might encounter though is that we fail to get
costs for most length changing shuffles, so the 'concat_vectors' shuffle
pattern returns an 'Unknown' cost.</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>