Repository navigation
Expand file tree
/
Copy pathsvml_z0_atanh_h_la.s
More file actions
209 lines (191 loc) · 4.69 KB
/
Copy pathsvml_z0_atanh_h_la.s
File metadata and controls
209 lines (191 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*******************************************
* Copyright (C) 2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*******************************************/
/*
* ALGORITHM DESCRIPTION:
*
* Compute atanh(x) as 0.5 * log((1 + x)/(1 - x))
*
* Special cases:
*
* atanh(0) = 0
* atanh(+1) = +INF
* atanh(-1) = -INF
* atanh(x) = NaN if |x| > 1, or if x is a NaN or INF
*
*/
.file "svml_z0_atanh_h_la.s"
.text
.align 16,0x90
.globl __svml_atanhs32
__svml_atanhs32:
.cfi_startproc
endbr64
kxnord %k7, %k7, %k7
vmovdqu16 __svml_hatanh_data_internal(%rip), %zmm31
vmovdqu16 64+__svml_hatanh_data_internal(%rip), %zmm30
vmovdqu16 128+__svml_hatanh_data_internal(%rip), %zmm29
vmovdqu16 192+__svml_hatanh_data_internal(%rip), %zmm28
vmovdqu16 256+__svml_hatanh_data_internal(%rip), %zmm27
vmovdqu16 320+__svml_hatanh_data_internal(%rip), %zmm26
/* npy_half* in -> %rdi, npy_half* out -> %rsi, size_t N -> %rdx */
.looparray_atanh_h:
cmpq $31, %rdx
ja .loaddata_atanhh
/* set up mask %k7 for masked load instruction */
movl $1, %eax
movl %edx, %ecx
sall %cl, %eax
subl $1, %eax
kmovd %eax, %k7
/* Constant required for masked load */
movl $0, %eax
vpbroadcastw %eax, %zmm0
vmovdqu16 (%rdi), %zmm0{%k7}
jmp .funcbegin_atanh_h
.loaddata_atanhh:
vmovdqu16 (%rdi), %zmm0
addq $64, %rdi
.funcbegin_atanh_h:
/*
* reduced argument: 4*(1-|x|)
* scaling by 4 to get around limited FP16 range for coefficient representation
*/
vmovdqu16 %zmm27, %zmm3
/* prepare special case mask */
vpandd %zmm28, %zmm0, %zmm2
vfnmadd213ph {rn-sae}, %zmm3, %zmm2, %zmm3
/* get table index */
vpsrlw $9, %zmm3, %zmm4
/* Special result */
vrsqrtph %zmm3, %zmm7
vcmpph $18, {sae}, %zmm26, %zmm3, %k1
/* look up poly coefficients: c1, c2, c3 */
vpermw %zmm29, %zmm4, %zmm10
vpermw %zmm30, %zmm4, %zmm5
vpermw %zmm31, %zmm4, %zmm6
/* polynomial */
vfmadd213ph {rn-sae}, %zmm5, %zmm3, %zmm10
vfmadd213ph {rn-sae}, %zmm6, %zmm3, %zmm10
/* x+x*Poly */
vfmadd213ph {rn-sae}, %zmm0, %zmm0, %zmm10
vpandnd %zmm0, %zmm28, %zmm8
vpord %zmm8, %zmm7, %zmm11
vpblendmw %zmm11, %zmm10, %zmm0{%k1}
/* store result to our array and adjust pointers */
vmovdqu16 %zmm0, (%rsi){%k7}
addq $64, %rsi
subq $32, %rdx
cmpq $0, %rdx
jg .looparray_atanh_h
ret
.cfi_endproc
.type __svml_atanhs32,@function
.size __svml_atanhs32,.-__svml_atanhs32
.section .rodata, "a"
.align 64
__svml_hatanh_data_internal:
.word 0x3770
.word 0x35ab
.rept 10
.word 0x0000
.endr
.word 0x439e
.word 0x4345
.word 0x42ed
.word 0x4294
.word 0x423c
.word 0x41e3
.word 0x418a
.word 0x4132
.word 0x40da
.word 0x4081
.word 0x4029
.word 0x3fa2
.word 0x3ef4
.word 0x3e46
.word 0x3d9a
.word 0x3cef
.word 0x3c48
.word 0x3b47
.word 0x3a08
.word 0x38d4
.word 0xb412
.word 0xb1b1
.rept 10
.word 0x0000
.endr
.word 0xde80
.word 0xdc99
.word 0xda7d
.word 0xd896
.word 0xd677
.word 0xd491
.word 0xd26e
.word 0xd088
.word 0xce5d
.word 0xcc79
.word 0xca41
.word 0xc85f
.word 0xc613
.word 0xc437
.word 0xc1cc
.word 0xbff0
.word 0xbd60
.word 0xbb38
.word 0xb8c7
.word 0xb641
.word 0x288f
.word 0x25b7
.rept 10
.word 0x0000
.endr
.word 0x7940
.word 0x754a
.word 0x713f
.word 0x6d49
.word 0x693d
.word 0x6546
.word 0x613a
.word 0x5d42
.word 0x5934
.word 0x553a
.word 0x5129
.word 0x4d2b
.word 0x4915
.word 0x4510
.word 0x40f3
.word 0x3ce4
.word 0x38bd
.word 0x34a5
.word 0x307b
.word 0x2c6f
.rept 32
.word 0x7fff
.endr
.rept 32
.word 0x4400
.endr
.rept 32
.word 0x0000
.endr
.type __svml_hatanh_data_internal,@object
.size __svml_hatanh_data_internal,384
.section ".note.gnu.property", "a"
.p2align 3
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.asciz "GNU"
1:
.p2align 3
.long 0xc0000002
.long 3f - 2f
2:
.long 3
3:
.p2align 3
4:
.section .note.GNU-stack,"",@progbits