<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155390>155390</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] VectorExprEvaluator::VisitCallExpr - add MMX/SSE/AVX/AVX512 AVG intrinsics to be used in constexpr
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
backend:X86,
clang:frontend,
constexpr
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
The PAVGB/PAVGW intrinsics can all be used in constexpr with suitable handling of the __builtin_ia32_pavg builtins inside VectorExprEvaluator::VisitCallExpr similar to #152540
```
_mm_avg_pu8
_mm_avg_epu8 _mm256_avg_epu8 _mm512_avg_epu8
_mm_mask_avg_epu8 _mm256_mask_avg_epu8 _mm512_mask_avg_epu8
_mm_maskz_avg_epu8 _mm256_maskz_avg_epu8 _mm512_maskz_avg_epu8
_mm_avg_pu16
_mm_avg_epu16 _mm256_avg_epu16 _mm512_avg_epu16
_mm_mask_avg_epu16 _mm256_mask_avg_epu16 _mm512_mask_avg_epu16
_mm_maskz_avg_epu16 _mm256_maskz_avg_epu16 _mm512_maskz_avg_epu16
```
These all just need to call APIntOps::avgCeilU - and the builtin types should probably be converted to unsigned.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVEFv8ygQ_TX4MkoEOLjJwQc3ravVqtpq2832ZoEhNi0GC3C2za9f2cmXJm0On2QZzRveY4aZgYegG6tUjtgtYncJH2LrfP73n8-6czYRTn7mL62Cp2LzcItoOa7_grbRaxt0HaDmFrgxIBQMQUnQFmpnQ1QfvYf_dGwhDDpyYRS03EqjbQNuC7FVUFVi0CZqW2me0qrnuwaOSIBRXirYqDo6f__R-_sdNwOPzqO0QGmx0UHHNTdm9EHQnTbcQ3SAaEoYZQuMcIEyfPxwUXVdxXdN1Q_LM0v1wxKqrqMsu7AZoSf7uL3j4f0H5wc4Ei_AM_b-Kn1_lb8_F7gIn2SX8ZPsWwIH4CyDE-M8sC_aT_R7EhcC--sK--sS-wuN84K8tCqoqXfehhDBKiXH-tUjUjz9YeNffTjUmu-atdLmH5gBt3LqnWOfQPzsVYDQusFI6L0TXJjPsRlrZ3fKx4PmYKcul_NE5qlcpSueqJzcsIziNCNp0uYpwRjfbBfbBblJCdmmTOGtEmpZc7KQ9SLROcWU4SXNCKaYpHPKCBFCkhVjdSZEhhZYdVybuTG7bu58k-gQBpUTxtIVTgwXyoRpzChtnJOw1T5EmDYhShFdI0oFr9-VlSgtXpfZCa0Ntw1Ki613No7uk-PXpI0Iu0t8Ph4-E0MT0AIbHWL4CifqaKY5X09y7O53h2sGXEp4fHxFtHx-vke0LDavhz8jFIrNw_mDEN3VtyAZvMnbGA81pSWiZaNjO4h57TpEyzHM4zLrvXtTdUS0nG4nIFoeb3GX0_8DAAD__7jykUY">