[clang] [clang] constexpr built-in fma function. (PR #113020)
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 17:41:40 PDT 2024
hubert-reinterpretcast wrote:
A problem with the current patch is that it does not evaluate, even in constant expression contexts, cases that require rounding:
```cpp
extern constexpr float onepluszeroeps = __builtin_fmaf(__FLT_EPSILON__, .0f, 1.f);
extern constexpr float oneplushalfeps = __builtin_fmaf(__FLT_EPSILON__, .5f, 1.f);
```
```
<stdin>:2:24: error: constexpr variable 'oneplushalfeps' must be initialized by a constant expression
2 | extern constexpr float oneplushalfeps = __builtin_fmaf(__FLT_EPSILON__, .5f, 1.f);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
https://github.com/llvm/llvm-project/pull/113020
More information about the cfe-commits
mailing list