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

📄 longlong.h

📁 GCC编译器源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
  do {									\    USItype __m0 = (m0), __m1 = (m1);					\    __asm__ (								\       "s	r2,r2	mts	r10,%2	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	m	r2,%3	cas	%0,r2,r0	mfs	r10,%1"							\	     : "=r" ((USItype) (ph)),					\	       "=r" ((USItype) (pl))					\	     : "%r" (__m0),						\		"r" (__m1)						\	     : "r2");							\    (ph) += ((((SItype) __m0 >> 31) & __m1)				\	     + (((SItype) __m1 >> 31) & __m0));				\  } while (0)#define UMUL_TIME 20#define UDIV_TIME 200#define count_leading_zeros(count, x) \  do {									\    if ((x) >= 0x10000)							\      __asm__ ("clz	%0,%1"						\	       : "=r" ((USItype) (count))				\	       : "r" ((USItype) (x) >> 16));				\    else								\      {									\	__asm__ ("clz	%0,%1"						\		 : "=r" ((USItype) (count))				\		 : "r" ((USItype) (x)));					\	(count) += 16;							\      }									\  } while (0)#endif#if defined (__sparc__)#define add_ssaaaa(sh, sl, ah, al, bh, bl) \  __asm__ ("addcc %r4,%5,%1	addx %r2,%3,%0"							\	   : "=r" ((USItype) (sh)),					\	     "=&r" ((USItype) (sl))					\	   : "%rJ" ((USItype) (ah)),					\	     "rI" ((USItype) (bh)),					\	     "%rJ" ((USItype) (al)),					\	     "rI" ((USItype) (bl))					\	   __CLOBBER_CC)#define sub_ddmmss(sh, sl, ah, al, bh, bl) \  __asm__ ("subcc %r4,%5,%1	subx %r2,%3,%0"							\	   : "=r" ((USItype) (sh)),					\	     "=&r" ((USItype) (sl))					\	   : "rJ" ((USItype) (ah)),					\	     "rI" ((USItype) (bh)),					\	     "rJ" ((USItype) (al)),					\	     "rI" ((USItype) (bl))					\	   __CLOBBER_CC)#if defined (__sparc_v8__)#define umul_ppmm(w1, w0, u, v) \  __asm__ ("umul %2,%3,%1;rd %%y,%0"					\	   : "=r" ((USItype) (w1)),					\	     "=r" ((USItype) (w0))					\	   : "r" ((USItype) (u)),					\	     "r" ((USItype) (v)))#define udiv_qrnnd(q, r, n1, n0, d) \  __asm__ ("mov %2,%%y;nop;nop;nop;udiv %3,%4,%0;umul %0,%4,%1;sub %3,%1,%1"\	   : "=&r" ((USItype) (q)),					\	     "=&r" ((USItype) (r))					\	   : "r" ((USItype) (n1)),					\	     "r" ((USItype) (n0)),					\	     "r" ((USItype) (d)))#else#if defined (__sparclite__)/* This has hardware multiply but not divide.  It also has two additional   instructions scan (ffs from high bit) and divscc.  */#define umul_ppmm(w1, w0, u, v) \  __asm__ ("umul %2,%3,%1;rd %%y,%0"					\	   : "=r" ((USItype) (w1)),					\	     "=r" ((USItype) (w0))					\	   : "r" ((USItype) (u)),					\	     "r" ((USItype) (v)))#define udiv_qrnnd(q, r, n1, n0, d) \  __asm__ ("! Inlined udiv_qrnnd	wr	%%g0,%2,%%y	! Not a delayed write for sparclite	tst	%%g0	divscc	%3,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%%g1	divscc	%%g1,%4,%0	rd	%%y,%1	bl,a 1f	add	%1,%4,%11:	! End of inline udiv_qrnnd"					\	   : "=r" ((USItype) (q)),					\	     "=r" ((USItype) (r))					\	   : "r" ((USItype) (n1)),					\	     "r" ((USItype) (n0)),					\	     "rI" ((USItype) (d))					\	   : "%g1" __AND_CLOBBER_CC)#define UDIV_TIME 37#define count_leading_zeros(count, x) \  __asm__ ("scan %1,0,%0"						\	   : "=r" ((USItype) (x))					\	   : "r" ((USItype) (count)))#else/* SPARC without integer multiplication and divide instructions.   (i.e. at least Sun4/20,40,60,65,75,110,260,280,330,360,380,470,490) */#define umul_ppmm(w1, w0, u, v) \  __asm__ ("! Inlined umul_ppmm	wr	%%g0,%2,%%y	! SPARC has 0-3 delay insn after a wr	sra	%3,31,%%g2	! Don't move this insn	and	%2,%%g2,%%g2	! Don't move this insn	andcc	%%g0,0,%%g1	! Don't move this insn	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,%3,%%g1	mulscc	%%g1,0,%%g1	add	%%g1,%%g2,%0	rd	%%y,%1"							\	   : "=r" ((USItype) (w1)),					\	     "=r" ((USItype) (w0))					\	   : "%rI" ((USItype) (u)),					\	     "r" ((USItype) (v))						\	   : "%g1", "%g2" __AND_CLOBBER_CC)#define UMUL_TIME 39		/* 39 instructions *//* It's quite necessary to add this much assembler for the sparc.   The default udiv_qrnnd (in C) is more than 10 times slower!  */#define udiv_qrnnd(q, r, n1, n0, d) \  __asm__ ("! Inlined udiv_qrnnd	mov	32,%%g1	subcc	%1,%2,%%g01:	bcs	5f	 addxcc %0,%0,%0	! shift n1n0 and a q-bit in lsb	sub	%1,%2,%1	! this kills msb of n	addx	%1,%1,%1	! so this can't give carry	subcc	%%g1,1,%%g12:	bne	1b	 subcc	%1,%2,%%g0	bcs	3f	 addxcc %0,%0,%0	! shift n1n0 and a q-bit in lsb	b	3f	 sub	%1,%2,%1	! this kills msb of n4:	sub	%1,%2,%15:	addxcc	%1,%1,%1	bcc	2b	 subcc	%%g1,1,%%g1! Got carry from n.  Subtract next step to cancel this carry.	bne	4b	 addcc	%0,%0,%0	! shift n1n0 and a 0-bit in lsb	sub	%1,%2,%13:	xnor	%0,0,%0	! End of inline udiv_qrnnd"					\	   : "=&r" ((USItype) (q)),					\	     "=&r" ((USItype) (r))					\	   : "r" ((USItype) (d)),					\	     "1" ((USItype) (n1)),					\	     "0" ((USItype) (n0)) : "%g1" __AND_CLOBBER_CC)#define UDIV_TIME (3+7*32)	/* 7 instructions/iteration. 32 iterations. */#endif /* __sparclite__ */#endif /* __sparc_v8__ */#endif /* __sparc__ */#if defined (__vax__)#define add_ssaaaa(sh, sl, ah, al, bh, bl) \  __asm__ ("addl2 %5,%1	adwc %3,%0"							\	   : "=g" ((USItype) (sh)),					\	     "=&g" ((USItype) (sl))					\	   : "%0" ((USItype) (ah)),					\	     "g" ((USItype) (bh)),					\	     "%1" ((USItype) (al)),					\	     "g" ((USItype) (bl)))#define sub_ddmmss(sh, sl, ah, al, bh, bl) \  __asm__ ("subl2 %5,%1	sbwc %3,%0"							\	   : "=g" ((USItype) (sh)),					\	     "=&g" ((USItype) (sl))					\	   : "0" ((USItype) (ah)),					\	     "g" ((USItype) (bh)),					\	     "1" ((USItype) (al)),					\	     "g" ((USItype) (bl)))#define umul_ppmm(xh, xl, m0, m1) \  do {									\    union {								\	UDItype __ll;							\	struct {USItype __l, __h;} __i;					\      } __xx;								\    USItype __m0 = (m0), __m1 = (m1);					\    __asm__ ("emul %1,%2,$0,%0"						\	     : "=r" (__xx.__ll)						\	     : "g" (__m0),						\	       "g" (__m1));						\    (xh) = __xx.__i.__h;						\    (xl) = __xx.__i.__l;						\    (xh) += ((((SItype) __m0 >> 31) & __m1)				\	     + (((SItype) __m1 >> 31) & __m0));				\  } while (0)#define sdiv_qrnnd(q, r, n1, n0, d) \  do {									\    union {DItype __ll;							\	   struct {SItype __l, __h;} __i;				\	  } __xx;							\    __xx.__i.__h = n1; __xx.__i.__l = n0;				\    __asm__ ("ediv %3,%2,%0,%1"						\	     : "=g" (q), "=g" (r)					\	     : "g" (__xx.__ll), "g" (d));				\  } while (0)#endif /* __vax__ */#endif /* __GNUC__ *//* If this machine has no inline assembler, use C macros.  */#if !defined (add_ssaaaa)#define add_ssaaaa(sh, sl, ah, al, bh, bl) \  do {									\    USItype __x;							\    __x = (al) + (bl);							\    (sh) = (ah) + (bh) + (__x < (al));					\    (sl) = __x;								\  } while (0)#endif#if !defined (sub_ddmmss)#define sub_ddmmss(sh, sl, ah, al, bh, bl) \  do {									\    USItype __x;							\    __x = (al) - (bl);							\    (sh) = (ah) - (bh) - (__x > (al));					\    (sl) = __x;								\  } while (0)#endif#if !defined (umul_ppmm)#define umul_ppmm(w1, w0, u, v)						\  do {									\    USItype __x0, __x1, __x2, __x3;					\    USItype __ul, __vl, __uh, __vh;					\									\    __ul = __ll_lowpart (u);						\    __uh = __ll_highpart (u);						\    __vl = __ll_lowpart (v);						\    __vh = __ll_highpart (v);						\									\    __x0 = (USItype) __ul * __vl;					\    __x1 = (USItype) __ul * __vh;					\    __x2 = (USItype) __uh * __vl;					\    __x3 = (USItype) __uh * __vh;					\									\    __x1 += __ll_highpart (__x0);/* this can't give carry */		\    __x1 += __x2;		/* but this indeed can */		\    if (__x1 < __x2)		/* did we get it? */			\      __x3 += __ll_B;		/* yes, add it in the proper pos. */	\									\    (w1) = __x3 + __ll_highpart (__x1);					\    (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0);		\  } while (0)#endif#if !defined (__umulsidi3)#define __umulsidi3(u, v) \  ({DIunion __w;							\    umul_ppmm (__w.s.high, __w.s.low, u, v);				\    __w.ll; })#endif/* Define this unconditionally, so it can be used for debugging.  */#define __udiv_qrnnd_c(q, r, n1, n0, d) \  do {									\    USItype __d1, __d0, __q1, __q0;					\    USItype __r1, __r0, __m;						\    __d1 = __ll_highpart (d);						\    __d0 = __ll_lowpart (d);						\									\    __r1 = (n1) % __d1;							\    __q1 = (n1) / __d1;							\    __m = (USItype) __q1 * __d0;					\    __r1 = __r1 * __ll_B | __ll_highpart (n0);				\    if (__r1 < __m)							\      {									\	__q1--, __r1 += (d);						\	if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\	  if (__r1 < __m)						\	    __q1--, __r1 += (d);					\      }									\    __r1 -= __m;							\									\    __r0 = __r1 % __d1;							\    __q0 = __r1 / __d1;							\    __m = (USItype) __q0 * __d0;					\    __r0 = __r0 * __ll_B | __ll_lowpart (n0);				\    if (__r0 < __m)							\      {									\	__q0--, __r0 += (d);						\	if (__r0 >= (d))						\	  if (__r0 < __m)						\	    __q0--, __r0 += (d);					\      }									\    __r0 -= __m;							\									\    (q) = (USItype) __q1 * __ll_B | __q0;				\    (r) = __r0;								\  } while (0)/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through   __udiv_w_sdiv (defined in libgcc or elsewhere).  */#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd)#define udiv_qrnnd(q, r, nh, nl, d) \  do {									\    USItype __r;							\    (q) = __udiv_w_sdiv (&__r, nh, nl, d);				\    (r) = __r;								\  } while (0)#endif/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c.  */#if !defined (udiv_qrnnd)#define UDIV_NEEDS_NORMALIZATION 1#define udiv_qrnnd __udiv_qrnnd_c#endif#if !defined (count_leading_zeros)extern const UQItype __clz_tab[];#define count_leading_zeros(count, x) \  do {									\    USItype __xr = (x);							\    USItype __a;							\									\    if (SI_TYPE_SIZE <= 32)						\      {									\	__a = __xr < ((USItype)1<<2*__BITS4)				\	  ? (__xr < ((USItype)1<<__BITS4) ? 0 : __BITS4)		\	  : (__xr < ((USItype)1<<3*__BITS4) ?  2*__BITS4 : 3*__BITS4);	\      }									\    else								\      {									\	for (__a = SI_TYPE_SIZE - 8; __a > 0; __a -= 8)			\	  if (((__xr >> __a) & 0xff) != 0)				\	    break;							\      }									\									\    (count) = SI_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a);		\  } while (0)#endif#ifndef UDIV_NEEDS_NORMALIZATION#define UDIV_NEEDS_NORMALIZATION 0#endif

⌨️ 快捷键说明

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