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
12 # cd to bin directory.
17 flags
="${ULPFLAGS:--q}"
24 [ $r = "n" ] && Lt
=$L || Lt
=$Ldir
25 $emu .
/ulp
-r $r -e $Lt $flags "$@" && PASS
=$
((PASS
+1)) || FAIL
=$
((FAIL
+1))
29 $emu .
/ulp
-f -q "$@" >/dev
/null
36 t exp
0 0xffff000000000000 10000
37 t exp
0x1p
-6 0x1p
6 40000
38 t exp
-0x1p-6 -0x1p6 40000
39 t exp
633.3 733.3 10000
40 t exp
-633.3
-777.3
10000
43 t exp2
0 0xffff000000000000 10000
44 t exp2
0x1p
-6 0x1p
6 40000
45 t exp2
-0x1p-6 -0x1p6 40000
46 t exp2
633.3 733.3 10000
47 t exp2
-633.3
-777.3
10000
50 t log
0 0xffff000000000000 10000
51 t log
0x1p
-4 0x1p
4 40000
55 t log2
0 0xffff000000000000 10000
56 t log2
0x1p
-4 0x1p
4 40000
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 0x1p
10 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
0x1p
8 0x1p
17 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
0x1p
1000 inf x
0 1.0 50000
72 t pow
0x1.ffffffffffff0p-1
0x1.0000000000008p0 x
0x1p
60 0x1p
68 50000
73 t pow
0x1.ffffffffff000p-1
0x1p
0 x
0x1p
50 0x1p
52 50000
74 t pow
-0x1.ffffffffff000p-1
-0x1p0 x
0x1p
50 0x1p
52 50000
77 t expf
0 0xffff0000 10000
78 t expf
0x1p
-14 0x1p
8 50000
79 t expf
-0x1p-14 -0x1p8 50000
82 t exp2f
0 0xffff0000 10000
83 t exp2f
0x1p
-14 0x1p
8 50000
84 t exp2f
-0x1p-14 -0x1p8 50000
87 t logf
0 0xffff0000 10000
88 t logf
0x1p
-4 0x1p
4 50000
92 t log2f
0 0xffff0000 10000
93 t log2f
0x1p
-4 0x1p
4 50000
97 #t sinf 0 0xffff0000 10000
98 #t sinf 0x1p-14 0x1p54 50000
99 #t sinf -0x1p-14 -0x1p54 50000
102 #t cosf 0 0xffff0000 10000
103 #t cosf 0x1p-14 0x1p54 50000
104 #t cosf -0x1p-14 -0x1p54 50000
107 #t sincosf_sinf 0 0xffff0000 10000
108 #t sincosf_sinf 0x1p-14 0x1p54 50000
109 #t sincosf_sinf -0x1p-14 -0x1p54 50000
112 #t sincosf_cosf 0 0xffff0000 10000
113 #t sincosf_cosf 0x1p-14 0x1p54 50000
114 #t sincosf_cosf -0x1p-14 -0x1p54 50000
117 t powf
0x1p
-1 0x1p
1 x
0x1p
-7 0x1p
7 50000
118 t powf
0x1p
-1 0x1p
1 x
-0x1p-7 -0x1p7 50000
119 t powf
0x1p
-70 0x1p
70 x
0x1p
-1 0x1p
1 50000
120 t powf
0x1p
-70 0x1p
70 x
-0x1p-1 -0x1p1 50000
121 t powf
0x1.ep-1
0x1.1p0 x
0x1p
8 0x1p
14 50000
122 t powf
0x1.ep-1
0x1.1p0 x
-0x1p8 -0x1p14 50000
128 flags
="${ULPFLAGS:--q} -f"
130 check __s_exp
1 && runs
=1
132 check __v_exp
1 && runv
=1
134 check __vn_exp
1 && runvn
=1
137 0 0xffff000000000000 10000
139 -0x1p-6 -0x1p6 400000
145 0 0xffff000000000000 10000
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
160 0 0xffff000000000000 10000
162 -0x1p-23 0x1p23 400000
164 range_cos
="$range_sin"
169 -0x1p-14 -0x1p8 500000
172 range_expf_1u
="$range_expf"
173 range_exp2f
="$range_expf"
174 range_exp2f_1u
="$range_expf"
184 -0x1p-9 -0x1p9 300000
186 range_cosf
="$range_sinf"
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
214 [ "$R" = 1 ] ||
continue
215 case "$G" in \
#*) continue ;; esac
216 eval range
="\${range_$G}"
220 [ -n "$X" ] ||
continue
221 case "$X" in \
#*) continue ;; esac
231 exp _ZGVnN2v_exp $runvn
236 log _ZGVnN2v_log $runvn
241 pow _ZGVnN2vv_pow $runvn
246 sin _ZGVnN2v_sin $runvn
251 cos _ZGVnN2v_cos $runvn
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
273 logf __vn_logf $runvn
274 logf _ZGVnN4v_logf $runvn
278 sinf __vn_sinf $runvn
279 sinf _ZGVnN4v_sinf $runvn
283 cosf __vn_cosf $runvn
284 cosf _ZGVnN4v_cosf $runvn
288 powf __vn_powf $runvn
289 powf _ZGVnN4vv_powf $runvn
293 echo "FAILED $FAIL PASSED $PASS"