<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79126>79126</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang is suboptimal for `(~a & c) & (a | b)` when c is a specific constant
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Test case:
https://godbolt.org/z/P3Garczrf
```cpp
int foo(int a, int b)
{
return (~a & 1) & (a | b);
}
int bar(int a, int b)
{
return (~a & 1) & b;
}
int baz(int a, int b, int c)
{
return (~a & c) & (a | b);
}
int qux(int a, int b, int c)
{
return (~a & c) & b;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysU8GO2yAQ_ZrxBW0E49gOBw6bjdxrD_2BAeOYlhgXcLfNod9e4aRbqVppW2klJB6j93g8GCgld56tVdAcoTlVtOYpRPXlgWIMz6nSYfihPtmUmaFkoX4EfgL-OOW8pLLCHrA_h0EHn3chngH7K2D_sf5A0VzjeKNDy2_DLMut4ubMxhAADwUR4BMrQANKdtd0xztijLFo8xpnBnj4SQywZWJjYltKxKB72rRQH1_kpzt48dMU38FPv-FxfcXjBsw_m5n_D_d1_f6exq-m_P2K1aDqQdaSKqtEx1suRCNkNSkhydaEB9lpcSDetLIZqDZ27EiPwprKKeS45wJrgbwRcifbQbdykHy_HznHAfbcXsj5nfffLqWhKpfSalUnBbaVJ2192noV0Xiaz4BY2jaqwn_Q6znBnnuXcvqzQ3bZW7XRmUssrTos2V3IszFEViK9dfEtZ8-TnZkpemJpscaNzjAT5pRpztUavfrrT7g8rXpnwgWwL0e5Tw9LDJ-tyYD9liwB9lu4XwEAAP__T9f41g">