summaryrefslogtreecommitdiff
path: root/lib/libc/arch/m88k/gen/fpgetround.c
blob: bbd59ddf5fdf6a22b3acf41022fcbdf64983b0f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*	$OpenBSD: fpgetround.c,v 1.5 2016/07/26 19:07:09 guenther Exp $	*/

/*
 * Written by J.T. Conklin, Apr 10, 1995
 * Public domain.
 * Ported to 88k by Nivas Madhur.
 */

#include <ieeefp.h>

fp_rnd
fpgetround(void)
{
	int x;

	__asm__ volatile ("fldcr %0, %%fcr63" : "=r" (x));
	return (x >> 14) & 0x03;
}
DEF_WEAK(fpgetround);