https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105016
Bug ID: 105016
Summary: [libgcc, TARGET_HAS_NO_HW_DIVIDE] Incorrect result for
__udivmodti4
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcc
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
While investigating PR105014, I copied the TARGET_HAS_NO_HW_DIVIDE
implementation of __udivmoddi4 to the test-case.
On x86, when using the native __udivmodti4, I get:
...
$ ./a.out
a : 0xfffffffffffffffffffffffffffffffb
b : 0x00000000000000000000000000000001
div : 0xfffffffffffffffffffffffffffffffb
mod : 0x00000000000000000000000000000000
...
But with the TARGET_HAS_NO_HW_DIVIDE version I get instead:
...
a : 0xfffffffffffffffffffffffffffffffb
b : 0x00000000000000000000000000000001
div : 0x0000000000000000ffffffffffffffff
mod : 0x0000000000000000fffffffffffffffc
...