On Mon, 23 Apr 2018 11:56:51 +0100, The Natural Philosopher
declaimed the following:
>
>I didnt realise ARM has no div instruction
>
It has them (at least ARMv8) but some of the behavior may require use
of a subroutine to be rigorous.
"""
The integer divide instructions compute (numerator÷denominator) and deliver
the quotient, which is rounded towards zero. The remainder may then be
computed as numerator–(quotient
denominator) using the MSUB instruction.
If a signed integer division (INT_MIN ÷ -1) is performed, where INT_MIN is
the most negative integer value representable in the selected register
size, then the result will overflow the signed integer range. No indication
of this overflow is produced and the result written to the destination
register will be INT_MIN.
NOTE: The divide instructions do not generate a trap upon division by zero,
but write zero to the destination register.
"""
At the very least, many higher level languages expect division by zero
to raise a condition -- so a subroutine would likely be used incorporating
the needed testing and flag setting rather than emitting the same common
code every time a divide was done.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|