arch/m68k/fpsp040/stwotox.S

Source file repositories/reference/linux-study-clean/arch/m68k/fpsp040/stwotox.S

File Facts

System
Linux kernel
Corpus path
arch/m68k/fpsp040/stwotox.S
Extension
.S
Size
12262 bytes
Lines
427
Domain
Architecture Layer
Bucket
arch/m68k
Inferred role
Architecture Layer: arch/m68k
Status
atlas-only

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

|
|	stwotox.sa 3.1 12/10/90
|
|	stwotox  --- 2**X
|	stwotoxd --- 2**X for denormalized X
|	stentox  --- 10**X
|	stentoxd --- 10**X for denormalized X
|
|	Input: Double-extended number X in location pointed to
|		by address register a0.
|
|	Output: The function values are returned in Fp0.
|
|	Accuracy and Monotonicity: The returned result is within 2 ulps in
|		64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
|		result is subsequently rounded to double precision. The
|		result is provably monotonic in double precision.
|
|	Speed: The program stwotox takes approximately 190 cycles and the
|		program stentox takes approximately 200 cycles.
|
|	Algorithm:
|
|	twotox
|	1. If |X| > 16480, go to ExpBig.
|
|	2. If |X| < 2**(-70), go to ExpSm.
|
|	3. Decompose X as X = N/64 + r where |r| <= 1/128. Furthermore
|		decompose N as
|		 N = 64(M + M') + j,  j = 0,1,2,...,63.
|
|	4. Overwrite r := r * log2. Then
|		2**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r).
|		Go to expr to compute that expression.
|
|	tentox
|	1. If |X| > 16480*log_10(2) (base 10 log of 2), go to ExpBig.
|
|	2. If |X| < 2**(-70), go to ExpSm.
|
|	3. Set y := X*log_2(10)*64 (base 2 log of 10). Set
|		N := round-to-int(y). Decompose N as
|		 N = 64(M + M') + j,  j = 0,1,2,...,63.
|
|	4. Define r as
|		r := ((X - N*L1)-N*L2) * L10
|		where L1, L2 are the leading and trailing parts of log_10(2)/64
|		and L10 is the natural log of 10. Then
|		10**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r).
|		Go to expr to compute that expression.
|
|	expr
|	1. Fetch 2**(j/64) from table as Fact1 and Fact2.
|
|	2. Overwrite Fact1 and Fact2 by
|		Fact1 := 2**(M) * Fact1
|		Fact2 := 2**(M) * Fact2
|		Thus Fact1 + Fact2 = 2**(M) * 2**(j/64).
|
|	3. Calculate P where 1 + P approximates exp(r):
|		P = r + r*r*(A1+r*(A2+...+r*A5)).
|
|	4. Let AdjFact := 2**(M'). Return
|		AdjFact * ( Fact1 + ((Fact1*P) + Fact2) ).
|		Exit.
|
|	ExpBig
|	1. Generate overflow by Huge * Huge if X > 0; otherwise, generate
|		underflow by Tiny * Tiny.

Annotation

Implementation Notes