]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(entry point): For OP=rem, set SIGN from dividend only, ignoring divisor.
authorRoland McGrath <roland@gnu.org>
Fri, 21 Oct 1994 17:15:34 +0000 (17:15 +0000)
committerRoland McGrath <roland@gnu.org>
Fri, 21 Oct 1994 17:15:34 +0000 (17:15 +0000)
(Lgot_result): Test SIGN here for OP=rem too (as originally).

sysdeps/sparc/divrem.m4

index e440d886e02963bb1429a80b9ba9408710efe66e..bde8a21e29d4b4280ed278bfe79cb2c7761a94e5 100644 (file)
@@ -94,7 +94,9 @@ ifelse(S, `true',
 `      ! compute sign of result; if neither is negative, no problem
        orcc    divisor, dividend, %g0  ! either negative?
        bge     2f                      ! no, go do the divide
-       xor     divisor, dividend, SIGN ! compute sign in any case
+ifelse(OP, `div',
+`      xor     divisor, dividend, SIGN ! compute sign in any case',
+`      mov     dividend, SIGN          ! sign of remainder matches dividend')
        tst     divisor
        bge     1f
        tst     dividend
@@ -223,11 +225,10 @@ ifelse(OP, `div',
 
 Lgot_result:
 ifelse(S, `true',
-`ifelse(OP, `div', dnl Remainder should always be positive, says RMS.
 `      ! check to see if answer should be < 0
        tst     SIGN
        bl,a    1f
        ifelse(OP, `div', `sub %g0, Q, Q', `sub %g0, R, R')
-1:')')
+1:')
        retl
        ifelse(OP, `div', `mov Q, %o0', `mov R, %o0')