1 /* Function logf vectorized with SSE4.
2 Copyright (C) 2014-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 #include "svml_s_logf_data.h"
23 ENTRY (_ZGVbN4v_logf_sse4)
25 ALGORITHM DESCRIPTION:
27 log(x) = exponent_x*log(2) + log(mantissa_x), if mantissa_x<4/3
28 log(x) = (exponent_x+1)*log(2) + log(0.5*mantissa_x), if mantissa_x>4/3
30 R = mantissa_x - 1, if mantissa_x<4/3
31 R = 0.5*mantissa_x - 1, if mantissa_x>4/3
34 log(1+R) is approximated as a polynomial: degree 9 for 1-ulp,
35 degree 7 for 4-ulp, degree 3 for half-precision. */
38 cfi_adjust_cfa_offset (8)
39 cfi_rel_offset (%rbp, 0)
41 cfi_def_cfa_register (%rbp)
45 /* reduction: compute r,n */
48 /* check for working range,
49 set special argument mask (denormals/zero/Inf/NaN) */
50 movq __svml_slog_data@GOTPCREL(%rip), %rax
51 movdqu _iHiDelta(%rax), %xmm1
52 movdqu _iLoRange(%rax), %xmm4
54 movdqu _iBrkValue(%rax), %xmm3
56 movdqu _iOffExpoMask(%rax), %xmm1
60 /* exponent_x (mantissa_x<4/3) or exponent_x+1 (mantissa_x>4/3) */
63 movups _sPoly_7(%rax), %xmm5
65 /* mantissa_x (mantissa_x<4/3), or 0.5*mantissa_x (mantissa_x>4/3) */
68 /* reduced argument R */
69 subps _sOne(%rax), %xmm1
72 /* final reconstruction:
73 add exponent_value*log2 to polynomial result */
74 mulps _sLn2(%rax), %xmm6
76 /* polynomial evaluation starts here */
78 addps _sPoly_6(%rax), %xmm5
80 addps _sPoly_5(%rax), %xmm5
82 addps _sPoly_4(%rax), %xmm5
84 addps _sPoly_3(%rax), %xmm5
86 addps _sPoly_2(%rax), %xmm5
88 addps _sPoly_1(%rax), %xmm5
91 /* polynomial evaluation end */
102 cfi_def_cfa_register (%rsp)
104 cfi_adjust_cfa_offset (-8)
110 movups %xmm0, 192(%rsp)
111 movups %xmm1, 256(%rsp)
116 movups %xmm8, 112(%rsp)
117 movups %xmm9, 96(%rsp)
118 movups %xmm10, 80(%rsp)
119 movups %xmm11, 64(%rsp)
120 movups %xmm12, 48(%rsp)
121 movups %xmm13, 32(%rsp)
122 movups %xmm14, 16(%rsp)
123 movups %xmm15, (%rsp)
127 cfi_offset_rel_rsp (12, 168)
130 cfi_offset_rel_rsp (13, 160)
133 cfi_offset_rel_rsp (14, 152)
136 cfi_offset_rel_rsp (15, 144)
154 movups 112(%rsp), %xmm8
155 movups 96(%rsp), %xmm9
156 movups 80(%rsp), %xmm10
157 movups 64(%rsp), %xmm11
158 movups 48(%rsp), %xmm12
159 movups 32(%rsp), %xmm13
160 movups 16(%rsp), %xmm14
161 movups (%rsp), %xmm15
172 movups 256(%rsp), %xmm1
178 movss 196(%rsp,%r15,8), %xmm0
180 call JUMPTARGET(__logf_finite)
182 movss %xmm0, 260(%rsp,%r15,8)
187 movss 192(%rsp,%r15,8), %xmm0
189 call JUMPTARGET(__logf_finite)
191 movss %xmm0, 256(%rsp,%r15,8)
194 END (_ZGVbN4v_logf_sse4)