<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - [instcombine] vector math/logic doesn't get the same bitwise optimizations as scalar"
   href="https://llvm.org/bugs/show_bug.cgi?id=24942">24942</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[instcombine] vector math/logic doesn't get the same bitwise optimizations as scalar
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hole in SimplifyDemandedBits, computeKnownBits, or something else?

"31" and "2" don't have any special meaning here; lots of other constant pairs
could illustrate the same point:

define i32 @lshr_and_i32(i32 %x) {
  %lshr = lshr i32 %x, 31
  %and = and i32 %lshr, 2
  ret i32 %and
}

define <2 x i32> @lshr_and_v2i32(<2 x i32> %x) {
  %lshr = lshr <2 x i32> %x, <i32 31, i32 31>
  %and = and <2 x i32> %lshr, <i32 2, i32 2>
  ret <2 x i32> %and
}

$ ./opt -instcombine demand.ll -S 

define i32 @lshr_and_i32(i32 %x) {
  ret i32 0
}

define <2 x i32> @lshr_and_v2i32(<2 x i32> %x) {
  %lshr = lshr <2 x i32> %x, <i32 31, i32 31>
  %and = and <2 x i32> %lshr, <i32 2, i32 2>
  ret <2 x i32> %and
}</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>