[llvm-bugs] [Bug 44509] New: Redundant vxorps instruction
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 10 04:15:01 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44509
Bug ID: 44509
Summary: Redundant vxorps instruction
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: zamazan4ik at tut.by
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
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
https://godbolt.org/z/y8rmap
--
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/20200110/0a802e91/attachment.html>
More information about the llvm-bugs
mailing list