Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/amd64/src/__swapFLAGS.s
+++ new/usr/src/lib/libm/amd64/src/__swapFLAGS.s
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 /*
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
22 22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 23 */
24 24 /*
25 25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 */
28 28
29 29 .file "__swapFLAGS.s"
30 30
31 31 #include "libm.h"
32 -#include "libm_synonyms.h"
33 32
34 33 /*
35 34 * swap exception masks
36 35 *
37 36 * Put the complement of bits 5-0 of the argument into FPCW bits 5-0
38 37 * and MXCSR bits 12-7, return the complement of the previous FPCW
39 38 * bits 5-0.
40 39 */
41 40 ENTRY(__swapTE) / di <-- NOT(desired xcptn_masks)
42 41 subq $8,%rsp
43 42 fstcw (%rsp) / push current_cw on '86 stack
44 43 movq (%rsp),%rcx / cx <-- current_cw
45 44 movw %cx,%ax / ax <-- current_cw
46 45 orw $0x3f,%cx / cx <-- current_cw, but masking all xcptns
47 46 andw $0x3f,%di / make sure bits > B5 are all zero
48 47 xorw %di,%cx / cx <-- present_cw, with new xcptn_masks
49 48 movw %cx,(%rsp)
50 49 fldcw (%rsp) / load new cw
51 50 stmxcsr (%rsp)
52 51 movq (%rsp),%rcx
53 52 orw $0x1f80,%cx / cx <-- current mxcsr, but masking all xcptns
54 53 shlw $7,%di
55 54 xorw %di,%cx / cx <-- present mxcsr, with new xcptn_masks
56 55 movq %rcx,(%rsp)
57 56 ldmxcsr (%rsp)
58 57 andq $0x3f,%rax / al[5..0] <-- former xcptn_masks
59 58 xorq $0x3f,%rax / al[5..0] <-- NOT(former xcptn_masks)
60 59 addq $8,%rsp
61 60 ret
62 61 .align 16
63 62 SET_SIZE(__swapTE)
64 63
65 64 /*
66 65 * swap exception flags
67 66 *
68 67 * Put bits 5-0 of the argument into FPSW bits 5-0 and MXCSR bits 5-0,
69 68 * return the "or" of the previous FPSW bits 5-0 and MXCSR bits 5-0.
70 69 */
71 70 ENTRY(__swapEX)
72 71 fstsw %ax / ax = sw
73 72 andq $0x3f,%rdi
74 73 jnz .L1
75 74 / input ex=0, clear all exception
76 75 fnclex
77 76 subq $8,%rsp
78 77 stmxcsr (%rsp)
79 78 movq (%rsp),%rcx
80 79 orw %cx,%ax
81 80 andw $0xffc0,%cx
82 81 movq %rcx,(%rsp)
83 82 ldmxcsr (%rsp)
84 83 andq $0x3f,%rax
85 84 addq $8,%rsp
86 85 ret
87 86 .L1:
88 87 / input ex !=0, use fnstenv and fldenv
89 88 subq $32,%rsp / only needed 28
90 89 fnstenv (%rsp)
91 90 movw %ax,%dx
92 91 andw $0xffc0,%dx
93 92 orw %cx,%dx
94 93 movw %dx,4(%rsp) / replace old sw by new one
95 94 fldenv (%rsp)
96 95 stmxcsr (%rsp)
97 96 movq (%rsp),%rdx
98 97 orw %dx,%ax
99 98 andw $0xffc0,%dx
100 99 orw %cx,%dx
101 100 movq %rdx,(%rsp)
102 101 ldmxcsr (%rsp)
103 102 andq $0x3f,%rax
104 103 addq $32,%rsp
105 104 ret
106 105 .align 16
107 106 SET_SIZE(__swapEX)
108 107
109 108 /*
110 109 * swap rounding precision
111 110 *
112 111 * Put bits 1-0 of the argument into FPCW bits 9-8, return the
113 112 * previous FPCW bits 9-8.
114 113 */
115 114 ENTRY(__swapRP)
116 115 subq $8,%rsp
117 116 fstcw (%rsp)
118 117 movw (%rsp),%ax
119 118 movw %ax,%cx
120 119 andw $0xfcff,%cx
121 120 andq $0x3,%rdi
122 121 shlw $8,%di
123 122 orw %di,%cx
124 123 movq %rcx,(%rsp)
125 124 fldcw (%rsp)
126 125 shrw $8,%ax
127 126 andq $0x3,%rax
128 127 addq $8,%rsp
129 128 ret
130 129 .align 16
131 130 SET_SIZE(__swapRP)
132 131
133 132 /*
134 133 * swap rounding direction
135 134 *
136 135 * Put bits 1-0 of the argument into FPCW bits 11-10 and MXCSR
137 136 * bits 14-13, return the previous FPCW bits 11-10.
138 137 */
139 138 ENTRY(__swapRD)
140 139 subq $8,%rsp
141 140 fstcw (%rsp)
142 141 movw (%rsp),%ax
143 142 movw %ax,%cx
144 143 andw $0xf3ff,%cx
145 144 andq $0x3,%rdi
146 145 shlw $10,%di
147 146 orw %di,%cx
148 147 movq %rcx,(%rsp)
149 148 fldcw (%rsp)
150 149 stmxcsr (%rsp)
151 150 movq (%rsp),%rcx
152 151 andw $0x9fff,%cx
153 152 shlw $3,%di
154 153 orw %di,%cx
155 154 movq %rcx,(%rsp)
156 155 ldmxcsr (%rsp)
157 156 shrw $10,%ax
158 157 andq $0x3,%rax
159 158 addq $8,%rsp
160 159 ret
161 160 .align 16
162 161 SET_SIZE(__swapRD)
↓ open down ↓ |
120 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX