<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 --- - Dividing complex numbers produces wrong results on ARM 32bit"
href="https://llvm.org/bugs/show_bug.cgi?id=28164">28164</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Dividing complex numbers produces wrong results on ARM 32bit
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>violeta.vukobrat@rt-rk.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Clang produces wrong result for complex numbers division.
The following example:
test.c
int main() {
_Complex double a = 3;
_Complex double b = 0;
printf("a/b: %f\n", (double)(a/b));
return 0;
}
When built for arm32 hard float:
clang -target arm-linux-gnueabihf -march=armv7a -EL
--gcc-toolchain=PATH_TO_TOOLCHAIN --sysroot=PATH_TO_SYSROOT -O2
-mfloat-abi=hard -mfpu=vfp -o test test.c
It produces the following output:
a/b: 3.000000
This is the part of the .s file generated from the example:
...
vldr d0, .LCPI0_0
mov r12, #0
vldr d1, .LCPI0_1
vmov r0, r1, d0
str r12, [sp]
vmov r2, r3, d1
str r12, [sp, #4]
str r12, [sp, #8]
str r12, [sp, #12]
bl __divdc3
mov r2, r0
movw r0, :lower16:.L.str
movt r0, :upper16:.L.str
....
It appears that the function __divdc3 is given the correct values and
calculates the right result, however the problem seems to be that clang reads
the return value from wrong registers (using r0 instead of d0).</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>