[LLVMbugs] [Bug 17795] New: Loops with xors aren't vectorized

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 3 23:55:33 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=17795

            Bug ID: 17795
           Summary: Loops with xors aren't vectorized
           Product: libraries
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: alex.gaynor at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Here is an example, I would expect the loop to be converted into a PXOR
instruction, or at least have a few iterations unrolled:

/tmp $ pygmentize t.c
#include <stdio.h>


void f(unsigned char *restrict a, unsigned char *restrict b) {
    for (size_t i = 0; i < 128; i++) {
        b[i] = 0x36 ^ a[i];
    }
}
/tmp $ clang -O3 -S t.c
/tmp $ clang --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
/tmp $ cat t.s
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _f
    .align    4, 0x90
_f:                                     ## @f
    .cfi_startproc
## BB#0:
    pushq    %rbp
Ltmp2:
    .cfi_def_cfa_offset 16
Ltmp3:
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
Ltmp4:
    .cfi_def_cfa_register %rbp
    xorl    %eax, %eax
    .align    4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
    movb    (%rdi,%rax), %cl
    xorb    $54, %cl
    movb    %cl, (%rsi,%rax)
    incq    %rax
    cmpq    $128, %rax
    jne    LBB0_1
## BB#2:
    popq    %rbp
    ret
    .cfi_endproc


.subsections_via_symbols

-- 
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/20131104/d9c6a8af/attachment.html>


More information about the llvm-bugs mailing list