2005-04-17 02:20:36 +04:00
/ * libgcc1 r o u t i n e s f o r 6 8 0 0 0 w / o f l o a t i n g - p o i n t h a r d w a r e .
Copyright ( C ) 1 9 9 4 , 1 9 9 6 , 1 9 9 7 , 1 9 9 8 F r e e S o f t w a r e F o u n d a t i o n , I n c .
This f i l e i s p a r t o f G N U C C .
GNU C C i s f r e e s o f t w a r e ; you can redistribute it and/or modify it
under t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y t h e
Free S o f t w a r e F o u n d a t i o n ; either version 2, or (at your option) any
later v e r s i o n .
In a d d i t i o n t o t h e p e r m i s s i o n s i n t h e G N U G e n e r a l P u b l i c L i c e n s e , t h e
Free S o f t w a r e F o u n d a t i o n g i v e s y o u u n l i m i t e d p e r m i s s i o n t o l i n k t h e
compiled v e r s i o n o f t h i s f i l e w i t h o t h e r p r o g r a m s , a n d t o d i s t r i b u t e
those p r o g r a m s w i t h o u t a n y r e s t r i c t i o n c o m i n g f r o m t h e u s e o f t h i s
file. ( T h e G e n e r a l P u b l i c L i c e n s e r e s t r i c t i o n s d o a p p l y i n o t h e r
respects; for example, they cover modification of the file, and
distribution w h e n n o t l i n k e d i n t o a n o t h e r p r o g r a m . )
This f i l e i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , b u t
WITHOUT A N Y W A R R A N T Y ; without even the implied warranty of
MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e G N U
2014-11-08 21:19:07 +03:00
General P u b l i c L i c e n s e f o r m o r e d e t a i l s . * /
2005-04-17 02:20:36 +04:00
/ * As a s p e c i a l e x c e p t i o n , i f y o u l i n k t h i s l i b r a r y w i t h f i l e s
compiled w i t h G C C t o p r o d u c e a n e x e c u t a b l e , t h i s d o e s n o t c a u s e
the r e s u l t i n g e x e c u t a b l e t o b e c o v e r e d b y t h e G N U G e n e r a l P u b l i c L i c e n s e .
This e x c e p t i o n d o e s n o t h o w e v e r i n v a l i d a t e a n y o t h e r r e a s o n s w h y
the e x e c u t a b l e f i l e m i g h t b e c o v e r e d b y t h e G N U G e n e r a l P u b l i c L i c e n s e . * /
/ * Use t h i s o n e f o r a n y 6 8 0 x0 ; assumes no floating point hardware.
The t r a i l i n g " ' " a p p e a r i n g o n s o m e l i n e s i s f o r A N S I p r e p r o c e s s o r s . Y u k .
Some o f t h i s c o d e c o m e s f r o m M I N I X , v i a t h e f o l k s a t e r i c s s o n .
D. V . H e n k e l - W a l l a c e ( g u m b y @cygnus.com) Fete Bastille, 1992
* /
2016-01-11 21:04:04 +03:00
# include < a s m / e x p o r t . h >
2005-04-17 02:20:36 +04:00
/* These are predefined by new versions of GNU cpp. */
# ifndef _ _ U S E R _ L A B E L _ P R E F I X _ _
# define _ _ U S E R _ L A B E L _ P R E F I X _ _ _
# endif
# ifndef _ _ R E G I S T E R _ P R E F I X _ _
# define _ _ R E G I S T E R _ P R E F I X _ _
# endif
# ifndef _ _ I M M E D I A T E _ P R E F I X _ _
# define _ _ I M M E D I A T E _ P R E F I X _ _ #
# endif
/* ANSI concatenation macros. */
# define C O N C A T 1 ( a , b ) C O N C A T 2 ( a , b )
# define C O N C A T 2 ( a , b ) a ## b
/* Use the right prefix for global labels. */
# define S Y M ( x ) C O N C A T 1 ( _ _ U S E R _ L A B E L _ P R E F I X _ _ , x )
/* Use the right prefix for registers. */
# define R E G ( x ) C O N C A T 1 ( _ _ R E G I S T E R _ P R E F I X _ _ , x )
/* Use the right prefix for immediate values. */
# define I M M ( x ) C O N C A T 1 ( _ _ I M M E D I A T E _ P R E F I X _ _ , x )
# define d0 R E G ( d0 )
# define d1 R E G ( d1 )
# define d2 R E G ( d2 )
# define d3 R E G ( d3 )
# define d4 R E G ( d4 )
# define d5 R E G ( d5 )
# define d6 R E G ( d6 )
# define d7 R E G ( d7 )
# define a0 R E G ( a0 )
# define a1 R E G ( a1 )
# define a2 R E G ( a2 )
# define a3 R E G ( a3 )
# define a4 R E G ( a4 )
# define a5 R E G ( a5 )
# define a6 R E G ( a6 )
# define f p R E G ( f p )
# define s p R E G ( s p )
.text
.proc
.globl SYM ( _ _ divsi3 )
SYM ( _ _ d i v s i 3 ) :
movel d2 , s p @-
moveq I M M ( 1 ) , d2 / * s i g n o f r e s u l t s t o r e d i n d2 ( =1 o r = - 1 ) * /
movel s p @(12), d1 /* d1 = divisor */
jpl L 1
negl d1
# if ! ( d e f i n e d ( _ _ m c f52 0 0 _ _ ) | | d e f i n e d ( _ _ m c o l d f i r e _ _ ) )
negb d2 / * c h a n g e s i g n b e c a u s e d i v i s o r < 0 * /
# else
negl d2 / * c h a n g e s i g n b e c a u s e d i v i s o r < 0 * /
# endif
L1 : movel s p @(8), d0 /* d0 = dividend */
jpl L 2
negl d0
# if ! ( d e f i n e d ( _ _ m c f52 0 0 _ _ ) | | d e f i n e d ( _ _ m c o l d f i r e _ _ ) )
negb d2
# else
negl d2
# endif
L2 : movel d1 , s p @-
movel d0 , s p @-
jbsr S Y M ( _ _ u d i v s i 3 ) / * d i v i d e a b s ( d i v i d e n d ) b y a b s ( d i v i s o r ) * /
addql I M M ( 8 ) , s p
tstb d2
jpl L 3
negl d0
L3 : movel s p @+, d2
rts
2016-01-11 21:04:04 +03:00
EXPORT_ S Y M B O L ( _ _ d i v s i 3 )