[llvm-bugs] [Bug 41098] New: Missed rotate oportunity

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 16 09:56:21 PDT 2019


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

            Bug ID: 41098
           Summary: Missed rotate oportunity
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Not sure if reported or not.. please close if a duplicate..

struct edge {
    unsigned char from;
    unsigned char to;
};

void reverse_edge(struct edge *e) {
    unsigned char tmp = e->from;
    e->from = e->to;
    e->to = tmp;
}

Clang -O3:

reverse_edge(edge*):                 # @reverse_edge(edge*)
        mov     al, byte ptr [rdi]
        mov     cl, byte ptr [rdi + 1]
        mov     byte ptr [rdi], cl
        mov     byte ptr [rdi + 1], al
        ret

GCC generates

reverse_edge(edge*):
        rol     WORD PTR [rdi], 8
        ret

-- 
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/20190316/6bbd6e44/attachment.html>


More information about the llvm-bugs mailing list