1 1.2 uebayasi /* $NetBSD: fpsetprec.S,v 1.2 2014/05/22 15:01:56 uebayasi Exp $ */ 2 1.1 christos 3 1.1 christos /* 4 1.1 christos * Written by Frank van der Linden at Wasabi Systems for NetBSD. 5 1.1 christos * Public domain. 6 1.1 christos */ 7 1.1 christos 8 1.1 christos #include <machine/asm.h> 9 1.1 christos 10 1.1 christos /* 11 1.1 christos * XXX set both the x87 control word and the SSE mxcsr register. 12 1.1 christos * Applications should only set exception and round flags 13 1.1 christos * via the fp*() interface, otherwise the status words 14 1.1 christos * will get our of sync. 15 1.1 christos */ 16 1.1 christos 17 1.1 christos 18 1.1 christos #ifdef WEAK_ALIAS 19 1.1 christos WEAK_ALIAS(fpsetprec, _fpsetprec) 20 1.1 christos ENTRY(_fpsetprec) 21 1.1 christos #else 22 1.1 christos ENTRY(fpsetprec) 23 1.1 christos #endif 24 1.1 christos fnstcw -4(%rsp) 25 1.1 christos 26 1.1 christos andl $3,%edi 27 1.1 christos 28 1.1 christos movl -4(%rsp),%edx 29 1.1 christos rorl $8,%edx 30 1.1 christos movl %edx,%eax 31 1.1 christos andl $3,%eax 32 1.1 christos 33 1.1 christos andl $~3,%edx 34 1.1 christos orl %edi,%edx 35 1.1 christos roll $8,%edx 36 1.1 christos movl %edx,-4(%rsp) 37 1.1 christos 38 1.1 christos fldcw -4(%rsp) 39 1.1 christos ret 40 1.2 uebayasi #ifdef WEAK_ALIAS 41 1.2 uebayasi END(_fpsetprec) 42 1.2 uebayasi #else 43 1.2 uebayasi END(fpsetprec) 44 1.2 uebayasi #endif 45