[llvm-bugs] [Bug 32492] New: [ARM] __udivsi3 incorrect with Thumb1

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 2 02:19:37 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32492

            Bug ID: 32492
           Summary: [ARM] __udivsi3 incorrect with Thumb1
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: mail at timnn.me
                CC: llvm-bugs at lists.llvm.org

__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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170402/3db68f7e/attachment-0001.html>


More information about the llvm-bugs mailing list