<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Potential improvement for vectorization of sub"
href="https://bugs.llvm.org/show_bug.cgi?id=35295">35295</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Potential improvement for vectorization of sub
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>serguei.katkov@azul.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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 (<a href="https://godbolt.org/g/WxjdMP">https://godbolt.org/g/WxjdMP</a>):
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...</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>