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

    <tr>
        <th>Summary</th>
        <td>
            Compile time evaluation doesn't match runtime evaluation with -ffp-contract=on
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Hey LLVM team,

I found out [a while ago](https://github.com/llvm/llvm-project/issues/93870) that when `-ffp-contract=on` the compile time evaluation mismatch the runtime one for some expressions, but I identified that too late to get any traction. Next are some godbolt examples for repro:
- results mismatch with ` -O1 -ffp-contract=on`: https://godbolt.org/z/3qTda8KP9
- results match with ` -O1 -ffp-contract=on -mfma`: https://godbolt.org/z/vjjoP35W8
- results match with `-O1 -ffp-contract=off`: https://godbolt.org/z/6q1vfbWbT
- results match with `-O1 -ffp-contract=fast`: https://godbolt.org/z/e7Ms55xv1

I think the expected result should be that these two evaluations match all the time, and it seems that the compile time evaluation always use fma even when it is not forced with -mfma. I still don't get what's the exact difference between ffp-contract and mfma but it might something to look into.

Thank you 🙏


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklE1z3DYPxz8NdcHsjpZ6P-jg2KN5PE_S5uBpzpQESrQpYiNC-9JP3xFlN9sm6bjTy-6BEH7AH39AeW8Gh1iL7IPIHiK18Ehz3epZteRM1FJ_rf-HV_j48bdPwKgmIe9F_CDiu-33ETQtrgdaGET2QcF5NBZBDSSyByHLkfnoRXInZCNkMxgel3bf0SRkY-3p7W93nOkZOxayMd4v6IVsqqQsYiEr4FExnEd0IPJ4p_Vx15HjWXUskgdyIo-BR4SOpuOKZjMh4EnZRbEhB5Pxk-JuDEHz4sI7OQRNM3hagy_HGb035LyQ99AuDI9genRstMF-K4CJwCpGYIIBGZS7QijCkNvDL3hhUDNuCQfqW7IMeFHT0aIPqBmPM61KBN12MKNfLPtv9Z0Nj2uLsPv1AD_sUyR38DdBN9Ke5kHI5nchm-TrU6_K_3-uvuO8BwK7SU_qnajT8zN9TrIv5T-jfkjS-p2Q_OvhpNsv7dO_h2jl-Z0ULD75LLucDn_1No_GvQTj4OWIHWP_igc_0mJ7aPHVHSN6BD7TjfPeSlTWhhSr8VZ_KdeDYfCIk__z65_aV9mzunpYPIKeFOAJ3bYMhsF4cMSruzrsNynC_PbwCJ6NtdCTE7Lg4NjzqFjIwr_2ozqG3miNM7oOoUU-Izq41TCUuiYMO2EYJjOMHDy-KjOsu2CJXsA4pv2tdE-jci9wpQVEE4uqEVUlyuY2IurrpK-SSkVYHwoZZ2lRJFk01olOVVUcZJ7qrMqLg87yNK6KEnWeVTpNI1PLWKZxEVeHIsuSbF_JWGddGZd5XOSZ1iKNcVLG7tfTsg45CkelrspDVURWtWh9OHhSOjxDeBRSrvdvrsM5apfBizS2xrP_loUNW6zvfzKontBvYm9jfzs1NyHbhL5bumiZbf0fDmVo61TLPwIAAP__LbLnwg">