shithub: riscv

ref: 95d6ca9f3c05283057f1542f3af37c8741cbc11b
dir: /sys/src/ape/lib/9/alpha/getfcr.s/

View raw version
#define	EXCB	WORD	$0x60000400		/* until 7a/7l catch up */

TEXT	getfsr(SB), $8
	EXCB
	MOVT	FPCR, F0
	EXCB
	MOVT	F0, tmp-8(SP)
	MOVL	tmp-4(SP), R1
	MOVQ	$0x01e00000, R2
	AND		R2, R1, R0
	RET

TEXT	setfsr(SB), $8
	MOVQ	$0x01e00000, R2
	EXCB
	MOVT	FPCR, F0
	EXCB
	MOVT	F0, tmp-8(SP)
	MOVL	tmp-4(SP), R1
	ANDNOT	R2, R1, R3
	AND		R2, R0, R4
	OR		R3, R4, R5
	MOVL	R5, tmp-4(SP)
	MOVT	tmp-8(SP), F0
	EXCB
	MOVT	F0, FPCR
	EXCB
	RET

TEXT	getfcr(SB), $8
	EXCB
	MOVT	FPCR, F0
	EXCB
	MOVT	F0, tmp-8(SP)
	MOVL	tmp-4(SP), R1
	MOVQ	$0x700c0000, R2
	AND		R2, R1, R0
	XOR		R2, R0
	RET

TEXT	setfcr(SB), $8
	MOVQ	$0x700c0000, R2
	XOR		R2, R0
	EXCB
	MOVT	FPCR, F0
	EXCB
	MOVT	F0, tmp-8(SP)
	MOVL	tmp-4(SP), R1
	ANDNOT	R2, R1, R3
	AND		R2, R0, R4
	OR		R3, R4, R5
	MOVL	R5, tmp-4(SP)
	MOVT	tmp-8(SP), F0
	EXCB
	MOVT	F0, FPCR
	EXCB
	RET