Skip to content

Commit 33dfdf4

Browse files
committed
chore: add general bf16{add,sub}{,f,l,f128} tests
Signed-off-by: Krishna Pandey <[email protected]>
1 parent f9bae64 commit 33dfdf4

File tree

9 files changed

+216
-0
lines changed

9 files changed

+216
-0
lines changed

libc/test/src/math/CMakeLists.txt

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,6 +2972,110 @@ add_fp_unittest(
29722972
libc.src.__support.macros.properties.types
29732973
)
29742974

2975+
add_fp_unittest(
2976+
bf16add_test
2977+
SUITE
2978+
libc-math-unittests
2979+
SRCS
2980+
bf16add_test.cpp
2981+
HDRS
2982+
AddTest.h
2983+
DEPENDS
2984+
libc.src.math.bf16add
2985+
libc.src.__support.FPUtil.bfloat16
2986+
)
2987+
2988+
add_fp_unittest(
2989+
bf16addf_test
2990+
SUITE
2991+
libc-math-unittests
2992+
SRCS
2993+
bf16addf_test.cpp
2994+
HDRS
2995+
AddTest.h
2996+
DEPENDS
2997+
libc.src.math.bf16addf
2998+
libc.src.__support.FPUtil.bfloat16
2999+
)
3000+
3001+
add_fp_unittest(
3002+
bf16addl_test
3003+
SUITE
3004+
libc-math-unittests
3005+
SRCS
3006+
bf16addl_test.cpp
3007+
HDRS
3008+
AddTest.h
3009+
DEPENDS
3010+
libc.src.math.bf16addl
3011+
libc.src.__support.FPUtil.bfloat16
3012+
)
3013+
3014+
add_fp_unittest(
3015+
bf16addf128_test
3016+
SUITE
3017+
libc-math-unittests
3018+
SRCS
3019+
bf16addf128_test.cpp
3020+
HDRS
3021+
AddTest.h
3022+
DEPENDS
3023+
libc.src.math.bf16addf128
3024+
libc.src.__support.FPUtil.bfloat16
3025+
)
3026+
3027+
add_fp_unittest(
3028+
bf16sub_test
3029+
SUITE
3030+
libc-math-unittests
3031+
SRCS
3032+
bf16sub_test.cpp
3033+
HDRS
3034+
SubTest.h
3035+
DEPENDS
3036+
libc.src.math.bf16sub
3037+
libc.src.__support.FPUtil.bfloat16
3038+
)
3039+
3040+
add_fp_unittest(
3041+
bf16subf_test
3042+
SUITE
3043+
libc-math-unittests
3044+
SRCS
3045+
bf16subf_test.cpp
3046+
HDRS
3047+
SubTest.h
3048+
DEPENDS
3049+
libc.src.math.bf16subf
3050+
libc.src.__support.FPUtil.bfloat16
3051+
)
3052+
3053+
add_fp_unittest(
3054+
bf16subl_test
3055+
SUITE
3056+
libc-math-unittests
3057+
SRCS
3058+
bf16subl_test.cpp
3059+
HDRS
3060+
SubTest.h
3061+
DEPENDS
3062+
libc.src.math.bf16subl
3063+
libc.src.__support.FPUtil.bfloat16
3064+
)
3065+
3066+
add_fp_unittest(
3067+
bf16subf128_test
3068+
SUITE
3069+
libc-math-unittests
3070+
SRCS
3071+
bf16subf128_test.cpp
3072+
HDRS
3073+
SubTest.h
3074+
DEPENDS
3075+
libc.src.math.bf16subf128
3076+
libc.src.__support.FPUtil.bfloat16
3077+
)
3078+
29753079
add_subdirectory(generic)
29763080
add_subdirectory(smoke)
29773081

libc/test/src/math/bf16add_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16add ---------------------------------------------===//
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 "AddTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16add.h"
13+
14+
LIST_ADD_TESTS(bfloat16, double, LIBC_NAMESPACE::bf16add)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16addf128 -----------------------------------------===//
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 "AddTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16addf128.h"
13+
14+
LIST_ADD_TESTS(bfloat16, float128, LIBC_NAMESPACE::bf16addf128)

libc/test/src/math/bf16addf_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16addf --------------------------------------------===//
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 "AddTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16addf.h"
13+
14+
LIST_ADD_TESTS(bfloat16, float, LIBC_NAMESPACE::bf16addf)

libc/test/src/math/bf16addl_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16addl --------------------------------------------===//
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 "AddTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16addl.h"
13+
14+
LIST_ADD_TESTS(bfloat16, long double, LIBC_NAMESPACE::bf16addl)

libc/test/src/math/bf16sub_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16sub ---------------------------------------------===//
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 "SubTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16sub.h"
13+
14+
LIST_SUB_TESTS(bfloat16, double, LIBC_NAMESPACE::bf16sub)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16subf128 -----------------------------------------===//
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 "SubTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16subf128.h"
13+
14+
LIST_SUB_TESTS(bfloat16, float128, LIBC_NAMESPACE::bf16subf128)

libc/test/src/math/bf16subf_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16subf --------------------------------------------===//
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 "SubTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16subf.h"
13+
14+
LIST_SUB_TESTS(bfloat16, float, LIBC_NAMESPACE::bf16subf)

libc/test/src/math/bf16subl_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Unittests for bf16subl --------------------------------------------===//
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 "SubTest.h"
10+
11+
#include "src/__support/FPUtil/bfloat16.h"
12+
#include "src/math/bf16subl.h"
13+
14+
LIST_SUB_TESTS(bfloat16, long double, LIBC_NAMESPACE::bf16subl)

0 commit comments

Comments
 (0)