<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/137998>137998</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
AArch64 backend folds fcmp+select to fminnm, causing confusion between +0.0 and -0.0
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64,
llvm:codegen,
miscompilation,
floating-point
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
regehr
</td>
</tr>
</table>
<pre>
we're lowing this:
```llvm
define float @f(float %0, float %1) {
%3 = fcmp nnan nsz ole float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
```
to:
```
_f:
fminnm s0, s0, s1
ret
```
but this appears to be incorrect for `f(0.0, -0.0)`. in the LLVM code, %3 = true, so we return 0.0. but the ARM version returns -0.0 for the same inputs.
cc @nunoplopes @arsenm @dtcxzyw
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcU0FvszgQ_TXDZRRkDAnlwIE0yun7LnvY68rYA3jX2Mg2zba_fmUHtdtKUZwZZ-bNe_MsQtCzJerhfIXzrRB7XJzvPc20-GJ06r1_EPDWExr30HbGuOgA9QBsgAt7fox5W4ENiiZtCSfjRERo2AT85Qj4mQF_xc-oAt4htFdgA6a4RqhvOMl1Q2uFRRs-0BnC7-W58KhockUgQzKirnKTbxA_AVOdp_iVahKF9vZ_IsCG6H6QAzb8NUE9YEqyblq1tSuwLmSA47t6XnqKP0qBDeMes2goto2EDxgdjoTaSud9mn5yHuGS5WJl7nfKZwcXVqK2GBfCX7_-_I3SKTqEeCoW_Z4TweGDEr3dW2QlK_GJSjj88RvfyAft7HEfcvuMmv4QxJqG2fYYyifHQcq0Prtbtxm3UUiR8IHsmn6pKP_9eH9gofpadXUnCuqrtrmwumZtVSz9NJ1FpbqWXuq2a86dvDRMTs0kKyWEGFWhe874mTU1q9qqqlg5KalE146jEjRSraBhtAptyuSs0vm50CHs1Fd123UvhREjmZAty_ko5D9kFdTDMHi5XBrgHPgrcJ5tWQ9JtJnsZ3rVQbp100ZE7b7S2RfazqfNaRtT-nwrfJ-anMZ9DtAwo0MMXzNFHQ31Byoec-DkjArZysCvhz-jw8M3_BWl2EN6SNLZac97GSk-iCwCv6bNCKvyiordm36Jccvvjd-B32cdl30spVuB3zO_53HavPubZAR-z0oF4PdDrLee_xcAAP__WEopyA">