Skip to content

Commit 95fdccb

Browse files
[libc][C23] Implemented remquof128 function
[libc][C23] Implemented remquof128 function
1 parent bafff3e commit 95fdccb

File tree

9 files changed

+82
-0
lines changed

9 files changed

+82
-0
lines changed

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
574574
libc.src.math.nextafterf128
575575
libc.src.math.nextdownf128
576576
libc.src.math.nextupf128
577+
libc.src.math.remquof128
577578
libc.src.math.rintf128
578579
libc.src.math.roundf128
579580
libc.src.math.scalbnf128

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
605605
libc.src.math.nextafterf128
606606
libc.src.math.nextdownf128
607607
libc.src.math.nextupf128
608+
libc.src.math.remquof128
608609
libc.src.math.rintf128
609610
libc.src.math.roundevenf128
610611
libc.src.math.roundf128

libc/spec/stdc.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ def StdC : StandardSpec<"stdc"> {
578578
FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
579579

580580
FunctionSpec<"remquof", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
581+
GuardedFunctionSpec<"remquof128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<IntPtr>], "LIBC_TYPES_HAS_FLOAT128">,
581582
FunctionSpec<"remquo", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
582583
FunctionSpec<"remquol", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
583584

libc/src/math/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ add_math_entrypoint_object(remainderl)
310310

311311
add_math_entrypoint_object(remquo)
312312
add_math_entrypoint_object(remquof)
313+
add_math_entrypoint_object(remquof128)
313314
add_math_entrypoint_object(remquol)
314315

315316
add_math_entrypoint_object(rint)

libc/src/math/generic/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,6 +2416,18 @@ add_entrypoint_object(
24162416
-O2
24172417
)
24182418

2419+
add_entrypoint_object(
2420+
remquof128
2421+
SRCS
2422+
remquof128.cpp
2423+
HDRS
2424+
../remquof128.h
2425+
DEPENDS
2426+
libc.src.__support.FPUtil.division_and_remainder_operations
2427+
COMPILE_OPTIONS
2428+
-O2
2429+
)
2430+
24192431
add_entrypoint_object(
24202432
remquo
24212433
SRCS

libc/src/math/generic/remquof128.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===-- Implementation of remquof128 function -----------------------------===//
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 "src/math/remquof128.h"
10+
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
11+
#include "src/__support/common.h"
12+
13+
namespace LIBC_NAMESPACE {
14+
15+
LLVM_LIBC_FUNCTION(float128, remquof128, (float128 x, float128 y, int *exp)) {
16+
return fputil::remquo(x, y, *exp);
17+
}
18+
19+
} // namespace LIBC_NAMESPACE

libc/src/math/remquof128.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//===-- Implementation header for remquof128 --------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_MATH_REMQUOF128_H
10+
#define LLVM_LIBC_SRC_MATH_REMQUOF128_H
11+
12+
#include "src/__support/macros/properties/types.h"
13+
14+
namespace LIBC_NAMESPACE {
15+
16+
float128 remquof128(float128 x, float128 y, int *exp);
17+
18+
} // namespace LIBC_NAMESPACE
19+
20+
#endif // LLVM_LIBC_SRC_MATH_REMQUOF128_H

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,20 @@ add_fp_unittest(
25142514
libc.src.__support.FPUtil.fp_bits
25152515
)
25162516

2517+
add_fp_unittest(
2518+
remquof128_test
2519+
SUITE
2520+
libc-math-smoke-tests
2521+
SRCS
2522+
remquof128_test.cpp
2523+
HDRS
2524+
RemQuoTest.h
2525+
DEPENDS
2526+
libc.src.math.remquof128
2527+
libc.src.__support.FPUtil.basic_operations
2528+
libc.src.__support.FPUtil.fp_bits
2529+
)
2530+
25172531
add_fp_unittest(
25182532
remquo_test
25192533
SUITE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//===-- Unittests for remquof128 ------------------------------------------===//
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 "RemQuoTest.h"
10+
11+
#include "src/math/remquof128.h"
12+
13+
LIST_REMQUO_TESTS(float128, LIBC_NAMESPACE::remquof128)

0 commit comments

Comments
 (0)