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

            Bug ID: 51978
           Summary: Missing reduction add for vector(4) char
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

void foo_notvectorized(unsigned char *p, unsigned char *t) {
  char sum = 0;
  for (int i = 0; i != 4; i++)
    sum += p[i];
  *t = sum;
}

char foo_vectorized(char *p) {
  char sum = 0;
  for (int i = 0; i != 4; i++)
    sum += p[i];
  return sum;
}

foo_notvectorized:                      # @foo_notvectorized
        mov     al, byte ptr [rdi + 1]
        add     al, byte ptr [rdi]
        add     al, byte ptr [rdi + 2]
        add     al, byte ptr [rdi + 3]
        mov     byte ptr [rsi], al
        ret
foo_vectorized:                         # @foo_vectorized
        movd    xmm0, dword ptr [rdi]           # xmm0 = mem[0],zero,zero,zero
        pxor    xmm1, xmm1
        psadbw  xmm1, xmm0
        movd    eax, xmm1
        ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to