[PATCH] D134136: [Clang] Support constexpr for builtin fmax, fmin, ilogb, logb, scalbn

Evgeny Shulgin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 18 07:35:24 PDT 2022


Izaron added inline comments.


================
Comment at: clang/test/Sema/constant-builtins-math.cpp:16-17
+
+// TODO: investigate why this is `INT_MIN + 1` instead of `INT_MIN`
+static_assert(__builtin_ilogb(0.0) == -2147483647);
+static_assert(__builtin_ilogb(__builtin_inf()) == 2147483647);
----------------
runtime version of `__builtin_ilogb/std::ilogb` returns `INT_MIN` (`-2147483647`) on this argument, while constexpr version returns `INT_MIN+1` 🤔 

This constant is here:
https://llvm.org/doxygen/APFloat_8cpp_source.html#l04187
https://llvm.org/doxygen/APFloat_8h_source.html#l00229
(I guess we shouldn't change this)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134136/new/

https://reviews.llvm.org/D134136



More information about the llvm-commits mailing list