<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 - fold away float to double (to float) conversion in copysign"
href="https://bugs.llvm.org/show_bug.cgi?id=45361">45361</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>fold away float to double (to float) conversion in copysign
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nok.raven@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>#include <cmath>
float foo(float x, float y)
{
return std::copysign(x, y);
}
// <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - fold away float to double promotion in signbit"
href="show_bug.cgi?id=45305">bug 45305</a>-like foldable float to double promotion
float bar(float x, float y)
{
return std::copysign(x, double(y));
}
// previous + fext-ftrunc pair across copysign
float qaz(float x, float y)
{
return std::copysign(double(x), y);
}
define float @foo(float %0, float %1) {
%3 = tail call float @llvm.copysign.f32(float %0, float %1) #2
ret float %3
}
define float @bar(float %0, float %1) {
%3 = fpext float %1 to double
%4 = fpext float %0 to double
%5 = tail call double @llvm.copysign.f64(double %4, double %3) #2
%6 = fptrunc double %5 to float
ret float %6
}
define float @qaz(float %0, float %1) {
%3 = fpext float %0 to double
%4 = fpext float %1 to double
%5 = tail call double @llvm.copysign.f64(double %3, double %4) #2
%6 = fptrunc double %5 to float
ret float %6
}
<a href="https://godbolt.org/z/sKIjDg">https://godbolt.org/z/sKIjDg</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>