<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/78964>78964</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Comparison of clang and gcc for `(a + b) / pow(a - b, 5)` calculation
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkU82OtDYQfBpzaQ0CMzDDgcMuG6KccskLtO1mcNbQyD-Zb_P0ET_aL7ufhACXy011dYEh2MdC1In6VdRvGaY4se_eL-g9P0Om2Hx0f00EIzvHT7s8INg5OYwUAGFlHy0vwCNoNhvLA8LMjnRy6MF8LDhbHQDX1VmNO1nI-3OyegKNTn-W0uQj2gU00zhabWmJQra5KN5E8SKa4rj0up6IrOyiXTIEour1jHES1W_n3n43nJTbJLGQ93PB4yhkD-dKp-0TIG6vxwkAAE8x-V0jjyMI-frJkgOs_Dw3LgfcQy1kK6qzgLi9fdP7f0E9L8Ea8hAnGyAt26toisufI4YomiKHgzfFuAZRvQg5CDk82Ch2MWf_EHL4V8jB3PQ93KvGfynucHmADbBwhDgRKAoRNM8rejIQGX7ve1CkMQUCG8EwHeQZ3wk2kMdNzi-d71gPx8hsAHSe0Hz8nJ7J4Q-IzO_w4mfAALgA_cB5dbQdVOkQFHCm7Xz06QjKj3uTZ6arTFu1mFFX3oq6lXXTltnUGVU0pq1bVZSmRSqvoymVItJjXTVUycx2spDXopSylOX1es9lq5XEpjCjuZmbrMW1oBmty537Z97sy2wIibrbvW2umUNFLuyxl1Jv5gkptz_Adxv_otIjiGvhbIjhZ4Voo6Ou31214Qz-7jwuBh5a740dLuLuofqaHYTLBp25aYpPFy0vWfKu-zZ8G6ekcs2zkMOm4nxcVs9_k45CDntTQchh7-u_AAAA___NAy8s">