<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Better unsigned byte, short, int and long rotations"
   href="https://bugs.llvm.org/show_bug.cgi?id=16726">bug 16726</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>spatel+llvm@rotateright.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>REOPENED
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Better unsigned byte, short, int and long rotations"
   href="https://bugs.llvm.org/show_bug.cgi?id=16726#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Better unsigned byte, short, int and long rotations"
   href="https://bugs.llvm.org/show_bug.cgi?id=16726">bug 16726</a>
              from <span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span></b>
        <pre>After <a href="https://reviews.llvm.org/rL310509">https://reviews.llvm.org/rL310509</a> (an IR solution):

$ ./clang -O2 16726.c -S -o - |grep ro | grep \%
        rolb    %cl, %dil
        rorb    %cl, %dil
        rolw    %cl, %di
        rorw    %cl, %di
        roll    %cl, %edi
        rorl    %cl, %edi
        rolq    %cl, %rdi
        rorq    %cl, %rdi

Note: 
1. I don't think the code examples as written in C are safe - if the shift
amount exceeds the type width or is 0, then you have UB.

2. We're still producing 'and' to mask the rotation amount which seems
unnecessary based on the gcc code. There's more discussion about that in the
newer <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [InstCombine] Failure to simplify IR to allow recognition of i8 and i16 rotation patterns"
   href="show_bug.cgi?id=34046">bug 34046</a>, so I'm going to resolve this one (feel free to reopen if you
disagree) and leave that one open.</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>