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

            Bug ID: 35295
           Summary: Potential improvement for vectorization of sub
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedb...@nondot.org
          Reporter: serguei.kat...@azul.com
                CC: llvm-bugs@lists.llvm.org

Hi,

I'm not sure that the example below is valid but still I'd like to understand
difference in vectorizer behavior for add and sub.

Let consider two following c++ functions (https://godbolt.org/g/WxjdMP):
void testAdd(signed char a[], int N, signed int k) {
  for (int i = 0; i < N; i++)
    a[i] += k;
}
void testSub(signed char a[], int N, signed int k) {
  for (int i = 0; i < N; i++)
    a[i] -= k;
}

for testAdd vectorizer is able to utilize packed byte size paddb instruction
while for sub it is not. Instead it uses psubd resulting in a big additional
code to convert vector of i8 to vector of i32 and vice versa.

I wonder whether it is possible to utilize psubb for the second case.
I noticed that both gcc and icc is able to do that...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to