<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121776>121776</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstCombine] Commuted pattern is not handled
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:instcombine,
missed-optimization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
dtcxzyw
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/eoWKGs8h3
```
define i1 @test4a0(i32 %a) {
%l = ashr i32 %a, 31
%na = sub i32 0, %a
%r = lshr i32 %na, 31
%signum = or i32 %l, %r
%c = icmp slt i32 %signum, 1
ret i1 %c
}
define i1 @test4a1(i32 %a) {
%l = ashr i32 %a, 31
%na = sub i32 0, %a
%r = lshr i32 %na, 31
%signum = or i32 %r, %l
%c = icmp slt i32 %signum, 1
ret i1 %c
}
```
```
define i1 @test4a0(i32 %a) {
%c = icmp slt i32 %a, 1
ret i1 %c
}
define i1 @test4a1(i32 %a) {
%l = ashr i32 %a, 31
%na = sub i32 0, %a
%r = lshr i32 %na, 31
%signum = or i32 %r, %l
%c = icmp slt i32 %signum, 1
ret i1 %c
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMlNGOmzwQhZ9muLES2eMA4YKLbCJ-_eoD9NpgJ7gyOLKHbTdPX9lLuqtVpKq9qFZCRjCfz3A84qgY7WU2poXyCRA1DT9uL98BEcpToRYafWjXl0Xv9Us7El0jyANgB9hdvO69o60PF8DuBtgZ__XLf3E_SuAHqPh68YM2ZzsbZgWDHScTaac44N5KZIClAmwY1E_ADyw9OwbyxFQcA3sjjkyKOzCrTMSlzwBP1Uyt9ZDL7p3A_EEh-V6mjPlfkFt1wp0aMmCH6cqiozv2ujexWS4YysawHJLr-pTWh5bF57McVh33R5Yfe34377-f_eP-6jetP9lx_8vTLnQrdSMbVZhW1LISdVqKsTVYyXNV7lHuSlHu65pXZ6kq2WjenBvRFLZFjiUXvBIlNqLZ8rLfc6GNqrjhQirYcTMp67bOPU_pLy9sjItpBYq6rgqneuPimh0JAXmwc6TBT72dTYoRPALiZGM0euOvZCd7U2T9vEZMaNO2Tb9cIuy4s5HiWy-y5HIy_T9HOq6a5Ykd_TQtZDS7KiITZmYjmz2xUc3aGV0swX3MKUvj0m8HPwF2-UNfb5tr8N_MQIBdNhYBu9Xbc4s_AwAA___lsGIB">