1/* $OpenBSD: flt_rounds.S,v 1.8 2018/07/03 23:14:05 mortimer Exp $ */ 2/* $NetBSD: flt_rounds.S,v 1.2 2002/06/06 23:04:35 fvdl Exp $ */ 3 4/* 5 * Written by J.T. Conklin, Apr 4, 1995 6 * Public domain. 7 */ 8 9#include "DEFS.h" 10 11 .section .rodata 12_map: 13 .byte 1 /* round to nearest */ 14 .byte 3 /* round to negative infinity */ 15 .byte 2 /* round to positive infinity */ 16 .byte 0 /* round to zero */ 17 18ENTRY(__flt_rounds) 19 RETGUARD_SETUP(__flt_rounds, r11) 20 fnstcw -4(%rsp) 21 movl -4(%rsp),%eax 22 shrl $10,%eax 23 andl $3,%eax 24#ifdef __PIC__ 25 leaq _map(%rip),%rcx 26 movb (%rcx,%rax,1),%al 27#else 28 movb _map(,%rax,1),%al 29#endif 30 RETGUARD_CHECK(__flt_rounds, r11) 31 ret 32END_STRONG(__flt_rounds) 33