Open k-arrows opened 7 months ago
Clang is not the best compared to GCC because it does not make use of
(off + cut)
, which is already calculated.
Maybe my wording was not good. When calculating a / b
, it seems that clang calculates this as (1 / b) * a
, even though a
and b
are already prepared.
If pow(off - cut, 5)
in the program is rewritten as ((off - cut) * (off - cut) * (off - cut) * (off - cut) * (off - cut))
, the suboptimality cannot be observed. So I think the problem is in the handling of pow()
.
The following simulates a portion of code for a molecular dynamics application (which calculates a certain coefficient).
Consider this under
-Ofast
. https://godbolt.org/z/d7c8s836rClang 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.