[libc-commits] [libc] 0004ca6 - [libc] Removed __LIBC_CONST_ATTR attribute and updated math.yaml with the new math functions (#99571)

via libc-commits libc-commits at lists.llvm.org
Thu Jul 18 15:58:37 PDT 2024


Author: RoseZhang03
Date: 2024-07-18T22:58:34Z
New Revision: 0004ca670a960d3573137679b3c67a7b3932530a

URL: https://github.com/llvm/llvm-project/commit/0004ca670a960d3573137679b3c67a7b3932530a
DIFF: https://github.com/llvm/llvm-project/commit/0004ca670a960d3573137679b3c67a7b3932530a.diff

LOG: [libc] Removed __LIBC_CONST_ATTR attribute and updated math.yaml with the new math functions (#99571)

- deleted attribute from fabs function
- added math functions from #98972
- also updated statvfs files so that it can be generated

Added: 
    

Modified: 
    libc/config/linux/api.td
    libc/config/linux/x86_64/headers.txt
    libc/newhdrgen/yaml/math.yaml
    libc/newhdrgen/yaml/sys/statvfs.yaml
    libc/src/sys/statvfs/linux/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index a10dec06e2452..320f3e92183bf 100644
--- a/libc/config/linux/api.td
+++ b/libc/config/linux/api.td
@@ -267,5 +267,5 @@ def SearchAPI : PublicAPI<"search.h"> {
 }
 
 def SysStatvfsAPI : PublicAPI<"sys/statvfs.h"> {
-  let Types = ["fsblkcnt_t", "fsfilcnt_t", "struct statvfs"];
+  let Types = ["struct statvfs"];
 }

diff  --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 8a52d80e1fbfb..0294f62bc2f7a 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -45,8 +45,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.sys_select
     libc.include.sys_socket
     libc.include.sys_stat
-    # statvfs is broken, will uncomment once it's fixed.
-    # libc.include.sys_statvfs
+    libc.include.sys_statvfs
     libc.include.sys_syscall
     libc.include.sys_time
     libc.include.sys_types

diff  --git a/libc/newhdrgen/yaml/math.yaml b/libc/newhdrgen/yaml/math.yaml
index 8588389bca4d2..ce562c653a6d2 100644
--- a/libc/newhdrgen/yaml/math.yaml
+++ b/libc/newhdrgen/yaml/math.yaml
@@ -64,8 +64,6 @@ functions:
     return_type: double
     arguments:
       - type: double
-    attributes:
-      - __LIBC_CONST_ATTR
   - name: fabsf
     standards: 
       - stdc
@@ -364,6 +362,20 @@ functions:
     arguments:
       - type: double
       - type: double
+  - name: fmull
+    standards:
+      - stdc
+    return_type: float
+    arguments:
+      - type: long double
+      - type: long double
+  - name: dmull
+    standards:
+      - stdc
+    return_type: double
+    arguments:
+      - type: long double
+      - type: long double
   - name: frexp
     standards: 
       - stdc
@@ -1323,6 +1335,30 @@ functions:
       - type: long double
       - type: long double
     guard: LIBC_TYPES_HAS_FLOAT16
+  - name: f16mul
+    standards:
+      - llvm_libc_ext
+    return_type: _Float16
+    arguments:
+      - type: double
+      - type: double
+    guard: LIBC_TYPES_HAS_FLOAT16
+  - name: f16mulf
+    standards:
+      - llvm_libc_ext
+    return_type: _Float16
+    arguments:
+      - type: float
+      - type: float
+    guard: LIBC_TYPES_HAS_FLOAT16
+  - name: f16mull
+    standards:
+      - llvm_libc_ext
+    return_type: _Float16
+    arguments:
+      - type: long double
+      - type: long double
+    guard: LIBC_TYPES_HAS_FLOAT16
   - name: f16sqrt
     standards: 
       - llvm_libc_ext
@@ -1756,6 +1792,14 @@ functions:
       - type: float128
       - type: float128
     guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
+  - name: f16mulf128
+    standards:
+      - stdc
+    return_type: _Float16
+    arguments:
+      - type: float128
+      - type: float128
+    guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
   - name: f16sqrtf128
     standards: 
       - llvm_libc_ext
@@ -1896,6 +1940,22 @@ functions:
       - type: float128
       - type: float128
     guard: LIBC_TYPES_HAS_FLOAT128
+  - name: fmulf128
+    standards:
+      - llvm_libc_ext
+    return_type: float
+    arguments:
+      - type: float128
+      - type: float128
+    guard: LIBC_TYPES_HAS_FLOAT128
+  - name: dmulf128
+    standards:
+      - llvm_libc_ext
+    return_type: double
+    arguments:
+      - type: float128
+      - type: float128
+    guard: LIBC_TYPES_HAS_FLOAT128
   - name: frexpf128
     standards: 
       - stdc

diff  --git a/libc/newhdrgen/yaml/sys/statvfs.yaml b/libc/newhdrgen/yaml/sys/statvfs.yaml
index 3651901e9f2c7..53666770a5de6 100644
--- a/libc/newhdrgen/yaml/sys/statvfs.yaml
+++ b/libc/newhdrgen/yaml/sys/statvfs.yaml
@@ -2,6 +2,8 @@ header: sys-statvfs.h
 macros: []
 types:
   - type_name: struct_statvfs
+  - type_name: fsblkcnt_t
+  - type_name: fsfilcnt_t
 enums: []
 objects: []
 functions:

diff  --git a/libc/src/sys/statvfs/linux/CMakeLists.txt b/libc/src/sys/statvfs/linux/CMakeLists.txt
index a6660c02badf7..2953717e70392 100644
--- a/libc/src/sys/statvfs/linux/CMakeLists.txt
+++ b/libc/src/sys/statvfs/linux/CMakeLists.txt
@@ -8,7 +8,7 @@ add_header_library(
     libc.src.__support.common
     libc.src.__support.CPP.optional
     libc.include.sys_syscall
-    libc.include.llvm-libc-types.struct_statvfs
+    libc.include.sys_statvfs
 )
 
 add_entrypoint_object(
@@ -19,7 +19,7 @@ add_entrypoint_object(
     ../statvfs.h
   DEPENDS
     libc.src.__support.libc_assert
-    libc.include.llvm-libc-types.struct_statvfs
+    libc.include.sys_statvfs
     .statfs_utils
 )
 
@@ -31,7 +31,7 @@ add_entrypoint_object(
     ../fstatvfs.h
   DEPENDS
     libc.src.__support.libc_assert
-    libc.include.llvm-libc-types.struct_statvfs
+    libc.include.sys_statvfs
     .statfs_utils
 )
 


        


More information about the libc-commits mailing list