Skip to content

Commit a2f61ba

Browse files
authored
[libc][math]fadd implementation (llvm#99694)
- **[libc] math fadd** - **[libc][math] implemented fadd**
1 parent 84658fb commit a2f61ba

File tree

16 files changed

+115
-1
lines changed

16 files changed

+115
-1
lines changed

libc/config/gpu/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ set(TARGET_LIBM_ENTRYPOINTS
266266
libc.src.math.expm1f
267267
libc.src.math.fabs
268268
libc.src.math.fabsf
269+
libc.src.math.fadd
269270
libc.src.math.fdim
270271
libc.src.math.fdimf
271272
libc.src.math.floor

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ set(TARGET_LIBM_ENTRYPOINTS
370370
libc.src.math.fabs
371371
libc.src.math.fabsf
372372
libc.src.math.fabsl
373+
libc.src.math.fadd
373374
libc.src.math.fdim
374375
libc.src.math.fdimf
375376
libc.src.math.fdiml

libc/config/linux/arm/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ set(TARGET_LIBM_ENTRYPOINTS
239239
libc.src.math.fabs
240240
libc.src.math.fabsf
241241
libc.src.math.fabsl
242+
libc.src.math.fadd
242243
libc.src.math.fdim
243244
libc.src.math.fdimf
244245
libc.src.math.fdiml

libc/config/linux/riscv/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ set(TARGET_LIBM_ENTRYPOINTS
371371
libc.src.math.fabs
372372
libc.src.math.fabsf
373373
libc.src.math.fabsl
374+
libc.src.math.fadd
374375
libc.src.math.fdim
375376
libc.src.math.fdimf
376377
libc.src.math.fdiml

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ set(TARGET_LIBM_ENTRYPOINTS
396396
libc.src.math.fabs
397397
libc.src.math.fabsf
398398
libc.src.math.fabsl
399+
libc.src.math.fadd
399400
libc.src.math.fdim
400401
libc.src.math.fdimf
401402
libc.src.math.fdiml

libc/config/windows/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ set(TARGET_LIBM_ENTRYPOINTS
144144
libc.src.math.fabs
145145
libc.src.math.fabsf
146146
libc.src.math.fabsl
147+
libc.src.math.fadd
147148
libc.src.math.fdim
148149
libc.src.math.fdimf
149150
libc.src.math.fdiml

libc/docs/math/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Basic Operations
136136
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
137137
| fabs | |check| | |check| | |check| | |check| | |check| | 7.12.7.3 | F.10.4.3 |
138138
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
139-
| fadd | N/A | | | N/A | | 7.12.14.1 | F.10.11 |
139+
| fadd | N/A | |check| | |check| | N/A | |check| | 7.12.14.1 | F.10.11 |
140140
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
141141
| fdim | |check| | |check| | |check| | |check| | |check| | 7.12.12.1 | F.10.9.1 |
142142
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

libc/spec/stdc.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ def StdC : StandardSpec<"stdc"> {
402402
FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
403403
GuardedFunctionSpec<"fabsf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
404404
GuardedFunctionSpec<"fabsf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
405+
FunctionSpec<"fadd", RetValSpec<FloatType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
405406

406407
FunctionSpec<"fdim", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
407408
FunctionSpec<"fdimf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,

libc/src/math/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ add_math_entrypoint_object(fabsf)
141141
add_math_entrypoint_object(fabsl)
142142
add_math_entrypoint_object(fabsf16)
143143
add_math_entrypoint_object(fabsf128)
144+
add_math_entrypoint_object(fadd)
144145

145146
add_math_entrypoint_object(fdim)
146147
add_math_entrypoint_object(fdimf)

libc/src/math/fadd.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//===-- Implementation of fadd 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/__support/macros/config.h"
10+
11+
#ifndef LLVM_LIBC_SRC_MATH_FADD_H
12+
#define LLVM_LIBC_SRC_MATH_FADD_H
13+
14+
namespace LIBC_NAMESPACE_DECL {
15+
16+
float fadd(double x, double y);
17+
18+
} // namespace LIBC_NAMESPACE_DECL
19+
20+
#endif // LLVM_LIBC_SRC_MATH_FADD_H

0 commit comments

Comments
 (0)