<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94230>94230</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Canonicalize how we create masks given number of set bits we want?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AtariDreams
</td>
</tr>
</table>
<pre>
I would like to start a discourse because I have been thinking about this and I noticed that it isn’t a solved problem.
But I also don’t know if it’s worth solving:
Many transforms don’t recognize all the various ways masks can be formed.
There’s the lshr -1, X: there’s 2 << X - 1 or 1 << (X + 1) - 1.
And I was thinking, should there be a canonicalization for the creation of a mask given how many bits set to 1 it should have?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxckk2PqzwMhX9N2FitINAPFiw6nbdSF-_uLmZriAu5DckoNkWdX38V2vnQrBBOfHz8nCCz7T1RozYvavOa4SRDiM1BMNrXSDhy1gZzb84wh8kZcPZKIAFYMAogGMtdmCITtNThxARnGPCWfsmDDNZfre8B2zBJ-mVAb-AMPojtyIAMKGAFLHv1n1b7XNV10uXgbmTgPYbW0bhW-UHlh5dJ4AzoOIAJP-9ffZjBXsDKV5FhDlGGRcj6XpUHeIj8j_4OEtHzJcSRfylF6kLv7QcBOgcyENww2jAxzHhnGJGvDB16aAlSP5n1U_fPQJF-jE-9jocIq0LpI7wlB_LrjgZVHlV5hDdYQQEhQvFZUXr_Bkq_QKF0nU4_5xwWfjPyF90kz8MSzzIgecNkMnjbobMfKDb4ZHcx1UV6FMIFcNkIensjD0OYYUx0WisMTJKCLlI6T_UUrCpPmWlKU5c1ZtQUu2JX6W1e7bKh2ZZIersxVZkXpIla2puqy_eEuLnsKpPZRue6yrd5WVTVTm_WtN90xuyIKsRuX19UldOI1q2du43rEPvMMk_U1JUu88xhS46Xp6q1pxmWQ6V1ermxST2rdupZVbmzLPytIlYcNcdvJLRsOz9p0DPYBwc_jS3FhCcxWGDMBDN6SctP0TWDyDur8qD0SelTb2WY2nUXRqVPaeTzs3qP4S91ovRpMcpKnx6L3Br9LwAA__8T7h8M">