arch/m68k/fpsp040/round.S

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

File Facts

System
Linux kernel
Corpus path
arch/m68k/fpsp040/round.S
Extension
.S
Size
16764 bytes
Lines
649
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

bfextu	LOCAL_HI(%a0){#24:#2},%d3	|sgl prec. g-r are 2 bits right
	movel	#30,%d2			|of the sgl prec. limits
	lsll	%d2,%d3			|shift g-r bits to MSB of d3
	movel	LOCAL_HI(%a0),%d2		|get word 2 for s-bit test
	andil	#0x0000003f,%d2		|s bit is the or of all other
	bnes	st_stky			|bits to the right of g-r
	tstl	LOCAL_LO(%a0)		|test lower mantissa
	bnes	st_stky			|if any are set, set sticky
	tstl	%d0			|test original g,r,s
	bnes	st_stky			|if any are set, set sticky
	bras	end_sd			|if words 3 and 4 are clr, exit
grs_dbl:
	bfextu	LOCAL_LO(%a0){#21:#2},%d3	|dbl-prec. g-r are 2 bits right
	movel	#30,%d2			|of the dbl prec. limits
	lsll	%d2,%d3			|shift g-r bits to the MSB of d3
	movel	LOCAL_LO(%a0),%d2		|get lower mantissa  for s-bit test
	andil	#0x000001ff,%d2		|s bit is the or-ing of all
	bnes	st_stky			|other bits to the right of g-r
	tstl	%d0			|test word original g,r,s
	bnes	st_stky			|if any are set, set sticky
	bras	end_sd			|if clear, exit
st_stky:
	bset	#rnd_stky_bit,%d3
end_sd:
	movel	%d3,%d0			|return grs to d0
	moveml	(%a7)+,%d2/%d3		|restore scratch registers
end_ext_grs:
	swap	%d1			|restore d1 to original
	rts

|*******************  Local Equates
	.set	ad_1_sgl,0x00000100	|  constant to add 1 to l-bit in sgl prec
	.set	ad_1_dbl,0x00000800	|  constant to add 1 to l-bit in dbl prec


|Jump table for adding 1 to the l-bit indexed by rnd prec

add_to_l:
	.long	add_ext
	.long	add_sgl
	.long	add_dbl
	.long	add_dbl
|
|	ADD SINGLE
|
add_sgl:
	addl	#ad_1_sgl,LOCAL_HI(%a0)
	bccs	scc_clr			|no mantissa overflow
	roxrw  LOCAL_HI(%a0)		|shift v-bit back in
	roxrw  LOCAL_HI+2(%a0)		|shift v-bit back in
	addw	#0x1,LOCAL_EX(%a0)	|and incr exponent
scc_clr:
	tstl	%d0			|test for rs = 0
	bnes	sgl_done
	andiw  #0xfe00,LOCAL_HI+2(%a0)	|clear the l-bit
sgl_done:
	andil	#0xffffff00,LOCAL_HI(%a0) |truncate bits beyond sgl limit
	clrl	LOCAL_LO(%a0)		|clear d2
	rts

|
|	ADD EXTENDED
|
add_ext:
	addql  #1,LOCAL_LO(%a0)		|add 1 to l-bit
	bccs	xcc_clr			|test for carry out
	addql  #1,LOCAL_HI(%a0)		|propagate carry
	bccs	xcc_clr
	roxrw  LOCAL_HI(%a0)		|mant is 0 so restore v-bit
	roxrw  LOCAL_HI+2(%a0)		|mant is 0 so restore v-bit

Annotation

Implementation Notes