Skip to content

Make AVX types castable#26353

Open
btolsch wants to merge 5 commits intoemscripten-core:mainfrom
btolsch:main
Open

Make AVX types castable#26353
btolsch wants to merge 5 commits intoemscripten-core:mainfrom
btolsch:main

Conversation

@btolsch
Copy link

@btolsch btolsch commented Feb 27, 2026

This change makes __m256* defined as vector types (i.e. __attribute__((__vector_size(32)))) so they can be cast to each other. The implementation of all the AVX functions are unchanged, but require conversion internally to the old struct types in order to call m128 functions on each lane.

Fixes #24076, fixes #26352.

@tlively
Copy link
Member

tlively commented Feb 27, 2026

This makes sense to me.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Could you add a test for this casting? Maybe modify one of the existing tests?

__m256i __a = (__A); \
__m256i __b = (__B); \
__m256i_internal __a = __m256i_to_internal(__A); \
__m256i_internal __b = __m256i_to_internal(__B); \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you fix the alignment of the trailing \ here?

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.

AVX types (__m256{,i,d}) should be castable to each other AVX 256 functions accepting __m{128,256}i_u should accept __m{128,256}i

3 participants