<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76605>76605</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang is suboptimal for `x / sqrt(y / z)` with fast-math
</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>
Test case:
https://godbolt.org/z/joGE9G4KM
```c
#include<math.h>
double test_sqrt1(double x, double y, double z) {
return x / sqrt(y / z);
}
double test_sqrt2(double x, double y, double z) {
return x * sqrt(z / y);
}
```
My expectation is that the output of `test_sqrt1` will be the same as `test_sqrt2`. The same transformatin is true not only for `sqrt` but also for `cbrt`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykU0tv2zwQ_DWry8ICtbQePuiQl3L4kFvuHyiKtphSoksumzi_vpBso26B9FJAkPYx2uEshipGe5iNaaG8h_IxU4lHH9pvGxWCf49Z74dT-2oio1bRgLwD8QjibmQ-xiWjDqg7-KH3jnMfDkDdJ1D35p-fds_b_17OcKjE-dGXnKSdtUuDAfkwKR7zEeTTpbe-B596Z5BN5P_j98AFUHOpfQA94CU-3cSfQDuE-h7PExCD4RRm_ECgDpchQM1pTRYoyCsS6se_UdO_Ud9dqT9X6tMX1NcN3Z7k5YTm42g0K7Z-RhuRR8XIo0Gf-JgY_R6hEjdbqgS-W-ewNyssqsmgir-BCCqR4-u1y0HNce_DpNieOUIyOHtGP7sT7n1Y_l41VAL7xKhc9Ne67td6ng2tHHZypzLTFrWQu6KsmiYb20r2lZZ1r0iretBGF01dK1WSVqIohyGzLQmSBUkhynK7bfKmL0WxbaiWNYlBSNgKMynrcud-TIvHMhtjMm1dVaLMnOqNi6t9ibRT8wGIFieHdsFv-nSIsBXORo6_JrBlZ9oVvkiOqfdHtpNyV11fmWbdL4-4V5E3i3OzFFz7x3WwPKY-134C6hbKy2dzDP7NaAbqVgURqFtF_AwAAP__rqMSAw">