1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 24 */ 25 /* 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 27 * Use is subject to license terms. 28 */ 29 30 #ifndef _FMA_H 31 #define _FMA_H 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #ifdef __sparc 38 39 /* 40 * Common definitions for fma routines (SPARC) 41 */ 42 43 /* fsr fields */ 44 45 /* current exception bits */ 46 #define FSR_NXC 0x1 47 #define FSR_DZC 0x2 48 #define FSR_UFC 0x4 49 #define FSR_OFC 0x8 50 #define FSR_NVC 0x10 51 #define FSR_CEXC 0x1f /* mask for all cexc bits */ 52 53 /* accrued exception bits */ 54 #define FSR_NXA 0x20 55 #define FSR_DZA 0x40 56 #define FSR_UFA 0x80 57 #define FSR_OFA 0x100 58 #define FSR_NVA 0x200 59 60 /* trap enable bits */ 61 #define FSR_NXM 0x00800000 62 #define FSR_DZM 0x01000000 63 #define FSR_UFM 0x02000000 64 #define FSR_OFM 0x04000000 65 #define FSR_NVM 0x08000000 66 67 /* rounding directions (right-adjusted) */ 68 #define FSR_RN 0 69 #define FSR_RZ 1 70 #define FSR_RP 2 71 #define FSR_RM 3 72 73 /* inline templates */ 74 extern void __fenv_getfsr32(unsigned int *); 75 extern void __fenv_setfsr32(const unsigned int *); 76 77 #endif /* __sparc */ 78 79 80 #if defined(__x86) 81 82 /* 83 * Common definitions for fma routines (x86) 84 */ 85 86 /* control and status word fields */ 87 88 /* exception flags */ 89 #define FSW_NV 0x1 90 #define FSW_DN 0x2 91 #define FSW_DZ 0x4 92 #define FSW_OF 0x8 93 #define FSW_UF 0x10 94 #define FSW_NX 0x20 95 96 /* exception masks */ 97 #define FCW_NVM 0x00010000 98 #define FCW_DNM 0x00020000 99 #define FCW_DZM 0x00040000 100 #define FCW_OFM 0x00080000 101 #define FCW_UFM 0x00100000 102 #define FCW_NXM 0x00200000 103 #define FCW_ALLM 0x003f0000 104 105 /* rounding directions */ 106 #define FCW_RN 0x00000000 107 #define FCW_RM 0x04000000 108 #define FCW_RP 0x08000000 109 #define FCW_RZ 0x0c000000 110 111 /* rounding precisions */ 112 #define FCW_P24 0x00000000 113 #define FCW_P53 0x02000000 114 #define FCW_P64 0x03000000 115 116 /* inline templates */ 117 extern void __fenv_getcwsw(unsigned int *); 118 extern void __fenv_setcwsw(const unsigned int *); 119 120 #endif /* __x86 */ 121 122 #ifdef __cplusplus 123 } 124 #endif 125 126 #endif /* _FMA_H */ 127