<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 - [ARM] __udivsi3 incorrect with Thumb1"
href="https://bugs.llvm.org/show_bug.cgi?id=32492">32492</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ARM] __udivsi3 incorrect with Thumb1
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mail@timnn.me
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>__udivsi3 appears to be incorrect for ARM / Thumb1 and causes several failures
in the corresponding unit test.
(Note: I don't know how to use CMake to build / run the tests using a cross
compiler, so I used the command below)
arm-linux-gnueabihf-gcc -march=armv6 -marm -Ilib/builtins
lib/builtins/arm/aeabi_div0.c lib/builtins/arm/udivsi3.S
test/builtins/Unit/udivsi3_test.c -nodefaultlibs -lc -o udivsi3_test
The `-march=armv6` causes `__ARM_ARCH_ISA_THUMB` to be defined as `1`, using
`-march=armv6t2` "fixes" the problem.
With `-march=armv6` I get the following test failures (with a patched test case
to not abort early):
error in __udivsi3: 10 / 2 = 7, expected 8
error in __udivsi3: 10 / 3 = 7, expected 5
error in __udivsi3: 78644FA / 2 = FFFF, expected 3C3227D
error in __udivsi3: 78644FA / 3 = FFFF, expected 28216FE
error in __udivsi3: 78644FA / 10 = 7FFF, expected 78644F
error in __udivsi3: 747AE14 / 2 = FFFF, expected 3A3D70A
error in __udivsi3: 747AE14 / 3 = FFFF, expected 26D3A06
error in __udivsi3: 747AE14 / 10 = 7FFF, expected 747AE1
error in __udivsi3: 7FFFFFFF / 2 = 7FFFF, expected 3FFFFFFF
error in __udivsi3: 7FFFFFFF / 3 = 7FFFF, expected 2AAAAAAA
error in __udivsi3: 7FFFFFFF / 10 = 1FFFF, expected 7FFFFFF
error in __udivsi3: 7FFFFFFF / 78644FA = F, expected 11
error in __udivsi3: 7FFFFFFF / 747AE14 = F, expected 11
error in __udivsi3: 80000000 / 2 = 7FFFF, expected 40000000
error in __udivsi3: 80000000 / 3 = 7FFFF, expected 2AAAAAAA
error in __udivsi3: 80000000 / 10 = 3FFFF, expected 8000000
error in __udivsi3: 80000000 / 78644FA = F, expected 11
error in __udivsi3: 80000000 / 747AE14 = F, expected 11
error in __udivsi3: 80000000 / 7FFFFFFF = 3, expected 1
error in __udivsi3: FFFFFFFD / 2 = 7FFFF, expected 7FFFFFFE
error in __udivsi3: FFFFFFFD / 3 = 7FFFF, expected 55555554
error in __udivsi3: FFFFFFFD / 10 = 3FFFF, expected FFFFFFF
error in __udivsi3: FFFFFFFD / 78644FA = F, expected 22
error in __udivsi3: FFFFFFFD / 747AE14 = F, expected 23
error in __udivsi3: FFFFFFFD / 7FFFFFFF = 3, expected 1
error in __udivsi3: FFFFFFFE / 2 = 7FFFF, expected 7FFFFFFF
error in __udivsi3: FFFFFFFE / 3 = 7FFFF, expected 55555554
error in __udivsi3: FFFFFFFE / 10 = 3FFFF, expected FFFFFFF
error in __udivsi3: FFFFFFFE / 78644FA = F, expected 22
error in __udivsi3: FFFFFFFE / 747AE14 = F, expected 23
error in __udivsi3: FFFFFFFE / 7FFFFFFF = 3, expected 2
error in __udivsi3: FFFFFFFF / 2 = 7FFFF, expected 7FFFFFFF
error in __udivsi3: FFFFFFFF / 3 = 7FFFF, expected 55555555
error in __udivsi3: FFFFFFFF / 10 = 3FFFF, expected FFFFFFF
error in __udivsi3: FFFFFFFF / 78644FA = F, expected 22
error in __udivsi3: FFFFFFFF / 747AE14 = F, expected 23
error in __udivsi3: FFFFFFFF / 7FFFFFFF = 3, expected 2</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>