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: unassignedb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to