arch/parisc/math-emu/sgl_float.h

Source file repositories/reference/linux-study-clean/arch/parisc/math-emu/sgl_float.h

File Facts

System
Linux kernel
Corpus path
arch/parisc/math-emu/sgl_float.h
Extension
.h
Size
18946 bytes
Lines
474
Domain
Architecture Layer
Bucket
arch/parisc
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (shift < 32) {							\
	Extall(extent) = Sall(srcdst) << (32-(shift));			\
    	Sall(srcdst) >>= shift;						\
    }									\
    else {								\
	Extall(extent) = Sall(srcdst);					\
	Sall(srcdst) = 0;						\
    }
#define Sgl_hiddenhigh3mantissa(sgl_value) Shiddenhigh3mantissa(sgl_value)
#define Sgl_hidden(sgl_value) Shidden(sgl_value)
#define Sgl_lowmantissa(sgl_value) Slow(sgl_value)

/* The left argument is never smaller than the right argument */
#define Sgl_subtract(sgl_left,sgl_right,sgl_result) \
    Sall(sgl_result) = Sall(sgl_left) - Sall(sgl_right)

/* Subtract right augmented with extension from left augmented with zeros and
 * store into result and extension. */
#define Sgl_subtract_withextension(left,right,extent,result)		\
    /* sgl_floating_point left,right,result; extension extent */	\
  Sgl_subtract(left,right,result);					\
  if((Extall(extent) = 0-Extall(extent)))				\
      Sall(result) = Sall(result)-1

#define Sgl_addition(sgl_left,sgl_right,sgl_result) \
    Sall(sgl_result) = Sall(sgl_left) + Sall(sgl_right)

#define Sgl_xortointp1(left,right,result)			\
    result = Sall(left) XOR Sall(right);

#define Sgl_xorfromintp1(left,right,result)			\
    Sall(result) = left XOR Sall(right)

/* Need to Initialize */
#define Sgl_makequietnan(dest)						\
    Sall(dest) = ((SGL_EMAX+SGL_BIAS)+1)<< (32-(1+SGL_EXP_LENGTH))	\
                 | (1<<(32-(1+SGL_EXP_LENGTH+2)))
#define Sgl_makesignalingnan(dest)					\
    Sall(dest) = ((SGL_EMAX+SGL_BIAS)+1)<< (32-(1+SGL_EXP_LENGTH))	\
                 | (1<<(32-(1+SGL_EXP_LENGTH+1)))

#define Sgl_normalize(sgl_opnd,exponent)			\
	while(Sgl_iszero_hiddenhigh7mantissa(sgl_opnd)) {	\
		Sgl_leftshiftby8(sgl_opnd);			\
		exponent -= 8;					\
	}							\
	if(Sgl_iszero_hiddenhigh3mantissa(sgl_opnd)) {		\
		Sgl_leftshiftby4(sgl_opnd);			\
		exponent -= 4;					\
	}							\
	while(Sgl_iszero_hidden(sgl_opnd)) {			\
		Sgl_leftshiftby1(sgl_opnd);			\
		exponent -= 1;					\
	}

#define Sgl_setoverflow(sgl_opnd)				\
	/* set result to infinity or largest number */		\
	switch (Rounding_mode()) {				\
		case ROUNDPLUS:					\
			if (Sgl_isone_sign(sgl_opnd)) {		\
				Sgl_setlargestnegative(sgl_opnd); \
			}					\
			else {					\
				Sgl_setinfinitypositive(sgl_opnd); \
			}					\
			break;					\
		case ROUNDMINUS:				\
			if (Sgl_iszero_sign(sgl_opnd)) {	\
				Sgl_setlargestpositive(sgl_opnd); \
			}					\
			else {					\
				Sgl_setinfinitynegative(sgl_opnd); \
			}					\
			break;					\
		case ROUNDNEAREST:				\
			Sgl_setinfinity_exponentmantissa(sgl_opnd); \
			break;					\
		case ROUNDZERO:					\
			Sgl_setlargest_exponentmantissa(sgl_opnd); \
	}

#define Sgl_denormalize(opnd,exponent,guard,sticky,inexact)		\
	Sgl_clear_signexponent_set_hidden(opnd);			\
	if (exponent >= (1 - SGL_P)) {					\
		guard = (Sall(opnd) >> -exponent) & 1;			\
		if (exponent < 0) sticky |= Sall(opnd) << (32+exponent); \
		inexact = guard | sticky;				\
		Sall(opnd) >>= (1-exponent);				\
	}								\
	else {								\

Annotation

Implementation Notes