xref: /openbsd/lib/libm/arch/i387/s_cos.S (revision 3d8817e4)
1/*	$OpenBSD: s_cos.S,v 1.2 2005/08/02 11:17:31 espie Exp $ */
2/*
3 * Written by J.T. Conklin <jtc@netbsd.org>.
4 * Public domain.
5 */
6
7#include <machine/asm.h>
8
9ENTRY(cos)
10	fldl	4(%esp)
11	fcos
12	fnstsw	%ax
13	andw	$0x400,%ax
14	jnz	1f
15	ret
161:	fldpi
17	fadd	%st(0)
18	fxch	%st(1)
192:	fprem1
20	fnstsw	%ax
21	andw	$0x400,%ax
22	jnz	2b
23	fstp	%st(1)
24	fcos
25	ret
26