<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152321>152321</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] VectorExprEvaluator::VisitCallExpr - add x86 __builtin_ia32_select* constexpr handling
</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 following builtins need to be handled in constexpr to allow us to constexpr the avx512 predicated intrinsics:
```
X86::BI__builtin_ia32_selectb_128:
X86::BI__builtin_ia32_selectb_256:
X86::BI__builtin_ia32_selectb_512:
X86::BI__builtin_ia32_selectw_128:
X86::BI__builtin_ia32_selectw_256:
X86::BI__builtin_ia32_selectw_512:
X86::BI__builtin_ia32_selectd_128:
X86::BI__builtin_ia32_selectd_256:
X86::BI__builtin_ia32_selectd_512:
X86::BI__builtin_ia32_selectq_128:
X86::BI__builtin_ia32_selectq_256:
X86::BI__builtin_ia32_selectq_512:
X86::BI__builtin_ia32_selectph_128:
X86::BI__builtin_ia32_selectph_256:
X86::BI__builtin_ia32_selectph_512:
X86::BI__builtin_ia32_selectpbf_128:
X86::BI__builtin_ia32_selectpbf_256:
X86::BI__builtin_ia32_selectpbf_512:
X86::BI__builtin_ia32_selectps_128:
X86::BI__builtin_ia32_selectps_256:
X86::BI__builtin_ia32_selectps_512:
X86::BI__builtin_ia32_selectpd_128:
X86::BI__builtin_ia32_selectpd_256:
X86::BI__builtin_ia32_selectpd_512:
```
The expansion isn't too difficult:
https://github.com/llvm/llvm-project/blob/a9dacb10fe7db908f1305757820497de65626a46/clang/lib/CodeGen/TargetBuiltins/X86.cpp#L58-L76
https://github.com/llvm/llvm-project/blob/a9dacb10fe7db908f1305757820497de65626a46/clang/lib/CodeGen/TargetBuiltins/X86.cpp#L210-L222
ExprConstant.cpp already has precedent for handling target specific builtins (the x86 BMI intrinsics), so hopefully this isn't controversial.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMlc9u4zYQxp-GuhAxpJEoyQcdFGddLJpe2sVibwb_SmwZUiEpx3n7gnK860MP4a2AAQucGeKHmeH30RD0ZKUcEHlE5Kmga5ydH_78_S_94mzBnHgfvs0SK2eMe9N2wmzVJmobsJVS4Ogwk3imVhgpsLaYOxuivCw-hWgqwmtI33eBWWJ6vpAK8OKl0JzGrTZ6bYPmAdUjKkfUlh-_csQ_-jad1uPj19Ppg-CkaQ2nII3kkZ0q6K91n8gF0n46l1Twydy3DIa3DIa3DAaRwSAyGEQGw2sGw2sGw2sGwzJnQCxzBsUy52AwlcPBVA4IUzkkIQck5HCEHIycBV1yNnS5W9F76UDlmPRLXhZqg3YW62ARdBFH57DQSmm-mojqEV-T5xiXTYHgiOA46TivbMfdC4KjMefb38Pi3d-SRwRHZhxDcKR7QTmrSiU7wfZlr6q6JB3peiibfSdkS1poadMiOHJD7ZQu0qnw4IT8TVoEx2_UTzI-fugrguOPvt3xZUFQP5P-4blr_798UJUPzwBwbeKXy-IPSe-pjSkDU-MlFe94piFpPpdC2oiV81frSL4St9txWCTXSvNfPoOgT45x6Vv8-MfXe5-APYIDDg7PbpFqNeYdx1mHnyPmzkbvztIHTc0OF2Koxb7e00IOVUeaZl8TIMU8KFWLGqhU1b6jJanLHlhPKuCsB0E7WugBSiBlX7YVqfqm2TUtNG1VNbUSraiUQE0pX6g2u9T8nfNToUNY5VARqKEqDGXShM1jASbnBFbah4i3JASA4IAAGOX_SCtQPaZlv51ep1GPyjsbU_hn4Gao6YQ8FX7YJs_WKaCmNDrE8Asn6mg2kz9s15En_F3y6Hya1JczNSuNzl8f2HcddDxQY1IMP2AqxNb8_3x2CMY7Z78Ns1i9GbI3detG2quPrp0H-DcAAP__7r-0sA">