⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libgcc2.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 3 页
字号:
	    {	      USItype m1, m0;	      /* Normalize.  */	      b = SI_TYPE_SIZE - bm;	      d1 = (d1 << bm) | (d0 >> b);	      d0 = d0 << bm;	      n2 = n1 >> b;	      n1 = (n1 << bm) | (n0 >> b);	      n0 = n0 << bm;	      udiv_qrnnd (q0, n1, n2, n1, d1);	      umul_ppmm (m1, m0, q0, d0);	      if (m1 > n1 || (m1 == n1 && m0 > n0))		{		  q0--;		  sub_ddmmss (m1, m0, m1, m0, d1, d0);		}	      q1 = 0;	      /* Remainder in (n1n0 - m1m0) >> bm.  */	      if (rp != 0)		{		  sub_ddmmss (n1, n0, n1, n0, m1, m0);		  rr.s.low = (n1 << b) | (n0 >> bm);		  rr.s.high = n1 >> bm;		  *rp = rr.ll;		}	    }	}    }  ww.s.low = q0;  ww.s.high = q1;  return ww.ll;}#endif#ifdef L_divdi3UDItype __udivmoddi4 ();DItype__divdi3 (u, v)     DItype u, v;{  SItype c = 0;  DIunion uu, vv;  DItype w;  uu.ll = u;  vv.ll = v;  if (uu.s.high < 0)    c = ~c,    uu.ll = __negdi2 (uu.ll);  if (vv.s.high < 0)    c = ~c,    vv.ll = __negdi2 (vv.ll);  w = __udivmoddi4 (uu.ll, vv.ll, (UDItype *) 0);  if (c)    w = __negdi2 (w);  return w;}#endif#ifdef L_moddi3UDItype __udivmoddi4 ();DItype__moddi3 (u, v)     DItype u, v;{  SItype c = 0;  DIunion uu, vv;  DItype w;  uu.ll = u;  vv.ll = v;  if (uu.s.high < 0)    c = ~c,    uu.ll = __negdi2 (uu.ll);  if (vv.s.high < 0)    vv.ll = __negdi2 (vv.ll);  (void) __udivmoddi4 (uu.ll, vv.ll, &w);  if (c)    w = __negdi2 (w);  return w;}#endif#ifdef L_umoddi3UDItype __udivmoddi4 ();UDItype__umoddi3 (u, v)     UDItype u, v;{  DItype w;  (void) __udivmoddi4 (u, v, &w);  return w;}#endif#ifdef L_udivdi3UDItype __udivmoddi4 ();UDItype__udivdi3 (n, d)     UDItype n, d;{  return __udivmoddi4 (n, d, (UDItype *) 0);}#endif#ifdef L_cmpdi2SItype__cmpdi2 (a, b)     DItype a, b;{  DIunion au, bu;  au.ll = a, bu.ll = b;  if (au.s.high < bu.s.high)    return 0;  else if (au.s.high > bu.s.high)    return 2;  if ((USItype) au.s.low < (USItype) bu.s.low)    return 0;  else if ((USItype) au.s.low > (USItype) bu.s.low)    return 2;  return 1;}#endif#ifdef L_ucmpdi2SItype__ucmpdi2 (a, b)     DItype a, b;{  DIunion au, bu;  au.ll = a, bu.ll = b;  if ((USItype) au.s.high < (USItype) bu.s.high)    return 0;  else if ((USItype) au.s.high > (USItype) bu.s.high)    return 2;  if ((USItype) au.s.low < (USItype) bu.s.low)    return 0;  else if ((USItype) au.s.low > (USItype) bu.s.low)    return 2;  return 1;}#endif#if defined(L_fixunstfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)DItype__fixunstfdi (a)     TFtype a;{  TFtype b;  UDItype v;  if (a < 0)    return 0;  /* Compute high word of result, as a flonum.  */  b = (a / HIGH_WORD_COEFF);  /* Convert that to fixed (but not to DItype!),     and shift it into the high word.  */  v = (USItype) b;  v <<= WORD_SIZE;  /* Remove high part from the TFtype, leaving the low part as flonum.  */  a -= (TFtype)v;  /* Convert that to fixed (but not to DItype!) and add it in.     Sometimes A comes out negative.  This is significant, since     A has more bits than a long int does.  */  if (a < 0)    v -= (USItype) (- a);  else    v += (USItype) a;  return v;}#endif#if defined(L_fixtfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)DItype__fixtfdi (a)     TFtype a;{  if (a < 0)    return - __fixunstfdi (-a);  return __fixunstfdi (a);}#endif#ifdef L_fixunsdfdi#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)DItype__fixunsdfdi (a)     DFtype a;{  DFtype b;  UDItype v;  if (a < 0)    return 0;  /* Compute high word of result, as a flonum.  */  b = (a / HIGH_WORD_COEFF);  /* Convert that to fixed (but not to DItype!),     and shift it into the high word.  */  v = (USItype) b;  v <<= WORD_SIZE;  /* Remove high part from the DFtype, leaving the low part as flonum.  */  a -= (DFtype)v;  /* Convert that to fixed (but not to DItype!) and add it in.     Sometimes A comes out negative.  This is significant, since     A has more bits than a long int does.  */  if (a < 0)    v -= (USItype) (- a);  else    v += (USItype) a;  return v;}#endif#ifdef L_fixdfdiDItype__fixdfdi (a)     DFtype a;{  if (a < 0)    return - __fixunsdfdi (-a);  return __fixunsdfdi (a);}#endif#ifdef L_fixunssfdi#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)DItype__fixunssfdi (SFtype original_a){  /* Convert the SFtype to a DFtype, because that is surely not going     to lose any bits.  Some day someone else can write a faster version     that avoids converting to DFtype, and verify it really works right.  */  DFtype a = original_a;  DFtype b;  UDItype v;  if (a < 0)    return 0;  /* Compute high word of result, as a flonum.  */  b = (a / HIGH_WORD_COEFF);  /* Convert that to fixed (but not to DItype!),     and shift it into the high word.  */  v = (USItype) b;  v <<= WORD_SIZE;  /* Remove high part from the DFtype, leaving the low part as flonum.  */  a -= (DFtype)v;  /* Convert that to fixed (but not to DItype!) and add it in.     Sometimes A comes out negative.  This is significant, since     A has more bits than a long int does.  */  if (a < 0)    v -= (USItype) (- a);  else    v += (USItype) a;  return v;}#endif#ifdef L_fixsfdiDItype__fixsfdi (SFtype a){  if (a < 0)    return - __fixunssfdi (-a);  return __fixunssfdi (a);}#endif#if defined(L_floatditf) && (LONG_DOUBLE_TYPE_SIZE == 128)#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)TFtype__floatditf (u)     DItype u;{  TFtype d;  SItype negate = 0;  if (u < 0)    u = -u, negate = 1;  d = (USItype) (u >> WORD_SIZE);  d *= HIGH_HALFWORD_COEFF;  d *= HIGH_HALFWORD_COEFF;  d += (USItype) (u & (HIGH_WORD_COEFF - 1));  return (negate ? -d : d);}#endif#ifdef L_floatdidf#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)DFtype__floatdidf (u)     DItype u;{  DFtype d;  SItype negate = 0;  if (u < 0)    u = -u, negate = 1;  d = (USItype) (u >> WORD_SIZE);  d *= HIGH_HALFWORD_COEFF;  d *= HIGH_HALFWORD_COEFF;  d += (USItype) (u & (HIGH_WORD_COEFF - 1));  return (negate ? -d : d);}#endif#ifdef L_floatdisf#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)SFtype__floatdisf (u)     DItype u;{  SFtype f;  SItype negate = 0;  if (u < 0)    u = -u, negate = 1;  f = (USItype) (u >> WORD_SIZE);  f *= HIGH_HALFWORD_COEFF;  f *= HIGH_HALFWORD_COEFF;  f += (USItype) (u & (HIGH_WORD_COEFF - 1));  return (negate ? -f : f);}#endif#ifdef L_fixunsdfsi#include "glimits.h"USItype__fixunsdfsi (a)     DFtype a;{  if (a >= - (DFtype) LONG_MIN)    return (SItype) (a + LONG_MIN) - LONG_MIN;  return (SItype) a;}#endif#ifdef L_fixunssfsi#include "glimits.h"USItype__fixunssfsi (SFtype a){  if (a >= - (SFtype) LONG_MIN)    return (SItype) (a + LONG_MIN) - LONG_MIN;  return (SItype) a;}#endif/* From here on down, the routines use normal data types.  */#define SItype bogus_type#define USItype bogus_type#define DItype bogus_type#define UDItype bogus_type#define SFtype bogus_type#define DFtype bogus_type#undef char#undef short#undef int#undef long#undef unsigned#undef float#undef double#ifdef L__gcc_bcmp/* Like bcmp except the sign is meaningful.   Reult is negative if S1 is less than S2,   positive if S1 is greater, 0 if S1 and S2 are equal.  */#include <sys/types.h>int__gcc_bcmp (s1, s2, size)     unsigned char *s1, *s2;     size_t size;{  while (size > 0)    {      unsigned char c1 = *s1++, c2 = *s2++;      if (c1 != c2)	return c1 - c2;      size--;    }  return 0;}#endif#ifdef L_varargs#ifdef __i860__#if defined(__svr4__) || defined(__alliant__)	asm ("	.text");	asm ("	.align	4");/* The Alliant needs the added underscore.  */	asm (".globl	__builtin_saveregs");asm ("__builtin_saveregs:");	asm (".globl	___builtin_saveregs");asm ("___builtin_saveregs:");        asm ("	andnot	0x0f,%sp,%sp");	/* round down to 16-byte boundary */	asm ("	adds	-96,%sp,%sp");  /* allocate stack space for reg save					   area and also for a new va_list					   structure */	/* Save all argument registers in the arg reg save area.  The	   arg reg save area must have the following layout (according	   to the svr4 ABI):		struct {		  union  {		    float freg[8];		    double dreg[4];		  } float_regs;		  long	ireg[12];		};	*/	asm ("	fst.q	%f8,  0(%sp)"); /* save floating regs (f8-f15)  */	asm ("	fst.q	%f12,16(%sp)"); 	asm ("	st.l	%r16,32(%sp)"); /* save integer regs (r16-r27) */	asm ("	st.l	%r17,36(%sp)"); 	asm ("	st.l	%r18,40(%sp)");	asm ("	st.l	%r19,44(%sp)");	asm ("	st.l	%r20,48(%sp)");	asm ("	st.l	%r21,52(%sp)");	asm ("	st.l	%r22,56(%sp)");	asm ("	st.l	%r23,60(%sp)");	asm ("	st.l	%r24,64(%sp)");	asm ("	st.l	%r25,68(%sp)");	asm ("	st.l	%r26,72(%sp)");	asm ("	st.l	%r27,76(%sp)");	asm ("	adds	80,%sp,%r16");  /* compute the address of the new					   va_list structure.  Put in into					   r16 so that it will be returned					   to the caller.  */	/* Initialize all fields of the new va_list structure.  This	   structure looks like:		typedef struct {		    unsigned long	ireg_used;		    unsigned long	freg_used;		    long		*reg_base;		    long		*mem_ptr;		} va_list;	*/	asm ("	st.l	%r0, 0(%r16)"); /* nfixed */	asm ("	st.l	%r0, 4(%r16)"); /* nfloating */	asm ("  st.l    %sp, 8(%r16)"); /* __va_ctl points to __va_struct.  */	asm ("	bri	%r1");		/* delayed return */	asm ("	st.l	%r28,12(%r16)"); /* pointer to overflow args */#else /* not __SVR4__ */	asm ("	.text");	asm ("	.align	4");	asm (".globl	___builtin_saveregs");	asm ("___builtin_saveregs:");	asm ("	mov	sp,r30");	asm ("	andnot	0x0f,sp,sp");	asm ("	adds	-96,sp,sp");  /* allocate sufficient space on the stack *//* Fill in the __va_struct.  */	asm ("	st.l	r16, 0(sp)"); /* save integer regs (r16-r27) */	asm ("	st.l	r17, 4(sp)"); /* int	fixed[12] */	asm ("	st.l	r18, 8(sp)");	asm ("	st.l	r19,12(sp)");	asm ("	st.l	r20,16(sp)");	asm ("	st.l	r21,20(sp)");	asm ("	st.l	r22,24(sp)");	asm ("	st.l	r23,28(sp)");	asm ("	st.l	r24,32(sp)");	asm ("	st.l	r25,36(sp)");	asm ("	st.l	r26,40(sp)");	asm ("	st.l	r27,44(sp)");	asm ("	fst.q	f8, 48(sp)"); /* save floating regs (f8-f15) */	asm ("	fst.q	f12,64(sp)"); /* int floating[8] *//* Fill in the __va_ctl.  */	asm ("  st.l    sp, 80(sp)"); /* __va_ctl points to __va_struct.  */	asm ("	st.l	r28,84(sp)"); /* pointer to more args */	asm ("	st.l	r0, 88(sp)"); /* nfixed */	asm ("	st.l	r0, 92(sp)"); /* nfloating */	asm ("	adds	80,sp,r16");  /* return address of the __va_ctl.  */	asm ("	bri	r1");	asm ("	mov	r30,sp");				/* recover stack and pass address to start 				   of data.  */#endif /* not __SVR4__ */#else /* not __i860__ */#ifdef __sparc__	asm (".global __builtin_saveregs");	asm ("__builtin_saveregs:");	asm (".global ___builtin_saveregs");	asm ("___builtin_saveregs:");#ifdef NEED_PROC_COMMAND	asm (".proc 020");#endif	asm ("st %i0,[%fp+68]");	asm ("st %i1,[%fp+72]");	asm ("st %i2,[%fp+76]");	asm ("st %i3,[%fp+80]");	asm ("st %i4,[%fp+84]");	asm ("retl");	asm ("st %i5,[%fp+88]");#ifdef NEED_TYPE_COMMAND	asm (".type __builtin_saveregs,#function");	asm (".size __builtin_saveregs,.-__builtin_saveregs");#endif#else /* not __sparc__ */#if defined(__MIPSEL__) | defined(__R3000__) | defined(__R2000__) | defined(__mips__)  asm ("	.text");  asm ("	.ent __builtin_saveregs");  asm ("	.globl __builtin_saveregs");  asm ("__builtin_saveregs:");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -