[libc-commits] [libc] [llvm] [libc][workflows] fix pre-commit fullbuild and re-enable gcc (PR #119441)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Tue Dec 10 12:07:07 PST 2024
https://github.com/SchrodingerZhu updated https://github.com/llvm/llvm-project/pull/119441
>From c87af65d30c2aed5b1e41c4b10a1e2cc5843f0c2 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 11:34:25 -0800
Subject: [PATCH 1/5] [libc][workflows] try fix build
---
.github/workflows/libc-fullbuild-tests.yml | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml
index b07e94244c2e8c..357e9064e90100 100644
--- a/.github/workflows/libc-fullbuild-tests.yml
+++ b/.github/workflows/libc-fullbuild-tests.yml
@@ -18,9 +18,8 @@ jobs:
include:
- c_compiler: clang
cpp_compiler: clang++
- # TODO: add back gcc build when it is fixed
- # - c_compiler: gcc
- # cpp_compiler: g++
+ - c_compiler: gcc
+ cpp_compiler: g++
steps:
- uses: actions/checkout at v4
@@ -44,7 +43,7 @@ jobs:
- name: Prepare dependencies (Ubuntu)
run: |
sudo apt-get update
- sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-headers-generic linux-libc-dev
+ sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev
sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm
- name: Set reusable strings
>From d8d6eaf086ca07825ce256f5da69614dbd5a0911 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 11:39:12 -0800
Subject: [PATCH 2/5] more fixes
---
libc/src/__support/FPUtil/except_value_utils.h | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h
index f8e4e92d3e1fb3..6fc9ea1acc4a46 100644
--- a/libc/src/__support/FPUtil/except_value_utils.h
+++ b/libc/src/__support/FPUtil/except_value_utils.h
@@ -81,15 +81,21 @@ template <typename T, size_t N> struct ExceptValues {
StorageType out_bits = values[i].rnd_towardzero_result;
switch (fputil::quick_get_round()) {
case FE_UPWARD:
- out_bits += sign ? values[i].rnd_downward_offset
- : values[i].rnd_upward_offset;
+ out_bits += sign ? static_cast<decltype(out_bits)>(
+ values[i].rnd_downward_offset)
+ : static_cast<decltype(out_bits)>(
+ values[i].rnd_upward_offset);
break;
case FE_DOWNWARD:
- out_bits += sign ? values[i].rnd_upward_offset
- : values[i].rnd_downward_offset;
+ out_bits +=
+ sign
+ ? static_cast<decltype(out_bits)>(values[i].rnd_upward_offset)
+ : static_cast<decltype(out_bits)>(
+ values[i].rnd_downward_offset);
break;
case FE_TONEAREST:
- out_bits += values[i].rnd_tonearest_offset;
+ out_bits +=
+ static_cast<decltype(out_bits)>(values[i].rnd_tonearest_offset);
break;
}
T result = FPBits<T>(out_bits).get_val();
>From 0dce8645d4b1fa2e4a6e2b058bca85c9c3bc1d10 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 11:53:37 -0800
Subject: [PATCH 3/5] lift casting to outer scope
---
libc/src/__support/FPUtil/except_value_utils.h | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h
index 6fc9ea1acc4a46..0494c1fb104b56 100644
--- a/libc/src/__support/FPUtil/except_value_utils.h
+++ b/libc/src/__support/FPUtil/except_value_utils.h
@@ -81,17 +81,14 @@ template <typename T, size_t N> struct ExceptValues {
StorageType out_bits = values[i].rnd_towardzero_result;
switch (fputil::quick_get_round()) {
case FE_UPWARD:
- out_bits += sign ? static_cast<decltype(out_bits)>(
- values[i].rnd_downward_offset)
- : static_cast<decltype(out_bits)>(
- values[i].rnd_upward_offset);
+ out_bits += static_cast<decltype(out_bits)>(
+ sign ? values[i].rnd_downward_offset
+ : values[i].rnd_upward_offset);
break;
case FE_DOWNWARD:
- out_bits +=
- sign
- ? static_cast<decltype(out_bits)>(values[i].rnd_upward_offset)
- : static_cast<decltype(out_bits)>(
- values[i].rnd_downward_offset);
+ out_bits += static_cast<decltype(out_bits)>(
+ sign ? values[i].rnd_upward_offset
+ : values[i].rnd_downward_offset);
break;
case FE_TONEAREST:
out_bits +=
>From d96f24afbf0b45316648466f29e13fe763d10efc Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 11:58:27 -0800
Subject: [PATCH 4/5] workaround gcc
---
libc/src/__support/FPUtil/except_value_utils.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h
index 0494c1fb104b56..2e58bf2b287fdf 100644
--- a/libc/src/__support/FPUtil/except_value_utils.h
+++ b/libc/src/__support/FPUtil/except_value_utils.h
@@ -81,18 +81,19 @@ template <typename T, size_t N> struct ExceptValues {
StorageType out_bits = values[i].rnd_towardzero_result;
switch (fputil::quick_get_round()) {
case FE_UPWARD:
- out_bits += static_cast<decltype(out_bits)>(
- sign ? values[i].rnd_downward_offset
- : values[i].rnd_upward_offset);
+ if (sign)
+ out_bits += values[i].rnd_downward_offset;
+ else
+ out_bits += values[i].rnd_upward_offset;
break;
case FE_DOWNWARD:
- out_bits += static_cast<decltype(out_bits)>(
- sign ? values[i].rnd_upward_offset
- : values[i].rnd_downward_offset);
+ if (sign)
+ out_bits += values[i].rnd_upward_offset;
+ else
+ out_bits += values[i].rnd_downward_offset;
break;
case FE_TONEAREST:
- out_bits +=
- static_cast<decltype(out_bits)>(values[i].rnd_tonearest_offset);
+ out_bits += values[i].rnd_tonearest_offset;
break;
}
T result = FPBits<T>(out_bits).get_val();
>From 4e11c2c752f44966ce447b647085f34b6e1c1b8b Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 12:06:54 -0800
Subject: [PATCH 5/5] undo gcc changes
---
.github/workflows/libc-fullbuild-tests.yml | 5 +++--
libc/src/__support/FPUtil/except_value_utils.h | 12 ++++--------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml
index 357e9064e90100..58e15ce29546ef 100644
--- a/.github/workflows/libc-fullbuild-tests.yml
+++ b/.github/workflows/libc-fullbuild-tests.yml
@@ -18,8 +18,9 @@ jobs:
include:
- c_compiler: clang
cpp_compiler: clang++
- - c_compiler: gcc
- cpp_compiler: g++
+ # TODO: add back gcc build when it is fixed
+ # - c_compiler: gcc
+ # cpp_compiler: g++
steps:
- uses: actions/checkout at v4
diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h
index 2e58bf2b287fdf..f8e4e92d3e1fb3 100644
--- a/libc/src/__support/FPUtil/except_value_utils.h
+++ b/libc/src/__support/FPUtil/except_value_utils.h
@@ -81,16 +81,12 @@ template <typename T, size_t N> struct ExceptValues {
StorageType out_bits = values[i].rnd_towardzero_result;
switch (fputil::quick_get_round()) {
case FE_UPWARD:
- if (sign)
- out_bits += values[i].rnd_downward_offset;
- else
- out_bits += values[i].rnd_upward_offset;
+ out_bits += sign ? values[i].rnd_downward_offset
+ : values[i].rnd_upward_offset;
break;
case FE_DOWNWARD:
- if (sign)
- out_bits += values[i].rnd_upward_offset;
- else
- out_bits += values[i].rnd_downward_offset;
+ out_bits += sign ? values[i].rnd_upward_offset
+ : values[i].rnd_downward_offset;
break;
case FE_TONEAREST:
out_bits += values[i].rnd_tonearest_offset;
More information about the libc-commits
mailing list