<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 - Missing transformation rotate(x) == 0 to x == 0"
   href="https://bugs.llvm.org/show_bug.cgi?id=51566">51566</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing transformation rotate(x) == 0 to x == 0
          </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>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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.bolvansky@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>bool test1(unsigned long long x)
{
  unsigned long long r = (x << 32) | (x >> 32);
  return r != 0;

}

bool test2(unsigned long long x)
{
  unsigned long long r = (x << 32) | (x >> 32);
  return r == ~0ULL;
}

Trunk -O3:
test1(unsigned long long):                              # @test1(unsigned long
long)
        rol     rdi, 32
        test    rdi, rdi
        setne   al
        ret
test2(unsigned long long):                              # @test2(unsigned long
long)
        rol     rdi, 32
        cmp     rdi, -1
        sete    al
        ret
test3(unsigned long long):                              # @test3(unsigned long
long)
        rol     rdi, 32
        test    rdi, rdi
        setne   al
        ret


Current codegen:
<a href="https://godbolt.org/z/q78xxhWe4">https://godbolt.org/z/q78xxhWe4</a>


----------------------------------------
define i1 @src(i64 %0) {
%1:
  %2 = fshr i64 %0, i64 %0, i64 32
  %3 = icmp ne i64 %2, 0
  ret i1 %3
}
=>
define i1 @tgt(i64 %0) {
%1:
  %2 = icmp ne i64 %0, 0
  ret i1 %2
}
Transformation seems to be correct!



----------------------------------------
define i1 @src(i64 %0) {
%1:
  %2 = fshr i64 %0, i64 %0, i64 32
  %3 = icmp ne i64 %2, -1
  ret i1 %3
}
=>
define i1 @tgt(i64 %0) {
%1:
  %2 = icmp ne i64 %0, -1
  ret i1 %2
}
Transformation seems to be correct!

Alive:
<a href="https://alive2.llvm.org/ce/z/kmrBvv">https://alive2.llvm.org/ce/z/kmrBvv</a></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>