File tree Expand file tree Collapse file tree 34 files changed +619
-13
lines changed Expand file tree Collapse file tree 34 files changed +619
-13
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,9 @@ set(TARGET_LIBM_ENTRYPOINTS
370
370
libc.src.complex.conj
371
371
libc.src.complex.conjf
372
372
libc.src.complex.conjl
373
+ libc.src.complex.cproj
374
+ libc.src.complex.cprojf
375
+ libc.src.complex.cprojl
373
376
374
377
# fenv.h entrypoints
375
378
libc.src.fenv.feclearexcept
@@ -622,6 +625,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
622
625
# libc.src.complex.crealf16
623
626
# libc.src.complex.cimagf16
624
627
# libc.src.complex.conjf16
628
+ # libc.src.complex.cprojf16
625
629
626
630
# math.h C23 _Float16 entrypoints
627
631
libc.src.math.canonicalizef16
@@ -728,6 +732,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
728
732
libc.src.complex.crealf128
729
733
libc.src.complex.cimagf128
730
734
libc.src.complex.conjf128
735
+ libc.src.complex.cprojf128
731
736
732
737
# math.h C23 _Float128 entrypoints
733
738
libc.src.math.canonicalizef128
Original file line number Diff line number Diff line change @@ -212,6 +212,9 @@ set(TARGET_LIBM_ENTRYPOINTS
212
212
libc.src.complex.conj
213
213
libc.src.complex.conjf
214
214
libc.src.complex.conjl
215
+ libc.src.complex.cproj
216
+ libc.src.complex.cprojf
217
+ libc.src.complex.cprojl
215
218
216
219
# fenv.h entrypoints
217
220
libc.src.fenv.feclearexcept
Original file line number Diff line number Diff line change @@ -367,6 +367,9 @@ set(TARGET_LIBM_ENTRYPOINTS
367
367
libc.src.complex.conj
368
368
libc.src.complex.conjf
369
369
libc.src.complex.conjl
370
+ libc.src.complex.cproj
371
+ libc.src.complex.cprojf
372
+ libc.src.complex.cprojl
370
373
371
374
# fenv.h entrypoints
372
375
libc.src.fenv.feclearexcept
@@ -623,6 +626,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
623
626
libc.src.complex.crealf128
624
627
libc.src.complex.cimagf128
625
628
libc.src.complex.conjf128
629
+ libc.src.complex.cprojf128
626
630
627
631
# math.h C23 _Float128 entrypoints
628
632
libc.src.math.canonicalizef128
Original file line number Diff line number Diff line change @@ -370,6 +370,9 @@ set(TARGET_LIBM_ENTRYPOINTS
370
370
libc.src.complex.conj
371
371
libc.src.complex.conjf
372
372
libc.src.complex.conjl
373
+ libc.src.complex.cproj
374
+ libc.src.complex.cprojf
375
+ libc.src.complex.cprojl
373
376
374
377
# fenv.h entrypoints
375
378
libc.src.fenv.feclearexcept
@@ -627,6 +630,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
627
630
libc.src.complex.crealf16
628
631
libc.src.complex.cimagf16
629
632
libc.src.complex.conjf16
633
+ libc.src.complex.cprojf16
630
634
631
635
# math.h C23 _Float16 entrypoints
632
636
libc.src.math.canonicalizef16
@@ -738,6 +742,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
738
742
# libc.src.complex.crealf128
739
743
# libc.src.complex.cimagf128
740
744
# libc.src.complex.conjf128
745
+ # libc.src.complex.cprojf128
741
746
742
747
# math.h C23 _Float128 entrypoints
743
748
libc.src.math.canonicalizef128
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ Functions
59
59
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
60
60
| conj | |check | | |check | | |check | | |check | | |check | | 7.3.9.4 | N/A |
61
61
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
62
- | cproj | | | | | | 7.3.9.5 | N/A |
62
+ | cproj | | check | | | check | | | check | | | check | | | check | | 7.3.9.5 | N/A |
63
63
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
64
64
| creal | |check | | |check | | |check | | |check | | |check | | 7.3.9.6 | N/A |
65
65
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
Original file line number Diff line number Diff line change @@ -103,3 +103,35 @@ functions:
103
103
arguments :
104
104
- type : cfloat128
105
105
guard : LIBC_TYPES_HAS_CFLOAT128
106
+ - name : cproj
107
+ standards :
108
+ - stdc
109
+ return_type : _Complex double
110
+ arguments :
111
+ - type : _Complex double
112
+ - name : cprojf
113
+ standards :
114
+ - stdc
115
+ return_type : _Complex float
116
+ arguments :
117
+ - type : _Complex float
118
+ - name : cprojl
119
+ standards :
120
+ - stdc
121
+ return_type : _Complex long double
122
+ arguments :
123
+ - type : _Complex long double
124
+ - name : cprojf16
125
+ standards :
126
+ - stdc
127
+ return_type : cfloat16
128
+ arguments :
129
+ - type : cfloat16
130
+ guard : LIBC_TYPES_HAS_CFLOAT16
131
+ - name : cprojf128
132
+ standards :
133
+ - stdc
134
+ return_type : cfloat128
135
+ arguments :
136
+ - type : cfloat128
137
+ guard : LIBC_TYPES_HAS_CFLOAT128
Original file line number Diff line number Diff line change @@ -241,6 +241,11 @@ add_header_library(
241
241
complex_type
242
242
HDRS
243
243
complex_type.h
244
+ DEPENDS
245
+ libc.src.__support.CPP.bit
246
+ libc.src.__support.FPUtil.fp_bits
247
+ libc.src.__support.macros .properties.types
248
+ libc.src.__support.macros .properties.complex_types
244
249
)
245
250
246
251
add_header_library(
Original file line number Diff line number Diff line change 9
9
#ifndef LLVM_LIBC_SRC___SUPPORT_COMPLEX_TYPE_H
10
10
#define LLVM_LIBC_SRC___SUPPORT_COMPLEX_TYPE_H
11
11
12
+ #include " src/__support/CPP/bit.h"
13
+ #include " src/__support/FPUtil/FPBits.h"
12
14
#include " src/__support/macros/config.h"
13
15
#include " src/__support/macros/properties/complex_types.h"
14
16
#include " src/__support/macros/properties/types.h"
@@ -75,5 +77,18 @@ template <typename T> LIBC_INLINE constexpr T conjugate(T c) {
75
77
return cpp::bit_cast<T>(c_c);
76
78
}
77
79
80
+ template <typename T> LIBC_INLINE constexpr T project (T c) {
81
+ using real_t = make_real_t <T>;
82
+ Complex<real_t > c_c = cpp::bit_cast<Complex<real_t >>(c);
83
+ if (fputil::FPBits<real_t >(c_c.real ).is_inf () ||
84
+ fputil::FPBits<real_t >(c_c.imag ).is_inf ()) {
85
+ return cpp::bit_cast<T>(
86
+ Complex<real_t >{(fputil::FPBits<real_t >::inf (Sign::POS).get_val ()),
87
+ static_cast <real_t >(c_c.imag > 0 ? 0.0 : -0.0 )});
88
+ } else {
89
+ return c;
90
+ }
91
+ }
92
+
78
93
} // namespace LIBC_NAMESPACE_DECL
79
94
#endif // LLVM_LIBC_SRC___SUPPORT_COMPLEX_TYPE_H
Original file line number Diff line number Diff line change @@ -30,3 +30,9 @@ add_complex_entrypoint_object(conjf)
30
30
add_complex_entrypoint_object(conjl)
31
31
add_complex_entrypoint_object(conjf16)
32
32
add_complex_entrypoint_object(conjf128)
33
+
34
+ add_complex_entrypoint_object(cproj)
35
+ add_complex_entrypoint_object(cprojf)
36
+ add_complex_entrypoint_object(cprojl)
37
+ add_complex_entrypoint_object(cprojf16)
38
+ add_complex_entrypoint_object(cprojf128)
Original file line number Diff line number Diff line change 7
7
// ===----------------------------------------------------------------------===//
8
8
9
9
#include " src/__support/macros/properties/complex_types.h"
10
- #include " src/__support/macros/properties/types.h"
11
10
12
11
#if defined(LIBC_TYPES_HAS_CFLOAT128)
13
12
Original file line number Diff line number Diff line change 7
7
// ===----------------------------------------------------------------------===//
8
8
9
9
#include " src/__support/macros/properties/complex_types.h"
10
- #include " src/__support/macros/properties/types.h"
11
10
12
11
#if defined(LIBC_TYPES_HAS_CFLOAT16)
13
12
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for cproj -------------------------*- 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_COMPLEX_CPROJ_H
10
+ #define LLVM_LIBC_SRC_COMPLEX_CPROJ_H
11
+
12
+ #include " src/__support/macros/config.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ _Complex double cproj (_Complex double x);
17
+
18
+ } // namespace LIBC_NAMESPACE_DECL
19
+
20
+ #endif // LLVM_LIBC_SRC_COMPLEX_CPROJ_H
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for cprojf ------------------------*- 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_COMPLEX_CPROJF_H
10
+ #define LLVM_LIBC_SRC_COMPLEX_CPROJF_H
11
+
12
+ #include " src/__support/macros/config.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ _Complex float cprojf (_Complex float x);
17
+
18
+ } // namespace LIBC_NAMESPACE_DECL
19
+
20
+ #endif // LLVM_LIBC_SRC_COMPLEX_CPROJF_H
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for cprojf128 ---------------------*- 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
+ #include " src/__support/macros/properties/complex_types.h"
10
+
11
+ #if defined(LIBC_TYPES_HAS_CFLOAT128)
12
+
13
+ #ifndef LLVM_LIBC_SRC_COMPLEX_CPROJF128_H
14
+ #define LLVM_LIBC_SRC_COMPLEX_CPROJF128_H
15
+
16
+ #include " src/__support/macros/config.h"
17
+
18
+ namespace LIBC_NAMESPACE_DECL {
19
+
20
+ cfloat128 cprojf128 (cfloat128 x);
21
+
22
+ } // namespace LIBC_NAMESPACE_DECL
23
+
24
+ #endif // LLVM_LIBC_SRC_COMPLEX_CPROJF128_H
25
+
26
+ #endif // LIBC_TYPES_HAS_CFLOAT128
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for cprojf16 ----------------------*- 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
+ #include " src/__support/macros/properties/complex_types.h"
10
+
11
+ #if defined(LIBC_TYPES_HAS_CFLOAT16)
12
+
13
+ #ifndef LLVM_LIBC_SRC_COMPLEX_CPROJF16_H
14
+ #define LLVM_LIBC_SRC_COMPLEX_CPROJF16_H
15
+
16
+ #include " src/__support/macros/config.h"
17
+
18
+ namespace LIBC_NAMESPACE_DECL {
19
+
20
+ cfloat16 cprojf16 (cfloat16 x);
21
+
22
+ } // namespace LIBC_NAMESPACE_DECL
23
+
24
+ #endif // LLVM_LIBC_SRC_COMPLEX_CPROJF16_H
25
+
26
+ #endif // LIBC_TYPES_HAS_CFLOAT16
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for cprojl ------------------------*- 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_COMPLEX_CPROJL_H
10
+ #define LLVM_LIBC_SRC_COMPLEX_CPROJL_H
11
+
12
+ #include " src/__support/macros/config.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ _Complex long double cprojl (_Complex long double x);
17
+
18
+ } // namespace LIBC_NAMESPACE_DECL
19
+
20
+ #endif // LLVM_LIBC_SRC_COMPLEX_CPROJL_H
You can’t perform that action at this time.
0 commit comments