[compiler-rt] 781424c - [compiler-rt] Fix a warning
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 12:16:48 PDT 2023
Author: Kazu Hirata
Date: 2023-10-18T12:16:41-07:00
New Revision: 781424c87273f51067790d6cc07973de8278f7b0
URL: https://github.com/llvm/llvm-project/commit/781424c87273f51067790d6cc07973de8278f7b0
DIFF: https://github.com/llvm/llvm-project/commit/781424c87273f51067790d6cc07973de8278f7b0.diff
LOG: [compiler-rt] Fix a warning
This patch fixes:
compiler-rt/lib/builtins/int_to_fp_impl.inc:36:10: error: expression
is not an integer constant expression; folding it to a constant is a
GNU extension [-Werror,-Wgnu-folding-constant]
Added:
Modified:
compiler-rt/lib/builtins/int_to_fp_impl.inc
Removed:
################################################################################
diff --git a/compiler-rt/lib/builtins/int_to_fp_impl.inc b/compiler-rt/lib/builtins/int_to_fp_impl.inc
index c49f2c9607ec153..263ae85d3283ca0 100644
--- a/compiler-rt/lib/builtins/int_to_fp_impl.inc
+++ b/compiler-rt/lib/builtins/int_to_fp_impl.inc
@@ -32,16 +32,14 @@ static __inline dst_t __floatXiYf__(src_t a) {
// P = bit dstMantDig-1 bits to the right of 1
// Q = bit dstMantDig bits to the right of 1
// R = "or" of all bits to the right of Q
- switch (sd) {
- case dstMantDig + 1:
+ if (sd == dstMantDig + 1) {
a <<= 1;
- break;
- case dstMantDig + 2:
- break;
- default:
+ } else if (sd == dstMantDig + 2) {
+ // Do nothing.
+ } else {
a = ((usrc_t)a >> (sd - (dstMantDig + 2))) |
((a & ((usrc_t)(-1) >> ((srcBits + dstMantDig + 2) - sd))) != 0);
- };
+ }
// finish:
a |= (a & 4) != 0; // Or P into R
++a; // round - this step may add a significant bit
More information about the llvm-commits
mailing list