milli.S

32 and 64-bit millicode, original author Hewlett-Packard adapted for gcc by Paul Bame ba.nosp@m.me@debia.nosp@m.n.org and Alan Modra al.nosp@m.an@linuxcar.nosp@m.e.com.au.

Copyright 2001, 2002, 2003 Free Software Foundation, Inc.

This file is part of GCC and is released under the terms of of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.  See the file COPYING in the top-level GCC source directory for a copy of the license.

Summary
milli.S32 and 64-bit millicode, original author Hewlett-Packard adapted for gcc by Paul Bame ba.nosp@m.me@debia.nosp@m.n.org and Alan Modra al.nosp@m.an@linuxcar.nosp@m.e.com.au.
$$divI, $$divoISingle precision divide for signed binary integers.
$$divU.
$$remI.
$$remU.
$$divI_2.

$$divI, $$divoI

Single precision divide for signed binary integers.

The quotient is truncated towards zero.  The sign of the quotient is the XOR of the signs of the dividend and divisor.  Divide by zero is trapped.  Divide of -2**31 by -1 is trapped for $$divoI but not for $$divI.

INPUT REGISTERS

.  arg0 == dividend . arg1 == divisor . mrp == return pc . sr0 == return space when called externally

OUTPUT REGISTERS

.  arg0 = undefined . arg1 = undefined . ret1 = quotient

OTHER REGISTERS AFFECTED

.  r1 = undefined

SIDE EFFECTS

.  Causes a trap under the following conditions: . divisor is zero (traps with ADDIT,= 0,25,0) . dividend==-2**31 and divisor==-1 and routine is $$divoI . (traps with ADDO 26,25,0) . Changes memory at the following places: . NONE

PERMISSIBLE CONTEXT

.  Unwindable.  . Suitable for internal or external millicode.  . Assumes the special millicode register conventions.

DISCUSSION

.  Branchs to other millicode routines using BE . $$div_# for # being 2,3,4,5,6,7,8,9,10,12,14,15 . . For selected divisors, calls a divide by constant routine written by . Karl Pettis.  Eligible divisors are 1..15 excluding 11 and 13.  . . The only overflow case is -2**31 divided by -1.  . Both routines return -2**31 but only $$divoI traps.

$$divU

.  . Single precision divide for unsigned integers.  . . Quotient is truncated towards zero.  . Traps on divide by zero.

INPUT REGISTERS

.  arg0 == dividend . arg1 == divisor . mrp == return pc . sr0 == return space when called externally

OUTPUT REGISTERS

.  arg0 = undefined . arg1 = undefined . ret1 = quotient

OTHER REGISTERS AFFECTED

.  r1 = undefined

SIDE EFFECTS

.  Causes a trap under the following conditions: . divisor is zero . Changes memory at the following places: . NONE

PERMISSIBLE CONTEXT

.  Unwindable.  . Does not create a stack frame.  . Suitable for internal or external millicode.  . Assumes the special millicode register conventions.

DISCUSSION

.  Branchs to other millicode routines using BE: . $$divU_# for 3,5,6,7,9,10,12,14,15 . . For selected small divisors calls the special divide by constant . routines written by Karl Pettis.  These are: 3,5,6,7,9,10,12,14,15.

$$remI

DESCRIPTION

.  $$remI returns the remainder of the division of two signed 32-bit . integers.  The sign of the remainder is the same as the sign of . the dividend.

INPUT REGISTERS

.  arg0 == dividend . arg1 == divisor . mrp == return pc . sr0 == return space when called externally

OUTPUT REGISTERS

.  arg0 = destroyed . arg1 = destroyed . ret1 = remainder

OTHER REGISTERS AFFECTED

.  r1 = undefined

SIDE EFFECTS

.  Causes a trap under the following conditions: DIVIDE BY ZERO . Changes memory at the following places: NONE

PERMISSIBLE CONTEXT

.  Unwindable . Does not create a stack frame . Is usable for internal or external microcode

DISCUSSION

.  Calls other millicode routines via mrp: NONE . Calls other millicode routines: NONE

$$remU

.  Single precision divide for remainder with unsigned binary integers.  . . The remainder must be dividend-(dividend/divisor)*divisor.  . Divide by zero is trapped.

INPUT REGISTERS

.  arg0 == dividend . arg1 == divisor . mrp == return pc . sr0 == return space when called externally

OUTPUT REGISTERS

.  arg0 = undefined . arg1 = undefined . ret1 = remainder

OTHER REGISTERS AFFECTED

.  r1 = undefined

SIDE EFFECTS

.  Causes a trap under the following conditions: DIVIDE BY ZERO . Changes memory at the following places: NONE

PERMISSIBLE CONTEXT

.  Unwindable.  . Does not create a stack frame.  . Suitable for internal or external millicode.  . Assumes the special millicode register conventions.

DISCUSSION

.  Calls other millicode routines using mrp: NONE . Calls other millicode routines: NONE

$$divI_2

.  $$divI_3 $$divU_3 . $$divI_4 . $$divI_5 $$divU_5 . $$divI_6 $$divU_6 . $$divI_7 $$divU_7 . $$divI_8 . $$divI_9 $$divU_9 . $$divI_10 $$divU_10 . . $$divI_12 $$divU_12 . . $$divI_14 $$divU_14 . $$divI_15 $$divU_15 . $$divI_16 . $$divI_17 $$divU_17 . . Divide by selected constants for single precision binary integers.

INPUT REGISTERS

.  arg0 == dividend . mrp == return pc . sr0 == return space when called externally

OUTPUT REGISTERS

.  arg0 = undefined . arg1 = undefined . ret1 = quotient

OTHER REGISTERS AFFECTED

.  r1 = undefined

SIDE EFFECTS

.  Causes a trap under the following conditions: NONE . Changes memory at the following places: NONE

PERMISSIBLE CONTEXT

.  Unwindable.  . Does not create a stack frame.  . Suitable for internal or external millicode.  . Assumes the special millicode register conventions.

DISCUSSION

.  Calls other millicode routines using mrp: NONE . Calls other millicode routines: NONE