Skip to content

Commit cbdfc66

Browse files
committed
chore: add smoke tests for {canonicalize,iscanonical,fdim,copysign,issignaling}bf16 math functions
Signed-off-by: Krishna Pandey <[email protected]>
1 parent ff3915c commit cbdfc66

File tree

6 files changed

+142
-0
lines changed

6 files changed

+142
-0
lines changed

libc/test/src/math/smoke/CMakeLists.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,22 @@ add_fp_unittest(
432432
libc.src.__support.integer_literals
433433
)
434434

435+
add_fp_unittest(
436+
canonicalizebf16_test
437+
SUITE
438+
libc-math-smoke-tests
439+
SRCS
440+
canonicalizebf16_test.cpp
441+
HDRS
442+
CanonicalizeTest.h
443+
DEPENDS
444+
libc.src.math.canonicalizebf16
445+
libc.src.__support.FPUtil.bfloat16
446+
libc.src.__support.FPUtil.fp_bits
447+
libc.src.__support.FPUtil.fenv_impl
448+
libc.src.__support.integer_literals
449+
)
450+
435451
add_fp_unittest(
436452
iscanonical_test
437453
SUITE
@@ -492,6 +508,19 @@ add_fp_unittest(
492508
libc.src.math.iscanonicalf128
493509
)
494510

511+
add_fp_unittest(
512+
iscanonicalbf16_test
513+
SUITE
514+
libc-math-smoke-tests
515+
SRCS
516+
iscanonicalbf16_test.cpp
517+
HDRS
518+
IsCanonicalTest.h
519+
DEPENDS
520+
libc.src.math.iscanonicalbf16
521+
libc.src.__support.FPUtil.bfloat16
522+
)
523+
495524
add_fp_unittest(
496525
ceil_test
497526
SUITE
@@ -1559,6 +1588,21 @@ add_fp_unittest(
15591588
libc.src.__support.FPUtil.fp_bits
15601589
)
15611590

1591+
add_fp_unittest(
1592+
copysignbf16_test
1593+
SUITE
1594+
libc-math-smoke-tests
1595+
SRCS
1596+
copysignbf16_test.cpp
1597+
HDRS
1598+
CopySignTest.h
1599+
DEPENDS
1600+
libc.src.math.copysignbf16
1601+
libc.src.__support.CPP.algorithm
1602+
libc.src.__support.FPUtil.bfloat16
1603+
libc.src.__support.FPUtil.fp_bits
1604+
)
1605+
15621606
add_fp_unittest(
15631607
frexp_test
15641608
SUITE
@@ -2076,6 +2120,19 @@ add_fp_unittest(
20762120
libc.src.math.issignalingf128
20772121
)
20782122

2123+
add_fp_unittest(
2124+
issignalingbf16_test
2125+
SUITE
2126+
libc-math-smoke-tests
2127+
SRCS
2128+
issignalingbf16_test.cpp
2129+
HDRS
2130+
IsSignalingTest.h
2131+
DEPENDS
2132+
libc.src.math.issignalingbf16
2133+
libc.src.__support.FPUtil.bfloat16
2134+
)
2135+
20792136
add_fp_unittest(
20802137
llogb_test
20812138
SUITE
@@ -2510,6 +2567,21 @@ add_fp_unittest(
25102567
libc.src.__support.FPUtil.fp_bits
25112568
)
25122569

2570+
add_fp_unittest(
2571+
fdimbf16_test
2572+
SUITE
2573+
libc-math-smoke-tests
2574+
SRCS
2575+
fdimbf16_test.cpp
2576+
HDRS
2577+
FDimTest.h
2578+
DEPENDS
2579+
libc.src.math.fdimbf16
2580+
libc.src.__support.CPP.algorithm
2581+
libc.src.__support.FPUtil.bfloat16
2582+
libc.src.__support.FPUtil.fp_bits
2583+
)
2584+
25132585
add_fp_unittest(
25142586
fminf_test
25152587
SUITE
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for canonicalizebf16 ------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "CanonicalizeTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/canonicalizebf16.h"
13+
14+
LIST_CANONICALIZE_TESTS(bfloat16, LIBC_NAMESPACE::canonicalizebf16)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for copysignbf16 ----------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "CopySignTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/copysignbf16.h"
13+
14+
LIST_COPYSIGN_TESTS(bfloat16, LIBC_NAMESPACE::copysignbf16)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for fdimbf16 --------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "FDimTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/fdimbf16.h"
13+
14+
LIST_FDIM_TESTS(bfloat16, LIBC_NAMESPACE::fdimbf16);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for iscanonicalbf16 -------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "IsCanonicalTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/iscanonicalbf16.h"
13+
14+
LIST_ISCANONICAL_TESTS(bfloat16, LIBC_NAMESPACE::iscanonicalbf16)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for issignalingbf16 -------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "IsSignalingTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/issignalingbf16.h"
13+
14+
LIST_ISSIGNALING_TESTS(bfloat16, LIBC_NAMESPACE::issignalingbf16)

0 commit comments

Comments
 (0)