about summary refs log tree commit diff
path: root/sysdeps/x86_64/fpu/s_nearbyintl.S
blob: 76d41bdd522e71303ee80ebabf5dd9bde2dc7c93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Written by J.T. Conklin <jtc@netbsd.org>.
 * Public domain.
 */
/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>.  */

#include <machine/asm.h>

ENTRY(__nearbyintl)
	fldt	8(%rsp)
	fnstenv	-28(%rsp)
	movl	-28(%rsp), %eax
	orl	$0x20, %eax
	movl	%eax, -32(%rsp)
	fldcw	-32(%rsp)
	frndint
	fnstsw
	andl	$0x1, %eax
	orl	%eax, -24(%rsp)
	fldenv	-28(%rsp)
	ret
END (__nearbyintl)
weak_alias (__nearbyintl, nearbyintl)