<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155674>155674</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Arm64 Optimization: (x & m) & n may be better optimized with m and n constants that can be embedded in and instructions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mcfi
</td>
</tr>
</table>
<pre>
Please see https://godbolt.org/z/KExP3cj8h for an example. If m and n are both constants that can be embedded in Arm64 and instructions, it might be better to emit two and instructions instead of combining the two constants. In practice, there might be complications. For example, if the constant combination can be hoisted outside of a loop and there's no register pressure, then it could be better to do combine the constants outside of the loop and do only one and inside the loop. However, in other cases, having two and instructions is better having three.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEU81upDwQfBpzaQXNGJhhDhzy_aAv-g6bVzB2Mziy3chuZpI8_QpnyN-utCewXN1V1V1WKdlzQOxE85do_inUwhPFzuvRFgOZl-7RoUoICREm5jmJ6l7IXsj-TGYgxyXFs5D9q5D9__8-P1b6qZ1gpAgqAD4rPzss4WEEDyoYCKAiwkA8gaaQWAVOwJNi0CrAgIB-QGPQgA1wH_2hzmU2JI6LZkshCfk3WAZvzxOvFQMyYwQmQG8Z-Eq_lOQDKgM0giY_2GDDGXjCjH4XUsJDgDkqzVbjSsMTRvxg0uRnZ7XKPUvoKW4Os6Yxd9y63YgyeDM3kU2MBmjhZA2uchQ4ojkrzmxCHhMEgojnFRthjpjSEjc9YfWuaXHmq3dDN0L8oiJ95lov3tkMAQX3AhRwm9cK2zAl_EdXvGDM1gLQqg60SpgXMKlLHuFvh502XRtqiohlYbrKnKqTKrDbH5tDtT8ddk0xdS3uGmzxdNI4Nm0jx2Z_rOvxUGtZ66OqC9vJnWx2rTzu26qSTdk27e7Q1HUz1voozUnUO_TKutK5i18DWdiUFuz2TXM41oVTA7qUEy5lwCvkWyHlGvjYrUV3w3JOot45mzh9tGHLDru3HP6Y2Xr7mhcqqnsQsn0GIQ_ghTzlnwBevXxaC71VoIGr5en9Bfw5-N9HWizRdd9en-VpGUpNXsh-1Xv73M2RnlCzkH12mYTsb2O4dPJnAAAA__-dn1iU">