[builtins] Write __divmoddi4/__divmodsi4 in terms __udivmod instead of __div and...
authorCraig Topper <craig.topper@intel.com>
Thu, 10 Sep 2020 13:55:00 +0000 (06:55 -0700)
committerCraig Topper <craig.topper@intel.com>
Thu, 10 Sep 2020 15:08:55 +0000 (08:08 -0700)
commitf5ad9c2e0ea60dc5426def7a54f04347a33a952e
tree72a0651edd0181aacd1beb820cec88c9f96e4242
parent29cecbc5d6fe2ee36635d593171d59eab631639f
[builtins] Write __divmoddi4/__divmodsi4 in terms __udivmod instead of __div and multiply.

Previously we calculating the remainder by multiplying the
quotient and divisor and subtracting from the dividend.

__udivmod can calculate the remainder while calculating the
quotient. We just need to correct the sign afterward.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D87433
compiler-rt/lib/builtins/divmoddi4.c
compiler-rt/lib/builtins/divmodsi4.c