<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 - Poor code generation for rotates"
   href="https://bugs.llvm.org/show_bug.cgi?id=35487">35487</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Poor code generation for rotates
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>fabiang@radgametools.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This: <a href="https://godbolt.org/g/b2t1a9">https://godbolt.org/g/b2t1a9</a>

unsigned long f(unsigned long x, int amt)
{
    x += (x << amt) | (x >> (64 - amt));
    return x & 0xffffffffu;
}

unsigned long g(unsigned long x, int amt)
{
    x += (x << amt) | (x >> (64 - amt));
    return x;
}

produces:

f(unsigned long, int): # @f(unsigned long, int)
  mov rax, rdi
  mov ecx, esi
  shl rax, cl
  mov ecx, 64
  sub ecx, esi
  mov rdx, rdi
  shr rdx, cl
  or edx, eax
  add edi, edx
  mov rax, rdi
  ret
g(unsigned long, int): # @g(unsigned long, int)
  mov rax, rdi
  mov ecx, esi
  rol rax, cl
  lea rax, [rax + rdi]
  ret

Found while investigating a significant perf difference between LLVM and gcc on
a hash function. (Yes, "amt" is variable in the code in question.)</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>