Skip to content

[Headers][X86] Allow vector bitcast intrinsics to be used in constexpr #156348

@RKSimon

Description

@RKSimon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:X86clang:headersHeaders provided by Clang, e.g. for intrinsicsconstexprAnything related to constant evaluationgood first issuehttps://github.com/llvm/llvm-project/contribute

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions