[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / libc / AOR_v20.02 / math / test / runulp.sh
blob9e93674727a79c23c4da9783585818d66f8e6849
1 #!/bin/bash
3 # ULP error check script.
5 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 # See https://llvm.org/LICENSE.txt for license information.
7 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 #set -x
10 set -eu
12 # cd to bin directory.
13 cd "${0%/*}"
15 rmodes='n u d z'
16 #rmodes=n
17 flags="${ULPFLAGS:--q}"
18 emu="$@"
20 FAIL=0
21 PASS=0
23 t() {
24 [ $r = "n" ] && Lt=$L || Lt=$Ldir
25 $emu ./ulp -r $r -e $Lt $flags "$@" && PASS=$((PASS+1)) || FAIL=$((FAIL+1))
28 check() {
29 $emu ./ulp -f -q "$@" >/dev/null
32 Ldir=0.5
33 for r in $rmodes
35 L=0.01
36 t exp 0 0xffff000000000000 10000
37 t exp 0x1p-6 0x1p6 40000
38 t exp -0x1p-6 -0x1p6 40000
39 t exp 633.3 733.3 10000
40 t exp -633.3 -777.3 10000
42 L=0.01
43 t exp2 0 0xffff000000000000 10000
44 t exp2 0x1p-6 0x1p6 40000
45 t exp2 -0x1p-6 -0x1p6 40000
46 t exp2 633.3 733.3 10000
47 t exp2 -633.3 -777.3 10000
49 L=0.02
50 t log 0 0xffff000000000000 10000
51 t log 0x1p-4 0x1p4 40000
52 t log 0 inf 40000
54 L=0.05
55 t log2 0 0xffff000000000000 10000
56 t log2 0x1p-4 0x1p4 40000
57 t log2 0 inf 40000
59 L=0.05
60 t pow 0.5 2.0 x 0 inf 20000
61 t pow -0.5 -2.0 x 0 inf 20000
62 t pow 0.5 2.0 x -0 -inf 20000
63 t pow -0.5 -2.0 x -0 -inf 20000
64 t pow 0.5 2.0 x 0x1p-10 0x1p10 40000
65 t pow 0.5 2.0 x -0x1p-10 -0x1p10 40000
66 t pow 0 inf x 0.5 2.0 80000
67 t pow 0 inf x -0.5 -2.0 80000
68 t pow 0x1.fp-1 0x1.08p0 x 0x1p8 0x1p17 80000
69 t pow 0x1.fp-1 0x1.08p0 x -0x1p8 -0x1p17 80000
70 t pow 0 0x1p-1000 x 0 1.0 50000
71 t pow 0x1p1000 inf x 0 1.0 50000
72 t pow 0x1.ffffffffffff0p-1 0x1.0000000000008p0 x 0x1p60 0x1p68 50000
73 t pow 0x1.ffffffffff000p-1 0x1p0 x 0x1p50 0x1p52 50000
74 t pow -0x1.ffffffffff000p-1 -0x1p0 x 0x1p50 0x1p52 50000
76 L=0.01
77 t expf 0 0xffff0000 10000
78 t expf 0x1p-14 0x1p8 50000
79 t expf -0x1p-14 -0x1p8 50000
81 L=0.01
82 t exp2f 0 0xffff0000 10000
83 t exp2f 0x1p-14 0x1p8 50000
84 t exp2f -0x1p-14 -0x1p8 50000
86 L=0.32
87 t logf 0 0xffff0000 10000
88 t logf 0x1p-4 0x1p4 50000
89 t logf 0 inf 50000
91 L=0.26
92 t log2f 0 0xffff0000 10000
93 t log2f 0x1p-4 0x1p4 50000
94 t log2f 0 inf 50000
96 #L=0.06
97 #t sinf 0 0xffff0000 10000
98 #t sinf 0x1p-14 0x1p54 50000
99 #t sinf -0x1p-14 -0x1p54 50000
101 #L=0.06
102 #t cosf 0 0xffff0000 10000
103 #t cosf 0x1p-14 0x1p54 50000
104 #t cosf -0x1p-14 -0x1p54 50000
106 #L=0.06
107 #t sincosf_sinf 0 0xffff0000 10000
108 #t sincosf_sinf 0x1p-14 0x1p54 50000
109 #t sincosf_sinf -0x1p-14 -0x1p54 50000
111 #L=0.06
112 #t sincosf_cosf 0 0xffff0000 10000
113 #t sincosf_cosf 0x1p-14 0x1p54 50000
114 #t sincosf_cosf -0x1p-14 -0x1p54 50000
116 L=0.4
117 t powf 0x1p-1 0x1p1 x 0x1p-7 0x1p7 50000
118 t powf 0x1p-1 0x1p1 x -0x1p-7 -0x1p7 50000
119 t powf 0x1p-70 0x1p70 x 0x1p-1 0x1p1 50000
120 t powf 0x1p-70 0x1p70 x -0x1p-1 -0x1p1 50000
121 t powf 0x1.ep-1 0x1.1p0 x 0x1p8 0x1p14 50000
122 t powf 0x1.ep-1 0x1.1p0 x -0x1p8 -0x1p14 50000
123 done
125 # vector functions
126 Ldir=0.5
127 r='n'
128 flags="${ULPFLAGS:--q} -f"
129 runs=
130 check __s_exp 1 && runs=1
131 runv=
132 check __v_exp 1 && runv=1
133 runvn=
134 check __vn_exp 1 && runvn=1
136 range_exp='
137 0 0xffff000000000000 10000
138 0x1p-6 0x1p6 400000
139 -0x1p-6 -0x1p6 400000
140 633.3 733.3 10000
141 -633.3 -777.3 10000
144 range_log='
145 0 0xffff000000000000 10000
146 0x1p-4 0x1p4 400000
147 0 inf 400000
150 range_pow='
151 0x1p-1 0x1p1 x 0x1p-10 0x1p10 50000
152 0x1p-1 0x1p1 x -0x1p-10 -0x1p10 50000
153 0x1p-500 0x1p500 x 0x1p-1 0x1p1 50000
154 0x1p-500 0x1p500 x -0x1p-1 -0x1p1 50000
155 0x1.ep-1 0x1.1p0 x 0x1p8 0x1p16 50000
156 0x1.ep-1 0x1.1p0 x -0x1p8 -0x1p16 50000
159 range_sin='
160 0 0xffff000000000000 10000
161 0x1p-4 0x1p4 400000
162 -0x1p-23 0x1p23 400000
164 range_cos="$range_sin"
166 range_expf='
167 0 0xffff0000 10000
168 0x1p-14 0x1p8 500000
169 -0x1p-14 -0x1p8 500000
172 range_expf_1u="$range_expf"
173 range_exp2f="$range_expf"
174 range_exp2f_1u="$range_expf"
176 range_logf='
177 0 0xffff0000 10000
178 0x1p-4 0x1p4 500000
181 range_sinf='
182 0 0xffff0000 10000
183 0x1p-4 0x1p4 300000
184 -0x1p-9 -0x1p9 300000
186 range_cosf="$range_sinf"
188 range_powf='
189 0x1p-1 0x1p1 x 0x1p-7 0x1p7 50000
190 0x1p-1 0x1p1 x -0x1p-7 -0x1p7 50000
191 0x1p-70 0x1p70 x 0x1p-1 0x1p1 50000
192 0x1p-70 0x1p70 x -0x1p-1 -0x1p1 50000
193 0x1.ep-1 0x1.1p0 x 0x1p8 0x1p14 50000
194 0x1.ep-1 0x1.1p0 x -0x1p8 -0x1p14 50000
197 # error limits
198 L_exp=1.9
199 L_log=1.2
200 L_pow=0.05
201 L_sin=3.0
202 L_cos=3.0
203 L_expf=1.49
204 L_expf_1u=0.4
205 L_exp2f=1.49
206 L_exp2f_1u=0.4
207 L_logf=2.9
208 L_sinf=1.4
209 L_cosf=1.4
210 L_powf=2.1
212 while read G F R
214 [ "$R" = 1 ] || continue
215 case "$G" in \#*) continue ;; esac
216 eval range="\${range_$G}"
217 eval L="\${L_$G}"
218 while read X
220 [ -n "$X" ] || continue
221 case "$X" in \#*) continue ;; esac
222 t $F $X
223 done << EOF
224 $range
226 done << EOF
227 # group symbol run
228 exp __s_exp $runs
229 exp __v_exp $runv
230 exp __vn_exp $runvn
231 exp _ZGVnN2v_exp $runvn
233 log __s_log $runs
234 log __v_log $runv
235 log __vn_log $runvn
236 log _ZGVnN2v_log $runvn
238 pow __s_pow $runs
239 pow __v_pow $runv
240 pow __vn_pow $runvn
241 pow _ZGVnN2vv_pow $runvn
243 sin __s_sin $runs
244 sin __v_sin $runv
245 sin __vn_sin $runvn
246 sin _ZGVnN2v_sin $runvn
248 cos __s_cos $runs
249 cos __v_cos $runv
250 cos __vn_cos $runvn
251 cos _ZGVnN2v_cos $runvn
253 expf __s_expf $runs
254 expf __v_expf $runv
255 expf __vn_expf $runvn
256 expf _ZGVnN4v_expf $runvn
258 expf_1u __s_expf_1u $runs
259 expf_1u __v_expf_1u $runv
260 expf_1u __vn_expf_1u $runvn
262 exp2f __s_exp2f $runs
263 exp2f __v_exp2f $runv
264 exp2f __vn_exp2f $runvn
265 exp2f _ZGVnN4v_exp2f $runvn
267 exp2f_1u __s_exp2f_1u $runs
268 exp2f_1u __v_exp2f_1u $runv
269 exp2f_1u __vn_exp2f_1u $runvn
271 logf __s_logf $runs
272 logf __v_logf $runv
273 logf __vn_logf $runvn
274 logf _ZGVnN4v_logf $runvn
276 sinf __s_sinf $runs
277 sinf __v_sinf $runv
278 sinf __vn_sinf $runvn
279 sinf _ZGVnN4v_sinf $runvn
281 cosf __s_cosf $runs
282 cosf __v_cosf $runv
283 cosf __vn_cosf $runvn
284 cosf _ZGVnN4v_cosf $runvn
286 powf __s_powf $runs
287 powf __v_powf $runv
288 powf __vn_powf $runvn
289 powf _ZGVnN4vv_powf $runvn
292 [ 0 -eq $FAIL ] || {
293 echo "FAILED $FAIL PASSED $PASS"
294 exit 1