Skip to content

Commit 60d7bf3

Browse files
authored
[libc][math][c23] Add (l|ll)rintf128 and (l|ll)roundf128 math functions. (llvm#84504)
1 parent 599ab6d commit 60d7bf3

24 files changed

+474
-27
lines changed

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ if(LIBC_TYPES_HAS_FLOAT128)
430430
libc.src.math.ldexpf128
431431
libc.src.math.llogbf128
432432
libc.src.math.logbf128
433+
libc.src.math.llrintf128
434+
libc.src.math.llroundf128
435+
libc.src.math.lrintf128
436+
libc.src.math.lroundf128
437+
libc.src.math.rintf128
433438
libc.src.math.roundf128
434439
libc.src.math.sqrtf128
435440
libc.src.math.truncf128

libc/config/linux/riscv/entrypoints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ if(LIBC_TYPES_HAS_FLOAT128)
438438
libc.src.math.ldexpf128
439439
libc.src.math.llogbf128
440440
libc.src.math.logbf128
441+
libc.src.math.llrintf128
442+
libc.src.math.llroundf128
443+
libc.src.math.lrintf128
444+
libc.src.math.lroundf128
445+
libc.src.math.rintf128
441446
libc.src.math.roundf128
442447
libc.src.math.sqrtf128
443448
libc.src.math.truncf128

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,11 @@ if(LIBC_TYPES_HAS_FLOAT128)
468468
libc.src.math.ldexpf128
469469
libc.src.math.llogbf128
470470
libc.src.math.logbf128
471+
libc.src.math.llrintf128
472+
libc.src.math.llroundf128
473+
libc.src.math.lrintf128
474+
libc.src.math.lroundf128
475+
libc.src.math.rintf128
471476
libc.src.math.roundf128
472477
libc.src.math.sqrtf128
473478
libc.src.math.truncf128

libc/docs/math/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,16 @@ Basic Operations
209209
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
210210
| llrintl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
211211
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
212+
| llrintf128 | |check| | |check| | | |check| | | | | | | | | |
213+
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
212214
| llround | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
213215
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
214216
| llroundf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
215217
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
216218
| llroundl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
217219
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
220+
| llroundf128 | |check| | |check| | | |check| | | | | | | | | |
221+
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
218222
| logb | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
219223
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
220224
| logbf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
@@ -229,12 +233,16 @@ Basic Operations
229233
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
230234
| lrintl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
231235
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
236+
| lrintf128 | |check| | |check| | | |check| | | | | | | | | |
237+
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
232238
| lround | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
233239
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
234240
| lroundf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
235241
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
236242
| lroundl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
237243
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
244+
| lroundf128 | |check| | |check| | | |check| | | | | | | | | |
245+
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
238246
| modf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
239247
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
240248
| modff | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
@@ -283,6 +291,8 @@ Basic Operations
283291
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
284292
| rintl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
285293
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
294+
| rintf128 | |check| | |check| | | |check| | | | | | | | | |
295+
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
286296
| round | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |
287297
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
288298
| roundf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | |

libc/spec/gnu_ext.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ def GnuExtensions : StandardSpec<"GNUExtensions"> {
3333
RetValSpec<VoidType>,
3434
[ArgSpec<FloatType>, ArgSpec<FloatPtr>, ArgSpec<FloatPtr>]
3535
>,
36-
FunctionSpec<"exp10", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
37-
FunctionSpec<"exp10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
3836
]
3937
>;
4038

libc/spec/stdc.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,9 @@ def StdC : StandardSpec<"stdc"> {
470470
FunctionSpec<"expm1", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
471471
FunctionSpec<"expm1f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
472472

473+
FunctionSpec<"exp10", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
474+
FunctionSpec<"exp10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
475+
473476
FunctionSpec<"remainderf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
474477
FunctionSpec<"remainder", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
475478
FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
@@ -486,22 +489,27 @@ def StdC : StandardSpec<"stdc"> {
486489
FunctionSpec<"lround", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
487490
FunctionSpec<"lroundf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
488491
FunctionSpec<"lroundl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
492+
GuardedFunctionSpec<"lroundf128", RetValSpec<LongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
489493

490494
FunctionSpec<"llround", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
491495
FunctionSpec<"llroundf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
492496
FunctionSpec<"llroundl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
497+
GuardedFunctionSpec<"llroundf128", RetValSpec<LongLongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
493498

494499
FunctionSpec<"rint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
495500
FunctionSpec<"rintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
496501
FunctionSpec<"rintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
502+
GuardedFunctionSpec<"rintf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
497503

498504
FunctionSpec<"lrint", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
499505
FunctionSpec<"lrintf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
500506
FunctionSpec<"lrintl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
507+
GuardedFunctionSpec<"lrintf128", RetValSpec<LongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
501508

502509
FunctionSpec<"llrint", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
503510
FunctionSpec<"llrintf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
504511
FunctionSpec<"llrintl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
512+
GuardedFunctionSpec<"llrintf128", RetValSpec<LongLongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
505513

506514
FunctionSpec<"sqrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
507515
FunctionSpec<"sqrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,

libc/src/math/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,22 @@ add_math_entrypoint_object(logbf128)
163163
add_math_entrypoint_object(llrint)
164164
add_math_entrypoint_object(llrintf)
165165
add_math_entrypoint_object(llrintl)
166+
add_math_entrypoint_object(llrintf128)
166167

167168
add_math_entrypoint_object(llround)
168169
add_math_entrypoint_object(llroundf)
169170
add_math_entrypoint_object(llroundl)
171+
add_math_entrypoint_object(llroundf128)
170172

171173
add_math_entrypoint_object(lrint)
172174
add_math_entrypoint_object(lrintf)
173175
add_math_entrypoint_object(lrintl)
176+
add_math_entrypoint_object(lrintf128)
174177

175178
add_math_entrypoint_object(lround)
176179
add_math_entrypoint_object(lroundf)
177180
add_math_entrypoint_object(lroundl)
181+
add_math_entrypoint_object(lroundf128)
178182

179183
add_math_entrypoint_object(modf)
180184
add_math_entrypoint_object(modff)
@@ -210,6 +214,7 @@ add_math_entrypoint_object(remquol)
210214
add_math_entrypoint_object(rint)
211215
add_math_entrypoint_object(rintf)
212216
add_math_entrypoint_object(rintl)
217+
add_math_entrypoint_object(rintf128)
213218

214219
add_math_entrypoint_object(round)
215220
add_math_entrypoint_object(roundf)

0 commit comments

Comments
 (0)