arch/m68k/fpsp040/slogn.S

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

File Facts

System
Linux kernel
Corpus path
arch/m68k/fpsp040/slogn.S
Extension
.S
Size
19300 bytes
Lines
592
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

|
|	slogn.sa 3.1 12/10/90
|
|	slogn computes the natural logarithm of an
|	input value. slognd does the same except the input value is a
|	denormalized number. slognp1 computes log(1+X), and slognp1d
|	computes log(1+X) for denormalized X.
|
|	Input: Double-extended value in memory location pointed to by address
|		register a0.
|
|	Output:	log(X) or log(1+X) returned in floating-point register 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 slogn takes approximately 190 cycles for input
|		argument X such that |X-1| >= 1/16, which is the usual
|		situation. For those arguments, slognp1 takes approximately
|		 210 cycles. For the less common arguments, the program will
|		 run no worse than 10% slower.
|
|	Algorithm:
|	LOGN:
|	Step 1. If |X-1| < 1/16, approximate log(X) by an odd polynomial in
|		u, where u = 2(X-1)/(X+1). Otherwise, move on to Step 2.
|
|	Step 2. X = 2**k * Y where 1 <= Y < 2. Define F to be the first seven
|		significant bits of Y plus 2**(-7), i.e. F = 1.xxxxxx1 in base
|		2 where the six "x" match those of Y. Note that |Y-F| <= 2**(-7).
|
|	Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a polynomial in u,
|		log(1+u) = poly.
|
|	Step 4. Reconstruct log(X) = log( 2**k * Y ) = k*log(2) + log(F) + log(1+u)
|		by k*log(2) + (log(F) + poly). The values of log(F) are calculated
|		beforehand and stored in the program.
|
|	lognp1:
|	Step 1: If |X| < 1/16, approximate log(1+X) by an odd polynomial in
|		u where u = 2X/(2+X). Otherwise, move on to Step 2.
|
|	Step 2: Let 1+X = 2**k * Y, where 1 <= Y < 2. Define F as done in Step 2
|		of the algorithm for LOGN and compute log(1+X) as
|		k*log(2) + log(F) + poly where poly approximates log(1+u),
|		u = (Y-F)/F.
|
|	Implementation Notes:
|	Note 1. There are 64 different possible values for F, thus 64 log(F)'s
|		need to be tabulated. Moreover, the values of 1/F are also
|		tabulated so that the division in (Y-F)/F can be performed by a
|		multiplication.
|
|	Note 2. In Step 2 of lognp1, in order to preserved accuracy, the value
|		Y-F has to be calculated carefully when 1/2 <= X < 3/2.
|
|	Note 3. To fully exploit the pipeline, polynomials are usually separated
|		into two parts evaluated independently before being added up.
|

|		Copyright (C) Motorola, Inc. 1990
|			All Rights Reserved
|
|       For details on the license for this file, please see the
|       file, README, in this same directory.

|slogn	idnt	2,1 | Motorola 040 Floating Point Software Package

Annotation

Implementation Notes