<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 - ptest not used for pointer comparison (but is for integer)"
href="https://bugs.llvm.org/show_bug.cgi?id=35129">35129</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ptest not used for pointer comparison (but is for integer)
</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>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>listmail@philipreames.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>In the two snippets below, we see that instruction selection is currently
failing to select a vptest for the vector-of-pointer null test, but is using
the vptest sequence for vector-of-ints null test.
define <2 x i8*> @test_opt(<2 x i8*>* %p) {
%ptrs = load <2 x i8*>, <2 x i8*>* %p
%cmp = icmp eq <2 x i8*> %ptrs, zeroinitializer
%cmp.cast = bitcast <2 x i1> %cmp to i2
%cmp2 = icmp ne i2 %cmp.cast, 0
br i1 %cmp2, label %slow, label %next, !perf !0
next:
ret <2 x i8*> %ptrs
slow:
%ptr1 = extractelement <2 x i8*> %ptrs, i32 0
%ptr2 = extractelement <2 x i8*> %ptrs, i32 1
call void @bar(i8* %ptr1)
call void @bar(i8* %ptr2)
br label %next
}
define <2 x i8*> @test_sidestep(<2 x i8*>* %p) {
%ptrs = load <2 x i8*>, <2 x i8*>* %p
%int.vec = ptrtoint <2 x i8*> %ptrs to <2 x i64>
%int = bitcast <2 x i64> %int.vec to i128
%cmp2 = icmp ne i128 %int, 0
br i1 %cmp2, label %slow, label %next, !perf !0
next:
ret <2 x i8*> %ptrs
slow:
%ptr1 = extractelement <2 x i8*> %ptrs, i32 0
%ptr2 = extractelement <2 x i8*> %ptrs, i32 1
call void @bar(i8* %ptr1)
call void @bar(i8* %ptr2)
br label %next
}
Run with -mcpu=skylake, we get:
test_opt: # @test_opt
.cfi_startproc
# BB#0:
pushq %rbx
.cfi_def_cfa_offset 16
subq $16, %rsp
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -16
vmovdqa (%rdi), %xmm0
vpxor %xmm1, %xmm1, %xmm1
vpcmpeqq %xmm1, %xmm0, %xmm1
vmovmskpd %xmm1, %eax
testb %al, %al
je .LBB1_2
... trimmed irrelevant ...
test_sidestep: # @test_sidestep
.cfi_startproc
# BB#0:
pushq %rbx
.cfi_def_cfa_offset 16
subq $16, %rsp
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -16
vmovdqa (%rdi), %xmm0
vptest %xmm0, %xmm0
je .LBB2_2
It'd be nice if the naive pattern for a vectorized null check emitted decent
code. :)</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>