<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJyllEFvmzAUxz-NuViNsB0SOHBYk3WHtddJOyETv4JXsBE2bMmn3zPJUkirTtPQw-b5Z_7-P8tQWnXMySYm8Z7En86tP3ag4Jlq4-m41oLTopDe97ocPBQF4SnGCAdv-8LpE2DGNoRnlxD3FzEuUEUboKX2VMxXCMoV-OLQdq10Lw4VwlB4DgrnmduLDsUrEErE5yn2QfC6zCvmm8DYOwSH7ybxOerBD72hi3Gy3d9sxuPjtyciLslbz1PBk9zbCzeAknX8_ktXG5NLO049yF-E7ygoveSu7udcLKk0ak7ZkhqornQBsP55oV92u7_W-Y-uZTPneGxu8LIo9qG9c1t737lghD9gVFaVtvEr21eYnfA2W_bd1F9lFqlcqExkMpKDr22fKznqMHuUxr0co6Fv8hsx7euhXB1si0nTjH-6u663P_CwY6qdGwA35CERGxZHda54ksSpSjIGbPssMpamcsNhy2BdQiqSqJElNC4nyT3h3MBPOkngM0n20f870DmPOUaccCYSHq9ECcBVyQ8yzXgmFR4_aKVuVkEn7FPU55NkOVQOYaOdd69QOqcrAzAZRode-wbyJ1xVm4p2-BMA_GJs53WrT9Jra6LJUT7Z-Q1A5TRB>53610</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Missing pattern optimization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidbolvansky
</td>
</tr>
</table>
<pre>
`
typedef int v4i32 __attribute__((vector_size(16)));
#define bit 3
int get_cmpmasks(int mask)
{
mask >>= bit;
mask &= 1;
mask = -mask;
return mask;
}`
LLVM:
get_cmpmasks(int): # @get_cmpmasks(int)
mov eax, edi
shr eax, 3
and eax, 1
neg eax
ret
GCC:
get_cmpmasks(int):
mov eax, edi
sal eax, 28
sar eax, 31
ret
https://godbolt.org/z/n71YnhKa9
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVUsFymzAQ_Rpx0cQDUsDmwKGxmxySXDvTEyMhAWpAYpCgtb--K9l1wMm0U80iafXg6b1luRHHAmUxig8o_nKe3XGQQtZYaYfne0UJLkvm3Kj45GRZIrKDmGXlzFhadZKQJRki-SXow4WMUGBRWmKuHKbLGzxzI11Z9UPP7JsFBn_k957h_Ob2woNheAQj-jXEwRNer3mHSeax5BMEju8C-RIapZtGjVfnaHu4KcbLy7dXRC_JR83BcKD7OKAAGN3Hn390lRFUmjmskv1CZI-lUGvctuMSp2uUabFEkzWqZXNFVwD4Xxp92u__6fM_VbNuiUPb3MBrU8lf5Z3n1rnBeiHkEaIxgpvObczYQHaCR2-T77p9ZnkkCipymrPIKdfJ4lVZq3SDB2hkCX_dDE716sScMjqaxq64YVaunfimMj0kXTf_We6G0fyAzocUCCcJ1XlMaZbEUVvQmrEdF7QiNU3oNq14mqdJXom8zuq6jqOOcdnZAqUPiBAtf-JAAXuUHiJVkJhAxClJaEriDeVSEsFJxXY5yZmATpI9U93G6_CWo7EIkvjUWAA7ZZ19Bxn4bbSU4TrgZ5NrzVgINitftJlp-3aMgoIiOPgNYB8f7A">