<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - no-signed-zero optimization flag isn't honored for an fneg operation"
href="http://llvm.org/bugs/show_bug.cgi?id=20870">20870</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>no-signed-zero optimization flag isn't honored for an fneg operation
</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>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ clang -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
$ cat fneg.c
float fneg(float x) {
return 0.0f - x;
}
$ ./clang -O2 -fno-signed-zeros fneg.c -S -o -
...
xorps %xmm1, %xmm1
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
popq %rbp
retq
-----------------------------------------------------------------------
There shouldn't be any subtraction generated here; this should just be an xor
to flip the sign bit.
I think this is a bug in the middle-end (opt, IR transforms) because the
back-end doesn't appear to have any logic to recognize the no-signed-zeros
optimization option.
So we should be transforming this:
%sub = fsub float 0.0, %x
Into this:
%sub = fsub float -0.0, %x</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>