<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/156348>156348</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Headers][X86] Allow vector bitcast intrinsics to be used in constexpr
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            good first issue,
            backend:X86,
            clang:headers,
            constexpr
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          RKSimon
      </td>
    </tr>
</table>

<pre>
    Vector bitcast (and implicit truncation) cast intrinsics can all be used in constexpr.
```
_mm256_castpd_ps     _mm256_castps_pd
_mm512_castpd_ps _mm512_castps_pd
_mm256_castpd_si256 _mm256_castps_si256
_mm512_castpd_si512 _mm512_castps_si512
_mm256_castsi256_pd _mm512_castsi512_pd
_mm256_castsi256_ps _mm512_castsi512_ps

_mm256_castpd256_pd128
_mm512_castpd512_pd128
_mm512_castpd512_pd256

_mm256_castps256_ps128
_mm512_castps512_ps128
_mm512_castps512_ps256
_mm256_castsi256_si128
_mm512_castsi512_si128
_mm512_castsi512_si256

_mm_castpd_ph _mm256_castpd_ph _mm512_castpd_ph
_mm_castph_pd _mm256_castph_pd _mm512_castph_pd
_mm_castph_ps _mm256_castph_ps _mm512_castph_ps
_mm_castps_ph _mm256_castps_ph _mm512_castps_ph

_mm_castph_si128 _mm256_castph_si256 _mm512_castph_si512
_mm_castsi128_ph _mm256_castsi256_ph _mm512_castsi512_ph

_mm256_castph256_ph128
_mm512_castph512_ph128
_mm512_castph512_ph256
```
Some of these might already have been done to support other constexpr intrinsics.

I may have missed some intrinsics in this category.....

NOTE the vector "any extension" casts (e.g. _mm256_castpd128_pd256) will have to stay non-constexpr for now as we can't use safely use __builtin_nondeterministic_value in constexpr.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VV2PqzYQ_TXmZbQROJgkDzzkdhu1qtRKvVXVN2Rggt0aGzEmu_n3lYFNCNm9aKWNxjNzznz4WBLpxiLmTHxj4jWSg1euz__87btunY1KV1_zv7HyrodS-0qSB8b30tag287oSnvw_WAr6bWzjB9gdNHW99qSrggqaUEaAyXCQFiDtlA5Sx7fu37D4iPL4vkvPhZty0VWhBRdXXQE4VsaqejqyU8kfOG3NNx9FrlIc5GtUo22p2ykRcJXCUfbY84xuOjqpefo9oQ-e9InnhTqX1Gd0iZ8v2Y25f7yYKpllY0m6OcgmvC_PLh15rEK0k8RUyk_OFgSu41MwWrWClZDVcsINXf6FqFWrR8NqwhaR9A6gpYRtGZFa1Y0sXqEGStfId22bQG22KG5PQnfryDnVVGfrIp6Hq6anJ9nqKaILw_miSwu3nfXIrgzeIWE0OpGeZCmR1lfQckLQolooXYWwTugoetc78F5hf39Ni9u_WZi-yu0ck7Qagq3nwLQQh20Ba90UAmPjeuvm_BNwb__8dfPgRBcJvlhnEt7BXz3aGkUGz6KDQVBwk2zeVypsbvjreAHeNPGTDwCfS-vYJ19uTM_ux6sewNJ8IZBshjf-aBXQPKM5jr-LIpy0MZrW1hna_TYt9pq8roqLtIM-ChtUZ1v68P2ICPMk53Idmki4l2kci4wPpzjMpH8wNOsrrNstytFJsoUpdgmkc55zEV8iJNEpCLONvsqRVHuM0zEoarShKUxtlKbjTGXduP6JtJEA-aJyLbpPjKyREOjoHPeOFfDWfdBlIMT45zxnxjnpaz-Q1uz7fGffXazVkbahm2PCmWNPd3tH3UFi3iN-jxgv5RDQyyNjSZPdzZeezM-KL_MWcQrE98CjHiFozHu7WOmH0_KYiO8-_SpiIbe5Mr7jtj2yPiJ8VOjvRrKTeVaxk8BfP730vXuX6w846exZGL8NLfmkvP_AwAA__8vPEtx">