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, this CDDL HEADER in each 14 / file and 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 / Copyright 2011 Nexenta Systems, Inc. All rights reserved. 23 / 24 / Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25 / Use is subject to license terms. 26 / 27 28 / Portions of this file are duplicated as GCC inline assembly in 29 / libm_inlines.h. Keep them in sync. 30 31 .inline __ieee754_sqrt,0 32 sqrtsd %xmm0,%xmm0 33 .end 34 35 .inline __inline_sqrtf,0 36 sqrtss %xmm0,%xmm0 37 .end 38 39 .inline __inline_sqrt,0 40 sqrtsd %xmm0,%xmm0 41 .end 42 43 .inline __inline_fstsw,0 44 fstsw %ax 45 .end 46 47 / 48 / 00 - 24 bits 49 / 01 - reserved 50 / 10 - 53 bits 51 / 11 - 64 bits 52 / 53 .inline __swapRP,0 54 subq $16,%rsp 55 fstcw (%rsp) 56 movw (%rsp),%ax 57 movw %ax,%cx 58 andw $0xfcff,%cx 59 andl $0x3,%edi 60 shlw $8,%di 61 orw %di,%cx 62 movl %ecx,(%rsp) 63 fldcw (%rsp) 64 shrw $8,%ax 65 andq $0x3,%rax 66 addq $16,%rsp 67 .end 68 69 / 70 / 00 - Round to nearest, with even preferred 71 / 01 - Round down 72 / 10 - Round up 73 / 11 - Chop 74 / 75 .inline __swap87RD,0 76 subq $16,%rsp 77 fstcw (%rsp) 78 movw (%rsp),%ax 79 movw %ax,%cx 80 andw $0xf3ff,%cx 81 andl $0x3,%edi 82 shlw $10,%di 83 orw %di,%cx 84 movl %ecx,(%rsp) 85 fldcw (%rsp) 86 shrw $10,%ax 87 andq $0x3,%rax 88 addq $16,%rsp 89 .end 90 91 .inline abs,0 92 cmpl $0,%edi 93 jge 1f 94 negl %edi 95 1: movl %edi,%eax 96 .end 97 98 .inline __copysign,0 99 movq $0x7fffffffffffffff,%rax 100 movdq %rax,%xmm2 101 andpd %xmm2,%xmm0 102 andnpd %xmm1,%xmm2 103 orpd %xmm2,%xmm0 104 .end 105 106 .inline __d_sqrt_,0 107 movlpd (%rdi),%xmm0 108 sqrtsd %xmm0,%xmm0 109 .end 110 111 .inline __fabs,0 112 movq $0x7fffffffffffffff,%rax 113 movdq %rax,%xmm1 114 andpd %xmm1,%xmm0 115 .end 116 117 .inline __fabsf,0 118 movl $0x7fffffff,%eax 119 movdl %eax,%xmm1 120 andps %xmm1,%xmm0 121 .end 122 123 .inline _finite,0 124 subq $16,%rsp 125 movlpd %xmm0,(%rsp) 126 movq (%rsp),%rcx 127 movq $0x7fffffffffffffff,%rax 128 andq %rcx,%rax 129 movq $0x7ff0000000000000,%rcx 130 subq %rcx,%rax 131 shrq $63,%rax 132 addq $16,%rsp 133 .end 134 135 .inline __r_sqrt_,0 136 movss (%rdi),%xmm0 137 sqrtss %xmm0,%xmm0 138 .end 139 140 .inline __signbit,0 141 movmskpd %xmm0,%eax 142 andq $1,%rax 143 .end 144 145 .inline __signbitf,0 146 movmskps %xmm0,%eax 147 andq $1,%rax 148 .end 149 150 .inline __sqrt,0 151 sqrtsd %xmm0,%xmm0 152 .end 153 154 .inline __sqrtf,0 155 sqrtss %xmm0,%xmm0 156 .end 157 158 .inline __f95_signf,0 159 movl (%rdi),%eax 160 movl (%rsi),%ecx 161 andl $0x7fffffff,%eax 162 andl $0x80000000,%ecx 163 orl %ecx,%eax 164 movdl %eax,%xmm0 165 .end 166 167 .inline __f95_sign,0 168 movq (%rsi),%rax 169 movq $0x7fffffffffffffff,%rdx 170 shrq $63,%rax 171 shlq $63,%rax 172 andq (%rdi),%rdx 173 orq %rdx,%rax 174 movdq %rax,%xmm0 175 .end 176 177 .inline __r_sign,0 178 movl $0x7fffffff,%eax 179 movl $0x80000000,%edx 180 andl (%rdi),%eax 181 cmpl (%rsi),%edx 182 cmovel %eax,%edx 183 andl (%rsi),%edx 184 orl %edx,%eax 185 movdl %eax,%xmm0 186 .end 187 188 .inline __d_sign,0 189 movq $0x7fffffffffffffff,%rax 190 movq $0x8000000000000000,%rdx 191 andq (%rdi),%rax 192 cmpq (%rsi),%rdx 193 cmoveq %rax,%rdx 194 andq (%rsi),%rdx 195 orq %rdx,%rax 196 movdq %rax,%xmm0 197 .end