/* libgcc1 routines for 68000 w/o floating-point hardware.
- Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
| void __clear_sticky_bits(void);
SYM (__clear_sticky_bit):
lea SYM (_fpCCR),a0
+#ifndef __mcf5200__
movew IMM (0),a0@(STICK)
+#else
+ clr.w a0@(STICK)
+#endif
rts
|=============================================================================
beq 1f | no, exit
pea SYM (_fpCCR) | yes, push address of _fpCCR
trap IMM (FPTRAP) | and trap
+#ifndef __mcf5200__
1: moveml sp@+,d2-d7 | restore data registers
+#else
+1: moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 | and return
rts
#endif /* L_floatex */
/* Coldfire implementation of non-restoring division algorithm from
Hennessy & Patterson, Appendix A. */
- link a6,IMM (0)
- moveml d2-d4,sp@-
+ link a6,IMM (-12)
+ moveml d2-d4,sp@
movel a6@(8),d0
movel a6@(12),d1
clrl d2 | clear p
| double __adddf3(double, double);
SYM (__adddf3):
+#ifndef __mcf5200__
link a6,IMM (0) | everything will be done in registers
moveml d2-d7,sp@- | save all data registers and a2 (but d0-d1)
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movel a6@(8),d0 | get first operand
movel a6@(12),d1 |
movel a6@(16),d2 | get second operand
#ifndef __mcf5200__
moveml a2-a3,sp@- | save the address registers
#else
- moveml a2-a4,sp@- | save the address registers
+ movel a2,sp@-
+ movel a3,sp@-
+ movel a4,sp@-
#endif
movel d4,a2 | save the exponents
#ifndef __mcf5200__
moveml sp@+,a2-a3
#else
- moveml sp@+,a2-a4
+ movel sp@+,a4
+ movel sp@+,a3
+ movel sp@+,a2
#endif
| Before rounding normalize so bit #DBL_MANT_DIG is set (we will consider
#ifndef __mcf5200__
moveml sp@+,a2-a3 |
#else
- moveml sp@+,a2-a4 |
+ movel sp@+,a4
+ movel sp@+,a3
+ movel sp@+,a2
#endif
| Before rounding normalize so bit #DBL_MANT_DIG is set (we will consider
#ifndef __mcf5200__
moveml sp@+,a2-a3
#else
- moveml sp@+,a2-a4
+ movel sp@+,a4
+ movel sp@+,a3
+ movel sp@+,a2
#endif
movel a6@(16),d0
movel a6@(20),d1
lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | restore data registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 | and return
rts
#ifndef __mcf5200__
moveml sp@+,a2-a3
#else
- moveml sp@+,a2-a4
+ movel sp@+,a4
+ movel sp@+,a3
+ movel sp@+,a2
#endif
movel a6@(8),d0
movel a6@(12),d1
lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | restore data registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 | and return
rts
bra Ld$infty |
Ladddf$ret$1:
+#ifndef __mcf5200__
moveml sp@+,a2-a3 | restore regs and exit
+#else
+ movel sp@+,a4
+ movel sp@+,a3
+ movel sp@+,a2
+#endif
Ladddf$ret:
| Normal exit.
lea SYM (_fpCCR),a0
movew IMM (0),a0@
orl d7,d0 | put sign bit back
+#ifndef __mcf5200__
moveml sp@+,d2-d7
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
| double __muldf3(double, double);
SYM (__muldf3):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@-
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movel a6@(8),d0 | get a into d0-d1
movel a6@(12),d1 |
movel a6@(16),d2 | and b into d2-d3
#ifndef __mcf5200__
moveml a2-a3,sp@- | save a2 and a3 for temporary use
#else
- moveml a2-a4,sp@-
+ movel a2,sp@-
+ movel a3,sp@-
+ movel a4,sp@-
#endif
movel IMM (0),a2 | a2 is a null register
movel d4,a3 | and a3 will preserve the exponent
#ifndef __mcf5200__
moveml sp@+,a2-a3
#else
- moveml sp@+,a2-a4
+ movel sp@+,a4
+ movel sp@+,a3
+ movel sp@+,a2
#endif
| Now we have the product in d0-d1-d2-d3, with bit 8 of d0 set. The
bge Ld$inop | in case NaN or +/-INFINITY return NaN
lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
| double __divdf3(double, double);
SYM (__divdf3):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@-
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movel a6@(8),d0 | get a into d0-d1
movel a6@(12),d1 |
movel a6@(16),d2 | and b into d2-d3
movel d0,d1 |
lea SYM (_fpCCR),a0 | clear exception flags
movew IMM (0),a0@ |
+#ifndef __mcf5200__
moveml sp@+,d2-d7 |
+#else
+ moveml sp@,d2-d7 |
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 |
rts |
lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
| double __negdf2(double, double);
SYM (__negdf2):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@-
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movew IMM (NEGATE),d5
movel a6@(8),d0 | get number to negate in d0-d1
movel a6@(12),d1 |
bra Ld$infty
1: lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
2: bclr IMM (31),d0
| int __cmpdf2(double, double);
SYM (__cmpdf2):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@- | save registers
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movew IMM (COMPARE),d5
movel a6@(8),d0 | get first operand
movel a6@(12),d1 |
bne Lcmpdf$a$gt$b | |b| < |a|
| If we got here a == b.
movel IMM (EQUAL),d0
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | put back the registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
Lcmpdf$a$gt$b:
movel IMM (GREATER),d0
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | put back the registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
Lcmpdf$b$gt$a:
movel IMM (LESS),d0
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | put back the registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
| float __addsf3(float, float);
SYM (__addsf3):
+#ifndef __mcf5200__
link a6,IMM (0) | everything will be done in registers
moveml d2-d7,sp@- | save all data registers but d0-d1
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movel a6@(8),d0 | get first operand
movel a6@(12),d1 | get second operand
movel d0,d6 | get d0's sign bit '
movel a6@(12),d0
lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | restore data registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 | and return
rts
movel a6@(8),d0
lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | restore data registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 | and return
rts
lea SYM (_fpCCR),a0
movew IMM (0),a0@
orl d7,d0 | put sign bit
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | restore data registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 | and return
rts
| float __mulsf3(float, float);
SYM (__mulsf3):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@-
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movel a6@(8),d0 | get a into d0
movel a6@(12),d1 | and b into d1
movel d0,d7 | d7 will hold the sign of the product
bge Lf$inop | if b is +/-INFINITY or NaN return NaN
lea SYM (_fpCCR),a0 | else return zero
movew IMM (0),a0@ |
+#ifndef __mcf5200__
moveml sp@+,d2-d7 |
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 |
rts |
| float __divsf3(float, float);
SYM (__divsf3):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@-
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movel a6@(8),d0 | get a into d0
movel a6@(12),d1 | and b into d1
movel d0,d7 | d7 will hold the sign of the result
movel IMM (0),d0 | else return zero
lea SYM (_fpCCR),a0 |
movew IMM (0),a0@ |
+#ifndef __mcf5200__
moveml sp@+,d2-d7 |
+#else
+ moveml sp@,d2-d7 |
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6 |
rts |
lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
| float __negsf2(float);
SYM (__negsf2):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@-
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movew IMM (NEGATE),d5
movel a6@(8),d0 | get number to negate in d0
bchg IMM (31),d0 | negate
bra Lf$infty
1: lea SYM (_fpCCR),a0
movew IMM (0),a0@
+#ifndef __mcf5200__
moveml sp@+,d2-d7
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
2: bclr IMM (31),d0
| int __cmpsf2(float, float);
SYM (__cmpsf2):
+#ifndef __mcf5200__
link a6,IMM (0)
moveml d2-d7,sp@- | save registers
+#else
+ link a6,IMM (-24)
+ moveml d2-d7,sp@
+#endif
movew IMM (COMPARE),d5
movel a6@(8),d0 | get first operand
movel a6@(12),d1 | get second operand
bne Lcmpsf$a$gt$b | |b| < |a|
| If we got here a == b.
movel IMM (EQUAL),d0
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | put back the registers
+#else
+ moveml sp@,d2-d7
+#endif
unlk a6
rts
Lcmpsf$a$gt$b:
movel IMM (GREATER),d0
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | put back the registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts
Lcmpsf$b$gt$a:
movel IMM (LESS),d0
+#ifndef __mcf5200__
moveml sp@+,d2-d7 | put back the registers
+#else
+ moveml sp@,d2-d7
+ | XXX if frame pointer is ever removed, stack pointer must
+ | be adjusted here.
+#endif
unlk a6
rts