[libc-commits] [libc] [libc][math] Add iscanonical functions to math.yaml (PR #199317)

via libc-commits libc-commits at lists.llvm.org
Fri May 22 22:17:01 PDT 2026


https://github.com/jofrn updated https://github.com/llvm/llvm-project/pull/199317

>From 1c11f88dada7113ed700bc54bc7a868bfe051abc Mon Sep 17 00:00:00 2001
From: jofrn <jo7frn1 at gmail.com>
Date: Fri, 22 May 2026 19:48:45 -0700
Subject: [PATCH] [libc][math] Add iscanonical functions to math.yaml

Surface the existing iscanonical, iscanonicalbf16, iscanonicalf, iscanonicalf128, iscanonicalf16, and iscanonicall
implementations through the generated math.h.

To test:
`cmake -Bbuild -Sruntimes -GNinja -DLLVM_ENABLE_RUNTIMES=libc -DLLVM_LIBC_FULL_BUILD=ON`
`pip install pyyaml`
`ninja -C build libc.include.math.__generated_hdr__`
Then check `build/libc/include/math.h` for their signatures.

Add `-DLIBC_TYPES_HAS_FLOAT128=ON` to test for iscanonicalf128
in cmake invocation if host does not support it.
---
 libc/include/math.yaml | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/libc/include/math.yaml b/libc/include/math.yaml
index 36ff380a1b305..f838edad74e38 100644
--- a/libc/include/math.yaml
+++ b/libc/include/math.yaml
@@ -1588,6 +1588,44 @@ functions:
     return_type: int
     arguments:
       - type: long double
+  - name: iscanonical
+    standards:
+      - stdc
+    return_type: int
+    arguments:
+      - type: double
+  - name: iscanonicalbf16
+    standards:
+      - stdc
+    return_type: int
+    arguments:
+      - type: _Float16
+  - name: iscanonicalf
+    standards:
+      - stdc
+    return_type: int
+    arguments:
+      - type: float
+  - name: iscanonicalf128
+    standards:
+      - stdc
+    return_type: int
+    arguments:
+      - type: float128
+    guard: LIBC_TYPES_HAS_FLOAT128
+  - name: iscanonicalf16
+    standards:
+      - stdc
+    return_type: int
+    arguments:
+      - type: _Float16
+    guard: LIBC_TYPES_HAS_FLOAT16
+  - name: iscanonicall
+    standards:
+      - stdc
+    return_type: int
+    arguments:
+      - type: long double
   - name: isnan
     standards:
       - bsd



More information about the libc-commits mailing list