<html><head><base href="x-msg://21/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">cm3cg currently only uses FLOOR_DIV_EXPR for known positive integers.  For anything else it calls out to the library.<div>
<br><div><div>On 17 Jan 2010, at 20:06, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">I *speculate*:<br>   If the inputs to div or mod are known to have the same sign: don't bother calling the functions.<br>      Certainly that is clear for two positive inputs in the old functions.<br>   If either input to div is known to be zero, ditto. Presumably not a common case.<br>      And *maybe* we want to alter how divide by zero works to reliably trap or not trap.<br> <br>  For example, CARDINAL and LONGCARD DIV and MOD need not call the functions ever.<br>    (again, caveat, maybe for zero, maybe, not currently, but if we make trapping divide by zero controllable)<br> <br> <br> - Jay<br><br> <br>> From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>> To:<span class="Apple-converted-space"> </span><a href="mailto:hendrik@topoi.pooq.com">hendrik@topoi.pooq.com</a><br>> Date: Sun, 17 Jan 2010 15:19:21 -0600<br>> CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> Subject: Re: [M3devel] how division and modulo work in hand.c?<br>><span class="Apple-converted-space"> </span><br>> It calls the C routines in hand.c.<br>><span class="Apple-converted-space"> </span><br>> Sent from my iPhone<br>><span class="Apple-converted-space"> </span><br>> On Jan 17, 2010, at 2:48 PM,<span class="Apple-converted-space"> </span><a href="mailto:hendrik@topoi.pooq.com">hendrik@topoi.pooq.com</a><span class="Apple-converted-space"> </span>wrote:<br>><span class="Apple-converted-space"> </span><br>> > On Sun, Jan 17, 2010 at 11:39:03AM -0500, Tony Hosking wrote:<br>> >><br>> >> This is a quote from the gcc internals manual. I've always wondered<br>> >> why cm3cg uses the built-in FLOOR_DIV_EXPR/FLOOR_MOD_EXPR only for<br>> >> known positive operands. What would be wrong about using them also<br>> >> for negative operands?<br>> ><br>> > What does cm3cg use for operands that are not known to be positive?<br>> ><br>> > -- hendrik<br></div></span></blockquote></div><br></div></body></html>