'std::pow(x, 2) vs x * x assembly difference for integer arguments with GCC/Clang -O3
For float arguments, fully optimized GCC/Clang assembly code is the same for std::pow(x,2) and x*x. However, for int arguments, there is a difference in the assembly. What is the reason for this extra assembly for int std::pow specification? My code does milions of such operations, so does it make sense to replace all std::pow(x,2) where x is int with x*x for performance reasons?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
