Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 18, 2024

Conversation

RoseZhang03
Copy link
Contributor

@RoseZhang03 RoseZhang03 commented Jul 18, 2024

@llvmbot llvmbot added the libc label Jul 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 18, 2024

@llvm/pr-subscribers-libc

Author: None (RoseZhang03)

Changes
  • deleted attribute from fabs function
  • added math functions from #98972

Full diff: https://github.com/llvm/llvm-project/pull/99571.diff

1 Files Affected:

  • (modified) libc/newhdrgen/yaml/math.yaml (+62-2)
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

Copy link
Contributor

@aaryanshukla aaryanshukla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

… the new math functions

- deleted attribute from fabs function
- added math functions from llvm#98972
@RoseZhang03 RoseZhang03 merged commit 0004ca6 into llvm:main Jul 18, 2024
3 of 5 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 19, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building libc at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/3477

Here is the relevant piece of the build log for the reference:

Step 6 (build-unified-tree) failure: build (failure)
...
6.206 [780/58/564] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strncat.dir/strncat.cpp.o
6.207 [779/58/565] Building CXX object libc/src/sys/resource/linux/CMakeFiles/libc.src.sys.resource.linux.getrlimit.dir/getrlimit.cpp.o
6.224 [778/58/566] Building CXX object libc/src/string/CMakeFiles/libc.src.string.stpncpy.dir/stpncpy.cpp.o
6.225 [777/58/567] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strrchr.dir/strrchr.cpp.o
6.226 [776/58/568] Building CXX object libc/src/sys/sendfile/linux/CMakeFiles/libc.src.sys.sendfile.linux.sendfile.dir/sendfile.cpp.o
6.230 [775/58/569] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.fchmod.dir/fchmod.cpp.o
6.230 [774/58/570] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.stat.dir/stat.cpp.o
6.231 [773/58/571] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.lstat.dir/lstat.cpp.o
6.231 [772/58/572] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.fstat.dir/fstat.cpp.o
6.232 [771/58/573] Building CXX object libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.statvfs.dir/statvfs.cpp.o
FAILED: libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.statvfs.dir/statvfs.cpp.o 
/build/buildbot/premerge-monolithic-linux/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -I/build/buildbot/premerge-monolithic-linux/llvm-project/libc -isystem /build/buildbot/premerge-monolithic-linux/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -UNDEBUG -std=gnu++17 -MD -MT libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.statvfs.dir/statvfs.cpp.o -MF libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.statvfs.dir/statvfs.cpp.o.d -o libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.statvfs.dir/statvfs.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/sys/statvfs/linux/statvfs.cpp
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/sys/statvfs/linux/statvfs.cpp:9:
/build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/sys/statvfs/statvfs.h:12:10: fatal error: 'llvm-libc-types/struct_statvfs.h' file not found
   12 | #include "llvm-libc-types/struct_statvfs.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
6.232 [771/57/574] Building CXX object libc/src/sys/utsname/linux/CMakeFiles/libc.src.sys.utsname.linux.uname.dir/uname.cpp.o
6.232 [771/56/575] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.strtof.dir/strtof.cpp.o
6.232 [771/55/576] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strcpy.dir/strcpy.cpp.o
6.232 [771/54/577] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strcspn.dir/strcspn.cpp.o
6.233 [771/53/578] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strdup.dir/strdup.cpp.o
6.233 [771/52/579] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strlcat.dir/strlcat.cpp.o
6.233 [771/51/580] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strlcpy.dir/strlcpy.cpp.o
6.233 [771/50/581] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strlen.dir/strlen.cpp.o
6.233 [771/49/582] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strndup.dir/strndup.cpp.o
6.234 [771/48/583] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strnlen.dir/strnlen.cpp.o
6.234 [771/47/584] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strpbrk.dir/strpbrk.cpp.o
6.234 [771/46/585] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strsep.dir/strsep.cpp.o
6.234 [771/45/586] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strstr.dir/strstr.cpp.o
6.234 [771/44/587] Building CXX object libc/src/string/CMakeFiles/libc.src.string.memset.dir/memset.cpp.o
6.234 [771/43/588] Building CXX object libc/src/sys/random/linux/CMakeFiles/libc.src.sys.random.linux.getrandom.dir/getrandom.cpp.o
6.235 [771/42/589] Building CXX object libc/src/sys/resource/linux/CMakeFiles/libc.src.sys.resource.linux.setrlimit.dir/setrlimit.cpp.o
6.235 [771/41/590] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.chmod.dir/chmod.cpp.o
6.235 [771/40/591] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.fchmodat.dir/fchmodat.cpp.o
6.235 [771/39/592] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.mkdir.dir/mkdir.cpp.o
6.235 [771/38/593] Building CXX object libc/src/sys/stat/linux/CMakeFiles/libc.src.sys.stat.linux.mkdirat.dir/mkdirat.cpp.o
6.235 [771/37/594] Building CXX object libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.fstatvfs.dir/fstatvfs.cpp.o
FAILED: libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.fstatvfs.dir/fstatvfs.cpp.o 
/build/buildbot/premerge-monolithic-linux/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -I/build/buildbot/premerge-monolithic-linux/llvm-project/libc -isystem /build/buildbot/premerge-monolithic-linux/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -UNDEBUG -std=gnu++17 -MD -MT libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.fstatvfs.dir/fstatvfs.cpp.o -MF libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.fstatvfs.dir/fstatvfs.cpp.o.d -o libc/src/sys/statvfs/linux/CMakeFiles/libc.src.sys.statvfs.linux.fstatvfs.dir/fstatvfs.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/sys/statvfs/linux/fstatvfs.cpp
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/sys/statvfs/linux/fstatvfs.cpp:9:
/build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/sys/statvfs/fstatvfs.h:12:10: fatal error: 'llvm-libc-types/struct_statvfs.h' file not found
   12 | #include "llvm-libc-types/struct_statvfs.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
6.235 [771/36/595] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.atof.dir/atof.cpp.o
6.237 [771/35/596] Building CXX object compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_errno.cpp.o
6.251 [771/34/597] Building CXX object compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_fuchsia.cpp.o
6.253 [771/33/598] Building CXX object compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_freebsd.cpp.o

yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants