[llvm-bugs] [Bug 34621] New: Support for saturated vector increment
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 15 04:10:14 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34621
Bug ID: 34621
Summary: Support for saturated vector increment
Product: libraries
Version: 4.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm at henning-thielemann.de
CC: llvm-bugs at lists.llvm.org
I have a special case of https://bugs.llvm.org/show_bug.cgi?id=14613 .
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", at progbits,16
.p2align 4
.LCPI5_0:
.zero 16,1
.text
.globl increment_vector_sat
.p2align 4, 0x90
.type increment_vector_sat, at 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.
--
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/20170915/bd1214e5/attachment-0001.html>
More information about the llvm-bugs
mailing list