| 1 |
# This file is licensed under the Apache License v2.0 with LLVM Exceptions. |
| 2 |
# See https://llvm.org/LICENSE.txt for license information. |
| 3 |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 |
|
| 5 |
# Tests for LLVM libc math.h functions. |
| 6 |
|
| 7 |
load("//libc/test/src/math:libc_math_test_rules.bzl", "math_mpfr_test") |
| 8 |
|
| 9 |
package(default_visibility = ["//visibility:public"]) |
| 10 |
|
| 11 |
exports_files(["libc_math_test_rules.bzl"]) |
| 12 |
|
| 13 |
licenses(["notice"]) |
| 14 |
|
| 15 |
math_mpfr_test(name = "acosf") |
| 16 |
|
| 17 |
math_mpfr_test(name = "acoshf") |
| 18 |
|
| 19 |
math_mpfr_test(name = "asinf") |
| 20 |
|
| 21 |
math_mpfr_test(name = "asinhf") |
| 22 |
|
| 23 |
math_mpfr_test(name = "atan2") |
| 24 |
|
| 25 |
math_mpfr_test(name = "atan2f") |
| 26 |
|
| 27 |
math_mpfr_test(name = "atan") |
| 28 |
|
| 29 |
math_mpfr_test(name = "atanf") |
| 30 |
|
| 31 |
math_mpfr_test(name = "atanhf") |
| 32 |
|
| 33 |
math_mpfr_test(name = "cbrt") |
| 34 |
|
| 35 |
math_mpfr_test(name = "cbrtf") |
| 36 |
|
| 37 |
math_mpfr_test( |
| 38 |
name = "ceil", |
| 39 |
hdrs = ["CeilTest.h"], |
| 40 |
) |
| 41 |
|
| 42 |
math_mpfr_test( |
| 43 |
name = "ceilf", |
| 44 |
hdrs = ["CeilTest.h"], |
| 45 |
) |
| 46 |
|
| 47 |
math_mpfr_test( |
| 48 |
name = "ceill", |
| 49 |
hdrs = ["CeilTest.h"], |
| 50 |
) |
| 51 |
|
| 52 |
math_mpfr_test( |
| 53 |
name = "ceilf16", |
| 54 |
hdrs = ["CeilTest.h"], |
| 55 |
) |
| 56 |
|
| 57 |
math_mpfr_test(name = "cos") |
| 58 |
|
| 59 |
math_mpfr_test( |
| 60 |
name = "cosf", |
| 61 |
hdrs = ["sdcomp26094.h"], |
| 62 |
deps = [ |
| 63 |
"//libc:__support_cpp_array", |
| 64 |
], |
| 65 |
) |
| 66 |
|
| 67 |
math_mpfr_test( |
| 68 |
name = "coshf", |
| 69 |
deps = [ |
| 70 |
"//libc:__support_cpp_array", |
| 71 |
], |
| 72 |
) |
| 73 |
|
| 74 |
math_mpfr_test( |
| 75 |
name = "cospif", |
| 76 |
hdrs = ["sdcomp26094.h"], |
| 77 |
deps = [ |
| 78 |
"//libc:__support_cpp_array", |
| 79 |
], |
| 80 |
) |
| 81 |
|
| 82 |
math_mpfr_test( |
| 83 |
name = "daddl", |
| 84 |
hdrs = ["AddTest.h"], |
| 85 |
) |
| 86 |
|
| 87 |
math_mpfr_test( |
| 88 |
name = "ddivl", |
| 89 |
hdrs = ["DivTest.h"], |
| 90 |
) |
| 91 |
|
| 92 |
# TODO: Add dfmal, dmull test. Missing stdlib/rand dependency. |
| 93 |
|
| 94 |
math_mpfr_test( |
| 95 |
name = "dsqrtl", |
| 96 |
hdrs = ["SqrtTest.h"], |
| 97 |
) |
| 98 |
|
| 99 |
math_mpfr_test( |
| 100 |
name = "dsubl", |
| 101 |
hdrs = ["SubTest.h"], |
| 102 |
) |
| 103 |
|
| 104 |
math_mpfr_test(name = "erff") |
| 105 |
|
| 106 |
math_mpfr_test(name = "exp") |
| 107 |
|
| 108 |
math_mpfr_test(name = "expf") |
| 109 |
|
| 110 |
math_mpfr_test(name = "exp10") |
| 111 |
|
| 112 |
math_mpfr_test(name = "exp10f") |
| 113 |
|
| 114 |
math_mpfr_test(name = "exp2") |
| 115 |
|
| 116 |
math_mpfr_test(name = "exp2f") |
| 117 |
|
| 118 |
math_mpfr_test( |
| 119 |
name = "exp2m1f", |
| 120 |
deps = [ |
| 121 |
"//libc:__support_cpp_array", |
| 122 |
], |
| 123 |
) |
| 124 |
|
| 125 |
math_mpfr_test(name = "expm1") |
| 126 |
|
| 127 |
math_mpfr_test(name = "expm1f") |
| 128 |
|
| 129 |
math_mpfr_test( |
| 130 |
name = "fabs", |
| 131 |
hdrs = ["FAbsTest.h"], |
| 132 |
) |
| 133 |
|
| 134 |
math_mpfr_test( |
| 135 |
name = "fabsf", |
| 136 |
hdrs = ["FAbsTest.h"], |
| 137 |
) |
| 138 |
|
| 139 |
math_mpfr_test( |
| 140 |
name = "fabsl", |
| 141 |
hdrs = ["FAbsTest.h"], |
| 142 |
) |
| 143 |
|
| 144 |
math_mpfr_test( |
| 145 |
name = "fadd", |
| 146 |
hdrs = ["AddTest.h"], |
| 147 |
) |
| 148 |
|
| 149 |
math_mpfr_test( |
| 150 |
name = "faddl", |
| 151 |
hdrs = ["AddTest.h"], |
| 152 |
) |
| 153 |
|
| 154 |
math_mpfr_test( |
| 155 |
name = "f16add", |
| 156 |
hdrs = ["AddTest.h"], |
| 157 |
) |
| 158 |
|
| 159 |
math_mpfr_test( |
| 160 |
name = "f16addf", |
| 161 |
hdrs = ["AddTest.h"], |
| 162 |
) |
| 163 |
|
| 164 |
math_mpfr_test( |
| 165 |
name = "f16addl", |
| 166 |
hdrs = ["AddTest.h"], |
| 167 |
) |
| 168 |
|
| 169 |
math_mpfr_test( |
| 170 |
name = "fdiv", |
| 171 |
hdrs = ["DivTest.h"], |
| 172 |
) |
| 173 |
|
| 174 |
math_mpfr_test( |
| 175 |
name = "fdivl", |
| 176 |
hdrs = ["DivTest.h"], |
| 177 |
) |
| 178 |
|
| 179 |
math_mpfr_test( |
| 180 |
name = "f16div", |
| 181 |
hdrs = ["DivTest.h"], |
| 182 |
) |
| 183 |
|
| 184 |
math_mpfr_test( |
| 185 |
name = "f16divf", |
| 186 |
hdrs = ["DivTest.h"], |
| 187 |
) |
| 188 |
|
| 189 |
math_mpfr_test( |
| 190 |
name = "f16divl", |
| 191 |
hdrs = ["DivTest.h"], |
| 192 |
) |
| 193 |
|
| 194 |
# TODO: Add ffma, ffmal test. Missing stdlib/rand dependency. |
| 195 |
|
| 196 |
math_mpfr_test( |
| 197 |
name = "floor", |
| 198 |
hdrs = ["FloorTest.h"], |
| 199 |
) |
| 200 |
|
| 201 |
math_mpfr_test( |
| 202 |
name = "floorf", |
| 203 |
hdrs = ["FloorTest.h"], |
| 204 |
) |
| 205 |
|
| 206 |
math_mpfr_test( |
| 207 |
name = "floorl", |
| 208 |
hdrs = ["FloorTest.h"], |
| 209 |
) |
| 210 |
|
| 211 |
math_mpfr_test( |
| 212 |
name = "floorf16", |
| 213 |
hdrs = ["FloorTest.h"], |
| 214 |
) |
| 215 |
|
| 216 |
# TODO: Add fma, fmaf, fmal, fmul, fmull tests. Missing stdlib/rand dependency. |
| 217 |
|
| 218 |
# math_mpfr_test(name = "f16mul") |
| 219 |
# math_mpfr_test(name = "f16mulf") |
| 220 |
# math_mpfr_test(name = "f16mull") |
| 221 |
|
| 222 |
# math_mpfr_test(name = "f16fma") |
| 223 |
# math_mpfr_test(name = "f16fmaf") |
| 224 |
# math_mpfr_test(name = "f16fmal") |
| 225 |
|
| 226 |
math_mpfr_test( |
| 227 |
name = "frexp", |
| 228 |
hdrs = ["FrexpTest.h"], |
| 229 |
) |
| 230 |
|
| 231 |
math_mpfr_test( |
| 232 |
name = "frexpf", |
| 233 |
hdrs = ["FrexpTest.h"], |
| 234 |
) |
| 235 |
|
| 236 |
math_mpfr_test( |
| 237 |
name = "frexpl", |
| 238 |
hdrs = ["FrexpTest.h"], |
| 239 |
) |
| 240 |
|
| 241 |
math_mpfr_test( |
| 242 |
name = "fsqrt", |
| 243 |
hdrs = ["SqrtTest.h"], |
| 244 |
) |
| 245 |
|
| 246 |
math_mpfr_test( |
| 247 |
name = "fsqrtl", |
| 248 |
hdrs = ["SqrtTest.h"], |
| 249 |
) |
| 250 |
|
| 251 |
math_mpfr_test( |
| 252 |
name = "fsub", |
| 253 |
hdrs = ["SubTest.h"], |
| 254 |
) |
| 255 |
|
| 256 |
math_mpfr_test( |
| 257 |
name = "fsubl", |
| 258 |
hdrs = ["SubTest.h"], |
| 259 |
) |
| 260 |
|
| 261 |
math_mpfr_test( |
| 262 |
name = "f16sub", |
| 263 |
hdrs = ["SubTest.h"], |
| 264 |
) |
| 265 |
|
| 266 |
math_mpfr_test( |
| 267 |
name = "f16subf", |
| 268 |
hdrs = ["SubTest.h"], |
| 269 |
) |
| 270 |
|
| 271 |
math_mpfr_test( |
| 272 |
name = "f16subl", |
| 273 |
hdrs = ["SubTest.h"], |
| 274 |
) |
| 275 |
|
| 276 |
math_mpfr_test( |
| 277 |
name = "hypot", |
| 278 |
hdrs = ["HypotTest.h"], |
| 279 |
) |
| 280 |
|
| 281 |
math_mpfr_test( |
| 282 |
name = "hypotf", |
| 283 |
hdrs = [ |
| 284 |
"HypotTest.h", |
| 285 |
"hypotf_hard_to_round.h", |
| 286 |
], |
| 287 |
) |
| 288 |
|
| 289 |
math_mpfr_test( |
| 290 |
name = "llrint", |
| 291 |
hdrs = ["RoundToIntegerTest.h"], |
| 292 |
) |
| 293 |
|
| 294 |
math_mpfr_test( |
| 295 |
name = "llrintf", |
| 296 |
hdrs = ["RoundToIntegerTest.h"], |
| 297 |
) |
| 298 |
|
| 299 |
math_mpfr_test( |
| 300 |
name = "llrintl", |
| 301 |
hdrs = ["RoundToIntegerTest.h"], |
| 302 |
) |
| 303 |
|
| 304 |
math_mpfr_test( |
| 305 |
name = "llrintf16", |
| 306 |
hdrs = ["RoundToIntegerTest.h"], |
| 307 |
) |
| 308 |
|
| 309 |
math_mpfr_test( |
| 310 |
name = "llround", |
| 311 |
hdrs = ["RoundToIntegerTest.h"], |
| 312 |
) |
| 313 |
|
| 314 |
math_mpfr_test( |
| 315 |
name = "llroundf", |
| 316 |
hdrs = ["RoundToIntegerTest.h"], |
| 317 |
) |
| 318 |
|
| 319 |
math_mpfr_test( |
| 320 |
name = "llroundl", |
| 321 |
hdrs = ["RoundToIntegerTest.h"], |
| 322 |
) |
| 323 |
|
| 324 |
math_mpfr_test( |
| 325 |
name = "lroundf16", |
| 326 |
hdrs = ["RoundToIntegerTest.h"], |
| 327 |
) |
| 328 |
|
| 329 |
math_mpfr_test( |
| 330 |
name = "llroundf16", |
| 331 |
hdrs = ["RoundToIntegerTest.h"], |
| 332 |
) |
| 333 |
|
| 334 |
math_mpfr_test(name = "log") |
| 335 |
|
| 336 |
math_mpfr_test(name = "logf") |
| 337 |
|
| 338 |
math_mpfr_test(name = "log10") |
| 339 |
|
| 340 |
math_mpfr_test(name = "log10f") |
| 341 |
|
| 342 |
math_mpfr_test(name = "log1p") |
| 343 |
|
| 344 |
math_mpfr_test(name = "log1pf") |
| 345 |
|
| 346 |
math_mpfr_test(name = "log2") |
| 347 |
|
| 348 |
math_mpfr_test(name = "log2f") |
| 349 |
|
| 350 |
math_mpfr_test( |
| 351 |
name = "lrint", |
| 352 |
hdrs = ["RoundToIntegerTest.h"], |
| 353 |
) |
| 354 |
|
| 355 |
math_mpfr_test( |
| 356 |
name = "lrintf", |
| 357 |
hdrs = ["RoundToIntegerTest.h"], |
| 358 |
) |
| 359 |
|
| 360 |
math_mpfr_test( |
| 361 |
name = "lrintl", |
| 362 |
hdrs = ["RoundToIntegerTest.h"], |
| 363 |
) |
| 364 |
|
| 365 |
math_mpfr_test( |
| 366 |
name = "lrintf16", |
| 367 |
hdrs = ["RoundToIntegerTest.h"], |
| 368 |
) |
| 369 |
|
| 370 |
math_mpfr_test( |
| 371 |
name = "lround", |
| 372 |
hdrs = ["RoundToIntegerTest.h"], |
| 373 |
) |
| 374 |
|
| 375 |
math_mpfr_test( |
| 376 |
name = "lroundf", |
| 377 |
hdrs = ["RoundToIntegerTest.h"], |
| 378 |
) |
| 379 |
|
| 380 |
math_mpfr_test( |
| 381 |
name = "lroundl", |
| 382 |
hdrs = ["RoundToIntegerTest.h"], |
| 383 |
) |
| 384 |
|
| 385 |
# TODO: add nan tests. |
| 386 |
|
| 387 |
math_mpfr_test( |
| 388 |
name = "nearbyint", |
| 389 |
hdrs = ["NearbyIntTest.h"], |
| 390 |
deps = [ |
| 391 |
"//libc:__support_cpp_array", |
| 392 |
], |
| 393 |
) |
| 394 |
|
| 395 |
math_mpfr_test( |
| 396 |
name = "nearbyintf", |
| 397 |
hdrs = ["NearbyIntTest.h"], |
| 398 |
deps = [ |
| 399 |
"//libc:__support_cpp_array", |
| 400 |
], |
| 401 |
) |
| 402 |
|
| 403 |
math_mpfr_test( |
| 404 |
name = "nearbyintl", |
| 405 |
hdrs = ["NearbyIntTest.h"], |
| 406 |
deps = [ |
| 407 |
"//libc:__support_cpp_array", |
| 408 |
], |
| 409 |
) |
| 410 |
|
| 411 |
math_mpfr_test( |
| 412 |
name = "nearbyintf16", |
| 413 |
hdrs = ["NearbyIntTest.h"], |
| 414 |
deps = [ |
| 415 |
"//libc:__support_cpp_array", |
| 416 |
], |
| 417 |
) |
| 418 |
|
| 419 |
math_mpfr_test(name = "pow") |
| 420 |
|
| 421 |
math_mpfr_test(name = "powf") |
| 422 |
|
| 423 |
math_mpfr_test( |
| 424 |
name = "remquo", |
| 425 |
hdrs = ["RemQuoTest.h"], |
| 426 |
) |
| 427 |
|
| 428 |
math_mpfr_test( |
| 429 |
name = "remquof", |
| 430 |
hdrs = ["RemQuoTest.h"], |
| 431 |
) |
| 432 |
|
| 433 |
math_mpfr_test( |
| 434 |
name = "remquol", |
| 435 |
hdrs = ["RemQuoTest.h"], |
| 436 |
) |
| 437 |
|
| 438 |
math_mpfr_test( |
| 439 |
name = "rint", |
| 440 |
hdrs = ["RIntTest.h"], |
| 441 |
) |
| 442 |
|
| 443 |
math_mpfr_test( |
| 444 |
name = "rintf", |
| 445 |
hdrs = ["RIntTest.h"], |
| 446 |
) |
| 447 |
|
| 448 |
math_mpfr_test( |
| 449 |
name = "rintl", |
| 450 |
hdrs = ["RIntTest.h"], |
| 451 |
) |
| 452 |
|
| 453 |
math_mpfr_test( |
| 454 |
name = "rintf16", |
| 455 |
hdrs = ["RIntTest.h"], |
| 456 |
) |
| 457 |
|
| 458 |
math_mpfr_test( |
| 459 |
name = "roundeven", |
| 460 |
hdrs = ["RoundEvenTest.h"], |
| 461 |
) |
| 462 |
|
| 463 |
math_mpfr_test( |
| 464 |
name = "roundevenf", |
| 465 |
hdrs = ["RoundEvenTest.h"], |
| 466 |
) |
| 467 |
|
| 468 |
math_mpfr_test( |
| 469 |
name = "roundevenl", |
| 470 |
hdrs = ["RoundEvenTest.h"], |
| 471 |
) |
| 472 |
|
| 473 |
math_mpfr_test( |
| 474 |
name = "roundevenf16", |
| 475 |
hdrs = ["RoundEvenTest.h"], |
| 476 |
) |
| 477 |
|
| 478 |
math_mpfr_test( |
| 479 |
name = "round", |
| 480 |
hdrs = ["RoundTest.h"], |
| 481 |
) |
| 482 |
|
| 483 |
math_mpfr_test( |
| 484 |
name = "roundf", |
| 485 |
hdrs = ["RoundTest.h"], |
| 486 |
) |
| 487 |
|
| 488 |
math_mpfr_test( |
| 489 |
name = "roundl", |
| 490 |
hdrs = ["RoundTest.h"], |
| 491 |
) |
| 492 |
|
| 493 |
math_mpfr_test( |
| 494 |
name = "roundf16", |
| 495 |
hdrs = ["RoundTest.h"], |
| 496 |
) |
| 497 |
|
| 498 |
math_mpfr_test(name = "sin") |
| 499 |
|
| 500 |
math_mpfr_test( |
| 501 |
name = "sinf", |
| 502 |
hdrs = ["sdcomp26094.h"], |
| 503 |
deps = [ |
| 504 |
"//libc:__support_cpp_array", |
| 505 |
], |
| 506 |
) |
| 507 |
|
| 508 |
math_mpfr_test(name = "sincos") |
| 509 |
|
| 510 |
math_mpfr_test( |
| 511 |
name = "sincosf", |
| 512 |
hdrs = ["sdcomp26094.h"], |
| 513 |
deps = [ |
| 514 |
"//libc:__support_cpp_array", |
| 515 |
], |
| 516 |
) |
| 517 |
|
| 518 |
math_mpfr_test( |
| 519 |
name = "sinhf", |
| 520 |
deps = [ |
| 521 |
"//libc:__support_cpp_array", |
| 522 |
], |
| 523 |
) |
| 524 |
|
| 525 |
math_mpfr_test( |
| 526 |
name = "sinpif", |
| 527 |
hdrs = ["sdcomp26094.h"], |
| 528 |
deps = [ |
| 529 |
"//libc:__support_cpp_array", |
| 530 |
], |
| 531 |
) |
| 532 |
|
| 533 |
math_mpfr_test( |
| 534 |
name = "sqrt", |
| 535 |
hdrs = ["SqrtTest.h"], |
| 536 |
) |
| 537 |
|
| 538 |
math_mpfr_test( |
| 539 |
name = "sqrtf", |
| 540 |
hdrs = ["SqrtTest.h"], |
| 541 |
) |
| 542 |
|
| 543 |
math_mpfr_test( |
| 544 |
name = "sqrtl", |
| 545 |
hdrs = ["SqrtTest.h"], |
| 546 |
) |
| 547 |
|
| 548 |
math_mpfr_test( |
| 549 |
name = "f16sqrt", |
| 550 |
hdrs = ["SqrtTest.h"], |
| 551 |
) |
| 552 |
|
| 553 |
math_mpfr_test( |
| 554 |
name = "f16sqrtf", |
| 555 |
hdrs = ["SqrtTest.h"], |
| 556 |
) |
| 557 |
|
| 558 |
math_mpfr_test( |
| 559 |
name = "f16sqrtl", |
| 560 |
hdrs = ["SqrtTest.h"], |
| 561 |
) |
| 562 |
|
| 563 |
math_mpfr_test(name = "tan") |
| 564 |
|
| 565 |
math_mpfr_test( |
| 566 |
name = "tanf", |
| 567 |
hdrs = ["sdcomp26094.h"], |
| 568 |
deps = [ |
| 569 |
"//libc:__support_cpp_array", |
| 570 |
], |
| 571 |
) |
| 572 |
|
| 573 |
math_mpfr_test(name = "tanhf") |
| 574 |
|
| 575 |
math_mpfr_test( |
| 576 |
name = "trunc", |
| 577 |
hdrs = ["TruncTest.h"], |
| 578 |
) |
| 579 |
|
| 580 |
math_mpfr_test( |
| 581 |
name = "truncf", |
| 582 |
hdrs = ["TruncTest.h"], |
| 583 |
) |
| 584 |
|
| 585 |
math_mpfr_test( |
| 586 |
name = "truncl", |
| 587 |
hdrs = ["TruncTest.h"], |
| 588 |
) |
| 589 |
|
| 590 |
math_mpfr_test( |
| 591 |
name = "truncf16", |
| 592 |
hdrs = ["TruncTest.h"], |
| 593 |
) |
| 594 |
|
| 595 |
math_mpfr_test(name = "cosf16") |
| 596 |
|
| 597 |
math_mpfr_test(name = "cospif16") |
| 598 |
|
| 599 |
math_mpfr_test(name = "sinf16") |
| 600 |
|
| 601 |
math_mpfr_test(name = "sinpif16") |
| 602 |
|
| 603 |
math_mpfr_test(name = "tanf16") |
| 604 |
|
| 605 |
math_mpfr_test(name = "tanpif16") |
| 606 |
|
| 607 |
math_mpfr_test(name = "expf16") |
| 608 |
|
| 609 |
math_mpfr_test(name = "exp2f16") |
| 610 |
|
| 611 |
math_mpfr_test(name = "exp2m1f16") |
| 612 |
|
| 613 |
math_mpfr_test(name = "exp10f16") |
| 614 |
|
| 615 |
math_mpfr_test(name = "exp10m1f16") |
| 616 |
|
| 617 |
math_mpfr_test(name = "asinf16") |
| 618 |
|
| 619 |
math_mpfr_test(name = "acosf16") |
| 620 |
|
| 621 |
math_mpfr_test(name = "coshf16") |
| 622 |
|
| 623 |
math_mpfr_test(name = "sinhf16") |
| 624 |
|
| 625 |
math_mpfr_test(name = "tanhf16") |
| 626 |
|
| 627 |
math_mpfr_test(name = "logf16") |
| 628 |
|
| 629 |
math_mpfr_test(name = "log2f16") |
| 630 |
|
| 631 |
math_mpfr_test(name = "log10f16") |