<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/86096>86096</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [X86] _mm_sqrt_ps() generates odd rsqrtps with fast-math
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:X86
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tru
      </td>
    </tr>
</table>

<pre>
    We have some highly tuned math code that's using a lot of intrinsic in one of our code-bases and when we started to convert this code base to Clang we noticed that with fast-math enabled it generates some odd ASM on X86 at times.

The following example shows that:

https://godbolt.org/z/TfoTPbqY1

Giving clang the benefit of the doubt we benchmarked these functions and the one generated by clang is much slower. Only clang generates this construct as well, neither GCC nor MSVC.

Is there a reason for this or is this a bug in the DAG? @RKSimon @phoebewang @nikic 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU01v4zYQ_TXUZRCDpuWvgw6uAwdFsWjRBO32FPBjJLKhSC9nFDX99QXlLDbNRaI4bz7e0xtNFIaE2IntT2J73-iJfS4dl6kx2b11fyJ4_YpAeUTwYfDxDXhK6GDU7MFmh8Bes1B7golCGkBDzAy5h5C4hETBQkiQE9a7PJUl6c5oQgKdHMweE8wIxLowOuAMNqdXLAzsA916VHiNnKNOQ0WnzMFWtNcMc2APvSa-W6bCpE1EB4FhwIRFM9KNQXYOTo9fICf4etiBZuAwIq2EvBfydHs-eYQ-x5jnygb_0eM1IpDPM92obk4f4Z75SvVOXYS6DNmZHHmVyyDU5V-hLk99fvrNfPtr_THpIbzW4nZhwx7BYMI-LLLVT5cnw5WmwWT9qMvLQhUJoZ-S5ZDTTbwKrtJ-5-nAvL2XDQTjZD1QzDOWFfya4vfQD1XeFU7EZbIMmmDGGIU6Q8LAHgs8nM-QcoEvj3-c_6fTzzUbC4KGgppygj6XW8FcavflqMFMQzVAnfT-9CA2FxCt_P2XxzDmVI9Xn9HgXOcSrUzhJVhoXLdxx81RN9it9-u1lDt1aBvfWSfNVq6PaI7y4Fq131nc7-223fatOchjEzolVSs3ai33m7VqV4f1XmvX7o5qJ_u9RNFKHHWIqxhfx_qfmkA0YXfYyeOuidpgpGUblDLavmByYnP6etgJpeqClK7m3ZlpINHKGIjpRyUOHJdVqvjtPTyP4zN9K_x8JaEOQh0_KF-tWGrwSp_820wldp9sFdhPZmXzKNSltnt_3V1L_hstC3VZWJBQl4XIfwEAAP__J75HIQ">