<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59299>59299</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstSimplify] reduce and/or of fcmps with common operand and constants
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rotateright
</td>
</tr>
</table>
<pre>
Noticed while looking at https://reviews.llvm.org/D139130 (that handles some cases with special constants):
We don't have simplifications (always true or always false) for floating-point compare patterns like this:
```ll
; (x < 1.0) && (x > 2.0) --> false
define i1 @src(half %x) {
%cmp1 = fcmp olt half %x, 1.0
%cmp2 = fcmp ogt half %x, 2.0
%r = and i1 %cmp1, %cmp2
ret i1 %r
}
define i1 @tgt(half %x) {
ret i1 false
}
```
```ll
; (x == 1.0) && (x == 2.0) --> false
define i1 @src(half %x) {
%cmp1 = fcmp oeq half %x, 1.0
%cmp2 = fcmp oeq half %x, 2.0
%r = and i1 %cmp1, %cmp2
ret i1 %r
}
define i1 @tgt(half %x) {
ret i1 false
}
```
```ll
; (x != 1.0) || (x != 2.0) --> true
define i1 @src(half %x) {
%cmp1 = fcmp une half %x, 1.0
%cmp2 = fcmp une half %x, 2.0
%or = or i1 %cmp1, %cmp2
ret i1 %or
}
define i1 @tgt(half %x) {
ret i1 true
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlclu2zwQx5-GugxsSKPF1kGHJP4MfJdeeuiZokYSG4pUSSpO3r6gpDh2UrTpBhTwAs38Z_uZHnLnZKeJKpbfsvwQ8cn3xlbWeO7Jyq73UW2ap-qD8VJQA6deKgJlzL3UHXAPvfejY-kNwyPDo6UHSSe3Veph2BrbMTwekrRM0hgY7n0fArhuFDlwZiAQ3JGDk_Q9uJGE5AqE0c5z7R3DMuSNDyy--UTQGM1wF-IfCJwcRiVbKbiXRruQnKsTf3Lg7URgLKyPLVeOGJbQGgutMtxL3W1GI7UHYYaRW4KRe09WO1DynsD30p3rrp9FvLyUWg3pbSj5CCy9g2QbhwIMC4bFs_k_wMW82YSHpY05tqFWagKZAMtiZwXDfc9VCwzzxznP7nYRQjCJYUyApQdoxTCCUWH-s3ipfSXGC3H3SoxXYjsruW7mVpZKQbXmWZWW_Oq36-i7wyWaq2l8578zzZrqAsVLrmfAP-Z9CF1_E_ns-SvU6ctPUH8t_hXq_xx2TC6x7-7Y7u7Kc4U9_AV_n_qk6f3U34ivqZsFu7HvPOvmT1F_QfEWetRUaVOmJY-oSoqiLPcllknUV6lI0kzsRR6nLS_yIq6ztm6bPCvqTNRNHMkKY8QEY0zSPMuTbSY4Jk2dFjtRJ_tdzbKYBi7VeQ9H0rmJqrzEsowUr0m5eeMjajrB7GSI4QKwVYjZ1FPnWBYr6fzLNo-89Gq-Kv7Xzn9cdvATyw9gqZkEhXPN8GgsmHb-XdbVLswwGA1mJBtOfnift3w0WVVdXyKd9P1Ub4UZGB5D7fVrM1rzmYRneJw7dgyP80RfAwAA__-ug9-4">