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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to