Skip to content

Conversation

sskzakaria
Copy link
Contributor

@sskzakaria sskzakaria commented Oct 5, 2025

The following AVX[512] intrinsics are now constexpr:

  • _mm_cvtepi32_epi8
  • _mm_cvtepi32_epi16
  • _mm_cvtepi64_epi8
  • _mm_cvtepi64_epi16
  • _mm_cvtepi64_epi32
  • _mm256_cvtepi32_epi8
  • _mm256_cvtepi32_epi16
  • _mm256_cvtepi64_epi8
  • _mm256_cvtepi64_epi16
  • _mm256_cvtepi64_epi32
  • _mm256_mask_cvtepi64_epi32
  • _mm256_maskz_cvtepi64_epi32

These instrinsics coudnt be make constexpr:
_mm_mask_cvtepi32_epi16 _mm_maskz_cvtepi32_epi16
_mm_mask_cvtepi64_epi8 _mm_maskz_cvtepi64_epi8
_mm_mask_cvtepi64_epi16 _mm_maskz_cvtepi64_epi16
_mm_mask_cvtepi64_epi32 _mm_maskz_cvtepi64_epi32
_mm256_mask_cvtepi32_epi8 _mm256_maskz_cvtepi32_epi8
_mm256_mask_cvtepi32_epi16 _mm256_maskz_cvtepi32_epi16
_mm256_mask_cvtepi64_epi8 _mm256_maskz_cvtepi64_epi8
_mm256_mask_cvtepi64_epi16 _mm256_maskz_cvtepi64_epi16

Because these are not constexpr:
__builtin_ia32_pmovqw256_mask
__builtin_ia32_pmovqb256_mask
__builtin_ia32_pmovdw256_mask
__builtin_ia32_pmovdb256_mask
__builtin_ia32_pmovqd128_mask
__builtin_ia32_pmovqw128_mask
__builtin_ia32_pmovqb128_mask
__builtin_ia32_pmovdw128_mask
__builtin_ia32_pmovdb128_mask

Fixes #154539

Copy link

github-actions bot commented Oct 5, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@RKSimon RKSimon self-requested a review October 5, 2025 00:41
@RKSimon RKSimon changed the title [Headers][X86] Add constexpr support for some AVX[512] intrinsics. [Headers][X86] Add constexpr support for some AVX512 masked extension/truncation intrinsics. [Headers][X86] Add constexpr support for some AVX512 masked extension/truncation intrinsics. Oct 6, 2025
Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - cheers

@RKSimon RKSimon enabled auto-merge (squash) October 6, 2025 08:07
@RKSimon RKSimon merged commit 38896d6 into llvm:main Oct 6, 2025
9 checks passed
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 6, 2025
…/truncation intrinsics. (llvm#161984)

The following AVX[512] intrinsics are now constexpr:
* _mm_cvtepi32_epi8 
* _mm_cvtepi32_epi16
* _mm_cvtepi64_epi8
* _mm_cvtepi64_epi16
* _mm_cvtepi64_epi32
* _mm256_cvtepi32_epi8
* _mm256_cvtepi32_epi16
* _mm256_cvtepi64_epi8
* _mm256_cvtepi64_epi16
* _mm256_cvtepi64_epi32
* _mm256_mask_cvtepi64_epi32
* _mm256_maskz_cvtepi64_epi32

Fixes llvm#154539
@sskzakaria sskzakaria deleted the AVX/AVX512_Constexpr branch October 6, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Headers][X86] Allow AVX/AVX512 generic integer conversion intrinsics to be used in constexpr
2 participants