<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 - Redundant vxorps instruction"
href="https://bugs.llvm.org/show_bug.cgi?id=44509">44509</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Redundant vxorps instruction
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zamazan4ik@tut.by
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>With fast-math on, clang generates less optimal (and less precise) code.
Consider following code:
__m128 foo(__m128 rounded_cam_pos, __m128 remainder_cam_pos, __m128 pos)
{
__m128 ofs = _mm_sub_ps(pos, rounded_cam_pos);
return _mm_sub_ps(ofs, remainder_cam_pos);
}
compiled with -O3 -ffast-math -march=native
Clang (trunk) will generate more instructions
vxorps xmm0, xmm0, dword ptr [rip + .LCPI0_0]{1to4}
vsubps xmm0, xmm0, xmm1
vaddps xmm0, xmm0, xmm2
while also uselessly re-arrange the code.
gcc with fast-math, or clang without -ffast-math, generates simple and optimal
vsubps xmm0, xmm2, xmm0
vsubps xmm0, xmm0, xmm1
<a href="https://godbolt.org/z/y8rmap">https://godbolt.org/z/y8rmap</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>