[llvm-bugs] [Bug 16726] Better unsigned byte, short, int and long rotations

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 9 12:13:24 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=16726

Sanjay Patel <spatel+llvm at rotateright.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |spatel+llvm at rotateright.com
             Status|REOPENED                    |RESOLVED

--- Comment #5 from Sanjay Patel <spatel+llvm at rotateright.com> ---
After https://reviews.llvm.org/rL310509 (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 bug 34046, so I'm going to resolve this one (feel free to reopen if you
disagree) and leave that one open.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170809/3c17881f/attachment.html>


More information about the llvm-bugs mailing list