<html>
<head>
<base href="https://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 --- - Clang emits calls to libcompiler-rt for complex numbers, even if they are trivial"
href="https://llvm.org/bugs/show_bug.cgi?id=23056">23056</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang emits calls to libcompiler-rt for complex numbers, even if they are trivial
</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>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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ed@80386.nl
</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>Consider the following piece of code:
#include <complex.h>
double complex times_two(double complex x) {
return x * 2;
}
double complex rotate(double complex x) {
return x * I;
}
These functions are trivial:
- The first function multiplies both the real and imaginary part of the complex
number with a simple scalar value.
- The second function rotates the number on the complex plane.
It seems that Clang creates a call to __muldc3(). While correct, I'm not sure
this is really needed. Clang could be optimized to omit a call to __muldc3()
and friends if one of the parts of any of the two numbers can be proven to be
zero.
Another example:
double mul(double a, double b) {
return (double complex)a * (double complex)b;
}
Clang generates horrible code for this function, even though it can completely
ignore the complex keyword.</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>