[llvm-bugs] [Bug 35295] New: Potential improvement for vectorization of sub

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 14 00:16:44 PST 2017


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: unassignedbugs at nondot.org
          Reporter: serguei.katkov at azul.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171114/be4f18e3/attachment.html>


More information about the llvm-bugs mailing list