<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 - Support for saturated vector increment"
href="https://bugs.llvm.org/show_bug.cgi?id=34621">34621</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Support for saturated vector increment
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>llvm@henning-thielemann.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I have a special case of <a class="bz_bug_link
bz_status_NEW "
title="NEW - X86: Need to implement a pattern for saturated add/sub"
href="show_bug.cgi?id=14613">https://bugs.llvm.org/show_bug.cgi?id=14613</a> .
I add a vector to another vector but the first operand contains only zeros and
ones.
define <16 x i8> @increment_vector_sat(<16 x i8>, <16 x i8>) {
_L1:
%v0 = and <16 x i8> %0, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8
1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%v1 = add <16 x i8> %v0, %1
%b = icmp ult <16 x i8> %1, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
%v2 = select <16 x i1> %b, <16 x i8> %v1, <16 x i8> %1
ret <16 x i8> %v2
}
$ opt-4.0 -O3 < bit-vector.ll | llc-4.0
.section .rodata.cst16,"aM",@progbits,16
.p2align 4
.LCPI5_0:
.zero 16,1
.text
.globl increment_vector_sat
.p2align 4, 0x90
.type increment_vector_sat,@function
increment_vector_sat: # @increment_vector_sat
# BB#0: # %_L1
pand .LCPI5_0(%rip), %xmm0
paddb %xmm1, %xmm0
pcmpeqd %xmm2, %xmm2
pcmpeqb %xmm1, %xmm2
por %xmm2, %xmm0
retq
.Lfunc_end5:
.size increment_vector_sat, .Lfunc_end5-increment_vector_sat
Could the X86 backend replace 'paddb' and the following code by a simple
'paddusb'?
An alternative would be a saturated add intrinsics.</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>