llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.68k stars 11.86k forks source link

hypot(x, y), hypotf(x, y), hypotl(x, y) are not folded at the compilation time when (x, n) is constant #113711

Open fawdlstty opened 2 hours ago

fawdlstty commented 2 hours ago

Consider the following example. https://godbolt.org/z/TfYn34Pv8

#include <cmath>

double f1() {
  return std::hypot(3.0, 4.0);
}

double f2() {
  return std::hypotf(3.0f, 4.0f);
}

double f3() {
  return std::hypotl(3.0, 4.0);
}
MouriNaruto commented 2 hours ago

I want to solve this issue and try to create the PR as soon as possible.

Kenji Mouri