When required to negate the absoulte result of a division/remainder

operation (by subtracting the absolute result from 0), don't test
for overflow.

This avoids an arithmetic exception when dividing LONG_MIN by 1:
This is the only case that causes overflow, and the resulting value
is correct under 2's compliment arithmetic.

PR:		72024
Approved by:	dwmalone@
Obtained from:	NetBSD
MFC after:	4 days
This commit is contained in:
Peter Edwards 2004-11-27 20:59:49 +00:00
parent 2adb8d6ab0
commit 2909df6916
2 changed files with 2 additions and 2 deletions

View File

@ -172,7 +172,7 @@ ifelse(OP, `div',
ifelse(S, `true', ifelse(S, `true',
` `
/* Check to see if we should negate it. */ /* Check to see if we should negate it. */
subqv zero, RESULT, T_0 subq zero, RESULT, T_0
cmovlbs NEG, T_0, RESULT cmovlbs NEG, T_0, RESULT
') ')

View File

@ -172,7 +172,7 @@ ifelse(OP, `div',
ifelse(S, `true', ifelse(S, `true',
` `
/* Check to see if we should negate it. */ /* Check to see if we should negate it. */
subqv zero, RESULT, T_0 subq zero, RESULT, T_0
cmovlbs NEG, T_0, RESULT cmovlbs NEG, T_0, RESULT
') ')