Print this page
11210 libm should be cstyle(1ONBLD) clean
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/m9x/fex_handler.h
+++ new/usr/src/lib/libm/common/m9x/fex_handler.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 /*
26 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 30 #ifndef _M9X_FEX_HANDLER_H
31 31 #define _M9X_FEX_HANDLER_H
32 32
33 33 /* the following enums must match the bit positions in fenv.h */
34 34 enum fex_exception {
35 35 fex_inexact = 0,
36 36 fex_division = 1,
37 37 fex_underflow = 2,
38 38 fex_overflow = 3,
39 39 fex_inv_zdz = 4,
40 40 fex_inv_idi = 5,
41 41 fex_inv_isi = 6,
42 42 fex_inv_zmi = 7,
43 43 fex_inv_sqrt = 8,
44 44 fex_inv_snan = 9,
45 45 fex_inv_int = 10,
46 46 fex_inv_cmp = 11
47 47 };
48 48
49 49
50 50 /* auxiliary functions in __fex_hdlr.c */
51 51 extern struct fex_handler_data *__fex_get_thr_handlers(void);
52 52 extern void __fex_update_te(void);
53 53
54 54 /* auxiliary functions in __fex_sym.c */
55 55 extern void __fex_sym_init(void);
56 56 extern char *__fex_sym(char *, char **);
57 57
58 58 /* auxiliary functions in fex_log.c */
59 59 extern void __fex_mklog(ucontext_t *, char *, int, enum fex_exception,
60 60 int, void *);
61 61
↓ open down ↓ |
61 lines elided |
↑ open up ↑ |
62 62 /* system-dependent auxiliary functions */
63 63 extern enum fex_exception __fex_get_invalid_type(siginfo_t *, ucontext_t *);
64 64 extern void __fex_get_op(siginfo_t *, ucontext_t *, fex_info_t *);
65 65 extern void __fex_st_result(siginfo_t *, ucontext_t *, fex_info_t *);
66 66
67 67 /* inline templates and macros for accessing fp state */
68 68 extern void __fenv_getfsr(unsigned long *);
69 69 extern void __fenv_setfsr(const unsigned long *);
70 70
71 71 #if defined(__sparc)
72 +#define __fenv_get_rd(X) ((X >> 30) & 0x3)
73 +#define __fenv_set_rd(X, Y) X = (X & ~0xc0000000ul) | ((Y) << 30)
72 74
73 -#define __fenv_get_rd(X) ((X>>30)&0x3)
74 -#define __fenv_set_rd(X,Y) X=(X&~0xc0000000ul)|((Y)<<30)
75 -
76 -#define __fenv_get_te(X) ((X>>23)&0x1f)
77 -#define __fenv_set_te(X,Y) X=(X&~0x0f800000ul)|((Y)<<23)
78 -
79 -#define __fenv_get_ex(X) ((X>>5)&0x1f)
80 -#define __fenv_set_ex(X,Y) X=(X&~0x000003e0ul)|((Y)<<5)
75 +#define __fenv_get_te(X) ((X >> 23) & 0x1f)
76 +#define __fenv_set_te(X, Y) X = (X & ~0x0f800000ul) | ((Y) << 23)
81 77
78 +#define __fenv_get_ex(X) ((X >> 5) & 0x1f)
79 +#define __fenv_set_ex(X, Y) X = (X & ~0x000003e0ul) |((Y) << 5)
82 80 #elif defined(__x86)
83 -
84 81 extern void __fenv_getcwsw(unsigned int *);
85 82 extern void __fenv_setcwsw(const unsigned int *);
86 83
87 84 extern void __fenv_getmxcsr(unsigned int *);
88 85 extern void __fenv_setmxcsr(const unsigned int *);
89 86
90 -#define __fenv_get_rd(X) ((X>>26)&3)
91 -#define __fenv_set_rd(X,Y) X=(X&~0x0c000000)|((Y)<<26)
87 +#define __fenv_get_rd(X) ((X >> 26) & 3)
88 +#define __fenv_set_rd(X, Y) X = (X & ~0x0c000000) | ((Y) << 26)
92 89
93 -#define __fenv_get_rp(X) ((X>>24)&3)
94 -#define __fenv_set_rp(X,Y) X=(X&~0x03000000)|((Y)<<24)
90 +#define __fenv_get_rp(X) ((X >> 24) & 3)
91 +#define __fenv_set_rp(X, Y) X = (X & ~0x03000000) | ((Y) << 24)
95 92
96 -#define __fenv_get_te(X) ((X>>16)&0x3d)
97 -#define __fenv_set_te(X,Y) X=(X&~0x003d0000)|((Y)<<16)
93 +#define __fenv_get_te(X) ((X >> 16) & 0x3d)
94 +#define __fenv_set_te(X, Y) X = (X & ~0x003d0000) |((Y) << 16)
98 95
99 -#define __fenv_get_ex(X) (X&0x3d)
100 -#define __fenv_set_ex(X,Y) X=(X&~0x0000003d)|(Y)
96 +#define __fenv_get_ex(X) (X & 0x3d)
97 +#define __fenv_set_ex(X, Y) X = (X & ~0x0000003d) | (Y)
101 98
102 -/*
99 +/*
103 100 * These macros define some useful distinctions between various
104 101 * SSE instructions. In some cases, distinctions are made for
105 102 * the purpose of simplifying the decoding of instructions, while
106 103 * in other cases, they are made for the purpose of simplying the
107 104 * emulation. Note that these values serve as bit flags within
108 105 * the enum values in sseinst_t.
109 106 */
110 -#define DOUBLE 0x100
111 -#define SIMD 0x080
112 -#define INTREG 0x040
107 +#define DOUBLE 0x100
108 +#define SIMD 0x080
109 +#define INTREG 0x040
113 110
114 111 typedef union {
115 112 double d[2];
116 113 long long l[2];
117 114 float f[4];
118 115 int i[4];
119 116 } sseoperand_t;
120 117
121 118 /* structure to hold a decoded SSE instruction */
122 119 typedef struct {
123 120 enum {
124 121 /* single precision scalar instructions */
125 122 cmpss = 0,
126 123 minss = 1,
127 124 maxss = 2,
128 125 addss = 3,
129 126 subss = 4,
130 127 mulss = 5,
131 128 divss = 6,
132 129 sqrtss = 7,
133 130 ucomiss = 16,
134 131 comiss = 17,
135 132 cvtss2sd = 32,
136 133 cvtsi2ss = INTREG + 0,
137 134 cvttss2si = INTREG + 1,
138 135 cvtss2si = INTREG + 2,
139 136 cvtsi2ssq = INTREG + 8,
140 137 cvttss2siq = INTREG + 9,
141 138 cvtss2siq = INTREG + 10,
142 139
143 140 /* single precision SIMD instructions */
144 141 cmpps = SIMD + 0,
145 142 minps = SIMD + 1,
146 143 maxps = SIMD + 2,
147 144 addps = SIMD + 3,
148 145 subps = SIMD + 4,
149 146 mulps = SIMD + 5,
150 147 divps = SIMD + 6,
151 148 sqrtps = SIMD + 7,
152 149 cvtps2pd = SIMD + 32,
153 150 cvtdq2ps = SIMD + 34,
154 151 cvttps2dq = SIMD + 35,
155 152 cvtps2dq = SIMD + 36,
156 153 cvtpi2ps = SIMD + INTREG + 0,
157 154 cvttps2pi = SIMD + INTREG + 1,
158 155 cvtps2pi = SIMD + INTREG + 2,
159 156
160 157 /* double precision scalar instructions */
161 158 cmpsd = DOUBLE + 0,
162 159 minsd = DOUBLE + 1,
163 160 maxsd = DOUBLE + 2,
164 161 addsd = DOUBLE + 3,
165 162 subsd = DOUBLE + 4,
166 163 mulsd = DOUBLE + 5,
167 164 divsd = DOUBLE + 6,
168 165 sqrtsd = DOUBLE + 7,
169 166 ucomisd = DOUBLE + 16,
170 167 comisd = DOUBLE + 17,
171 168 cvtsd2ss = DOUBLE + 32,
172 169 cvtsi2sd = DOUBLE + INTREG + 0,
173 170 cvttsd2si = DOUBLE + INTREG + 1,
174 171 cvtsd2si = DOUBLE + INTREG + 2,
175 172 cvtsi2sdq = DOUBLE + INTREG + 8,
176 173 cvttsd2siq = DOUBLE + INTREG + 9,
177 174 cvtsd2siq = DOUBLE + INTREG + 10,
178 175
179 176 /* double precision SIMD instructions */
180 177 cmppd = DOUBLE + SIMD + 0,
181 178 minpd = DOUBLE + SIMD + 1,
182 179 maxpd = DOUBLE + SIMD + 2,
183 180 addpd = DOUBLE + SIMD + 3,
184 181 subpd = DOUBLE + SIMD + 4,
185 182 mulpd = DOUBLE + SIMD + 5,
186 183 divpd = DOUBLE + SIMD + 6,
187 184 sqrtpd = DOUBLE + SIMD + 7,
188 185 cvtpd2ps = DOUBLE + SIMD + 32,
189 186 cvtdq2pd = DOUBLE + SIMD + 34,
190 187 cvttpd2dq = DOUBLE + SIMD + 35,
191 188 cvtpd2dq = DOUBLE + SIMD + 36,
192 189 cvtpi2pd = DOUBLE + SIMD + INTREG + 0,
193 190 cvttpd2pi = DOUBLE + SIMD + INTREG + 1,
194 191 cvtpd2pi = DOUBLE + SIMD + INTREG + 2,
195 192 } op;
196 193 int imm;
197 194 sseoperand_t *op1, *op2;
198 195 } sseinst_t;
199 196
200 197 /* x86-specific auxiliary functions */
201 198 extern int *__fex_accrued(void);
↓ open down ↓ |
79 lines elided |
↑ open up ↑ |
202 199 extern void __fex_get_x86_exc(siginfo_t *, ucontext_t *);
203 200 extern int __fex_parse_sse(ucontext_t *, sseinst_t *);
204 201 extern enum fex_exception __fex_get_sse_op(ucontext_t *, sseinst_t *,
205 202 fex_info_t *);
206 203 extern void __fex_get_simd_op(ucontext_t *, sseinst_t *,
207 204 enum fex_exception *, fex_info_t *);
208 205 extern void __fex_st_sse_result(ucontext_t *, sseinst_t *,
209 206 enum fex_exception, fex_info_t *);
210 207 extern void __fex_st_simd_result(ucontext_t *, sseinst_t *,
211 208 enum fex_exception *, fex_info_t *);
212 -
213 209 #else
214 210 #error Unknown architecture
215 211 #endif
216 -
217 212 #endif /* _M9X_FEX_HANDLER_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX