[llvm-bugs] [Bug 36702] New: llvm.experimental.reduce.{and, any} don't lower properly for boolean vectors
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 13 08:38:32 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=36702
Bug ID: 36702
Summary: llvm.experimental.reduce.{and, any} don't lower
properly for boolean vectors
Product: new-bugs
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: gonzalobg88 at gmail.com
CC: chandlerc at gmail.com, llvm-bugs at lists.llvm.org
I'd expect a way to be able to lower llvm.experimental.vector.reduce.and to
@llvm.x86.sse2.pmovmskb.128 on x86_64 and similar instructions in other
architectures when the input vectors are boolean vectors, that is, when their
lanes have either all bits cleared, or set. The same applies to
llvm.experimental.vector.reduce.any.
For example (thanks Chandler for coming up with this):
declare i1 @llvm.experimental.vector.reduce.and.i1.v16i1(<16 x i1>)
declare void @llvm.assume(i1)
declare void @a()
declare void @b()
define void @stdsimd_all_8x16(<16 x i8>* noalias nocapture dereferenceable(16)
%ptr) unnamed_addr #0 {
%v = load <16 x i8>, <16 x i8>* %ptr, align 16
%t = trunc <16 x i8> %v to <16 x i1>
%e1 = sext <16 x i1> %t to <16 x i8>
%e2 = icmp eq <16 x i8> %v, %e1
%e3 = call i1 @llvm.experimental.vector.reduce.and.i1.v16i1(<16 x i1> %e2)
call void @llvm.assume(i1 %e3)
%x = call i1 @llvm.experimental.vector.reduce.and.i1.v16i1(<16 x i1> %t)
br i1 %x, label %a, label %b
a:
call void @a()
ret void
b:
call void @b()
ret void
}
should emit:
push rbp
mov rbp, rsp
movdqa xmm0, xmmword, ptr, [rdi]
pmovmskb eax, xmm0
cmp eax, 65535
sete al
pop rbp
ret
and replacing "reduce.and" with "reduce.any" should emit:
push rbp
mov rbp, rsp
movdqa xmm0, xmmword, ptr, [rdi]
pmovmskb eax, xmm0
test eax, eax
setne al
pop rbp
ret
--
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/20180313/1668750e/attachment.html>
More information about the llvm-bugs
mailing list