Issue 78964
Summary Comparison of clang and gcc for `(a + b) / pow(a - b, 5)` calculation
Labels clang
Assignees
Reporter k-arrows
    The following simulates a portion of code for a molecular dynamics application (which calculates a certain coefficient).
```cpp
#include <cmath>

double foo(double off, double cut) {
    return (off + cut) / pow(off - cut, 5);
}
```

Consider this under `-Ofast`. 
https://godbolt.org/z/d7c8s836r

Clang is not the best compared to GCC because it does not make use of `(off + cut)`, which is already calculated. I took Arm as an example, but the same is true for x86.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to