Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) |	smovecr.sa 3.1 12/10/90
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) |	The entry point sMOVECR returns the constant at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) |	offset given in the instruction field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) |	Input: An offset in the instruction word.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) |	Output:	The constant rounded to the user's rounding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) |		mode unchecked for overflow.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) |	Modified: fp0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) |		Copyright (C) Motorola, Inc. 1990
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) |			All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) |       For details on the license for this file, please see the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) |       file, README, in this same directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) |SMOVECR	idnt	2,1 | Motorola 040 Floating Point Software Package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	|section 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include "fpsp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	|xref	nrm_set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	|xref	round
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	|xref	PIRN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	|xref	PIRZRM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	|xref	PIRP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	|xref	SMALRN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	|xref	SMALRZRM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	|xref	SMALRP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	|xref	BIGRN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	|xref	BIGRZRM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	|xref	BIGRP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) FZERO:	.long	00000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) |	FMOVECR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	.global	smovcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) smovcr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	bfextu	CMDREG1B(%a6){#9:#7},%d0 |get offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	bfextu	USER_FPCR(%a6){#26:#2},%d1 |get rmode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) | check range of offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	tstb	%d0		|if zero, offset is to pi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	beqs	PI_TBL		|it is pi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	cmpib	#0x0a,%d0		|check range $01 - $0a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	bles	Z_VAL		|if in this range, return zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	cmpib	#0x0e,%d0		|check range $0b - $0e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	bles	SM_TBL		|valid constants in this range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	cmpib	#0x2f,%d0		|check range $10 - $2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	bles	Z_VAL		|if in this range, return zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	cmpib	#0x3f,%d0		|check range $30 - $3f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	ble	BG_TBL		|valid constants in this range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) Z_VAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	fmoves	FZERO,%fp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) PI_TBL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	tstb	%d1		|offset is zero, check for rmode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	beqs	PI_RN		|if zero, rn mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	cmpib	#0x3,%d1		|check for rp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	beqs	PI_RP		|if 3, rp mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) PI_RZRM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	leal	PIRZRM,%a0	|rmode is rz or rm, load PIRZRM in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	bra	set_finx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) PI_RN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	leal	PIRN,%a0		|rmode is rn, load PIRN in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	bra	set_finx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) PI_RP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	leal	PIRP,%a0		|rmode is rp, load PIRP in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	bra	set_finx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) SM_TBL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	subil	#0xb,%d0		|make offset in 0 - 4 range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	tstb	%d1		|check for rmode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	beqs	SM_RN		|if zero, rn mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	cmpib	#0x3,%d1		|check for rp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	beqs	SM_RP		|if 3, rp mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) SM_RZRM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	leal	SMALRZRM,%a0	|rmode is rz or rm, load SMRZRM in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	cmpib	#0x2,%d0		|check if result is inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	ble	set_finx	|if 0 - 2, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	bra	no_finx		|if 3, it is exact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) SM_RN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	leal	SMALRN,%a0	|rmode is rn, load SMRN in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	cmpib	#0x2,%d0		|check if result is inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	ble	set_finx	|if 0 - 2, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	bra	no_finx		|if 3, it is exact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) SM_RP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	leal	SMALRP,%a0	|rmode is rp, load SMRP in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	cmpib	#0x2,%d0		|check if result is inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	ble	set_finx	|if 0 - 2, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	bra	no_finx		|if 3, it is exact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) BG_TBL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	subil	#0x30,%d0		|make offset in 0 - f range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	tstb	%d1		|check for rmode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	beqs	BG_RN		|if zero, rn mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	cmpib	#0x3,%d1		|check for rp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	beqs	BG_RP		|if 3, rp mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) BG_RZRM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	leal	BIGRZRM,%a0	|rmode is rz or rm, load BGRZRM in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	cmpib	#0x1,%d0		|check if result is inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	ble	set_finx	|if 0 - 1, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	cmpib	#0x7,%d0		|second check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	ble	no_finx		|if 0 - 7, it is exact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	bra	set_finx	|if 8 - f, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) BG_RN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	leal	BIGRN,%a0	|rmode is rn, load BGRN in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	cmpib	#0x1,%d0		|check if result is inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	ble	set_finx	|if 0 - 1, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	cmpib	#0x7,%d0		|second check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	ble	no_finx		|if 0 - 7, it is exact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	bra	set_finx	|if 8 - f, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) BG_RP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	leal	BIGRP,%a0	|rmode is rp, load SMRP in a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	cmpib	#0x1,%d0		|check if result is inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	ble	set_finx	|if 0 - 1, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	cmpib	#0x7,%d0		|second check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	ble	no_finx		|if 0 - 7, it is exact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) |	bra	set_finx	;if 8 - f, it is inexact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) set_finx:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	orl	#inx2a_mask,USER_FPSR(%a6) |set inex2/ainex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) no_finx:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	mulul	#12,%d0			|use offset to point into tables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	movel	%d1,L_SCR1(%a6)		|load mode for round call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	bfextu	USER_FPCR(%a6){#24:#2},%d1	|get precision
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	tstl	%d1			|check if extended precision
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) | Precision is extended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	bnes	not_ext			|if extended, do not call round
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	fmovemx (%a0,%d0),%fp0-%fp0		|return result in fp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) | Precision is single or double
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) not_ext:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	swap	%d1			|rnd prec in upper word of d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	addl	L_SCR1(%a6),%d1		|merge rmode in low word of d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	movel	(%a0,%d0),FP_SCR1(%a6)	|load first word to temp storage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	movel	4(%a0,%d0),FP_SCR1+4(%a6)	|load second word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	movel	8(%a0,%d0),FP_SCR1+8(%a6)	|load third word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	clrl	%d0			|clear g,r,s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	lea	FP_SCR1(%a6),%a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	btstb	#sign_bit,LOCAL_EX(%a0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	sne	LOCAL_SGN(%a0)		|convert to internal ext. format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	bsr	round			|go round the mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	bfclr	LOCAL_SGN(%a0){#0:#8}	|convert back to IEEE ext format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	beqs	fin_fcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	bsetb	#sign_bit,LOCAL_EX(%a0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) fin_fcr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	fmovemx (%a0),%fp0-%fp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	|end