xref: /openbsd/lib/libc/arch/i386/gen/flt_rounds.S (revision ea6088e7)
1/* $OpenBSD: flt_rounds.S,v 1.7 2017/11/29 05:13:57 guenther Exp $ */
2/*
3 * Written by J.T. Conklin, Apr 4, 1995
4 * Public domain.
5 */
6
7#include "DEFS.h"
8
9	.section .rodata
10	.align 2
11_map:
12	.byte 1		/* round to nearest */
13	.byte 3		/* round to negative infinity */
14	.byte 2		/* round to positive infinity */
15	.byte 0		/* round to zero */
16
17ENTRY(__flt_rounds)
18	subl $4,%esp
19	fnstcw (%esp)
20	movl (%esp),%eax
21	shrl $10,%eax
22	andl $3,%eax
23#ifdef __PIC__
24	PIC_PROLOGUE
25	leal PIC_GOTOFF(_map),%ecx
26	PIC_EPILOGUE
27	movb (%ecx,%eax,1),%al
28#else
29	movb _map(,%eax,1),%al
30#endif
31	addl $4,%esp
32	ret
33END_STRONG(__flt_rounds);
34