3 Commits

Author SHA1 Message Date
nicole mazzuca
51835dfadb
[MSVC] fix the build (#69634)
MSVC in C mode apparently doesn't consider `const int` to be
sufficiently constant expression

This was broken in #66903.
2023-10-20 14:43:18 -07:00
Kazu Hirata
781424c872 [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]
2023-10-18 12:16:41 -07:00
Alex Bradbury
6dfea561ba
[builtins] Start to refactor int to fp conversion functions to use a common implementation (#66903)
After this patch, the softfp implementations of floatdidf and floatundidf
use a common implementation (int_to_fp.h and int_to_fp_impl.inc). This
roughly follows the pattern used for a wide range of other builtins,
e.g. fp_trunc_impl.inc.

Currently there is substantial copy and paste for the various int to fp
conversion functions, with just a few constants being changed. This is a
barrier to maintainability, and it's also not attractive to copy this
approach as we introduce additional int to fp conversion functions for
bf16 and half (which we currently lack, but need - see
<https://reviews.llvm.org/D157509>).

I've opted to conservatively start by replacing just two functions,
leaving a follow-up patch to replace others that follow the same
pattern. Also, for better or worse I've left the logic in float[un]didf
largely unchanged other than using a similar approach to
fp_trunc_impl.inc to remove the constants that are tied to a specific
output floating point format.
2023-10-15 16:14:55 +01:00