diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2016-11-02 23:23:13 +0100 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2016-11-02 23:23:13 +0100 |
commit | 183624479fd426c67928bb931a6474b15a8e8e95 (patch) | |
tree | b154ef3d06dc1c3ad500e527dee1edde04dd04bd /libgcc/libgcc2.c | |
parent | 6668eb4593253eab2677d844c95b3be64487e4cb (diff) | |
download | gcc-183624479fd426c67928bb931a6474b15a8e8e95.zip gcc-183624479fd426c67928bb931a6474b15a8e8e95.tar.gz gcc-183624479fd426c67928bb931a6474b15a8e8e95.tar.bz2 |
Makefile.in (LIB2_DIVMOD_FUNCS): Add _divmoddi4.
* Makefile.in (LIB2_DIVMOD_FUNCS): Add _divmoddi4.
* libgcc2.c (__divmoddi4): New function.
* libgcc2.h (__divmoddi4): Declare.
* libgcc-std.ver.in (GCC_7.0.0): New. Add __PFX_divmoddi4
and __PFX_divmodti4.
From-SVN: r241804
Diffstat (limited to 'libgcc/libgcc2.c')
-rw-r--r-- | libgcc/libgcc2.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c index 9fb150b..1d71fc4 100644 --- a/libgcc/libgcc2.c +++ b/libgcc/libgcc2.c @@ -680,7 +680,8 @@ __udiv_w_sdiv (UWtype *rp __attribute__ ((__unused__)), #endif #if (defined (L_udivdi3) || defined (L_divdi3) || \ - defined (L_umoddi3) || defined (L_moddi3)) + defined (L_umoddi3) || defined (L_moddi3) || \ + defined (L_divmoddi4)) #define L_udivmoddi4 #endif @@ -937,7 +938,8 @@ __parityDI2 (UDWtype x) #ifdef TARGET_HAS_NO_HW_DIVIDE #if (defined (L_udivdi3) || defined (L_divdi3) || \ - defined (L_umoddi3) || defined (L_moddi3)) + defined (L_umoddi3) || defined (L_moddi3) || \ + defined (L_divmoddi4)) static inline __attribute__ ((__always_inline__)) #endif UDWtype @@ -1004,7 +1006,8 @@ __udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) #else #if (defined (L_udivdi3) || defined (L_divdi3) || \ - defined (L_umoddi3) || defined (L_moddi3)) + defined (L_umoddi3) || defined (L_moddi3) || \ + defined (L_divmoddi4)) static inline __attribute__ ((__always_inline__)) #endif UDWtype @@ -1269,6 +1272,34 @@ __moddi3 (DWtype u, DWtype v) } #endif +#ifdef L_divmoddi4 +DWtype +__divmoddi4 (DWtype u, DWtype v, DWtype *rp) +{ + Wtype c1 = 0, c2 = 0; + DWunion uu = {.ll = u}; + DWunion vv = {.ll = v}; + DWtype w; + DWtype r; + + if (uu.s.high < 0) + c1 = ~c1, c2 = ~c2, + uu.ll = -uu.ll; + if (vv.s.high < 0) + c1 = ~c1, + vv.ll = -vv.ll; + + w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype*)&r); + if (c1) + w = -w; + if (c2) + r = -r; + + *rp = r; + return w; +} +#endif + #ifdef L_umoddi3 UDWtype __umoddi3 (UDWtype u, UDWtype v) |