<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 - [X86][SSE] Reduce FPU->GPR traffic by performing fcmp logic on FPU"
href="https://bugs.llvm.org/show_bug.cgi?id=51245">51245</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86][SSE] Reduce FPU->GPR traffic by performing fcmp logic on FPU
</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>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre><a href="https://godbolt.org/z/o7zzn7Gc6">https://godbolt.org/z/o7zzn7Gc6</a>
bool f32cmp2(float x, float y, float z, float w) {
return (x < y) != (z < w);
}
clang -g0 -O3 -march=btver2
f32cmp2:
vucomiss %xmm0, %xmm1
seta %cl
vucomiss %xmm2, %xmm3
seta %al
xorb %cl, %al
retq
We can reduce fpu->gpr traffic by using 2 x cmpss instead, performing the xor
on the fpu and then just transferring the result:
f32cmp2:
vcmpltss %xmm1, %xmm0, %xmm0
vcmpltss %xmm3, %xmm2, %xmm2
vxorps %xmm0, %xmm2, %xmm2
vmovd %xmm2, %eax
andb $1, %al
<a href="https://llvm.godbolt.org/z/xKWrPo88f">https://llvm.godbolt.org/z/xKWrPo88f</a></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>