Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add simd shuffle / swizzle aliases for i16x8, i32x4, i64x2, f32x4 and f64x2 #2368

Merged
merged 8 commits into from
Aug 15, 2022

Conversation

MaxGraey
Copy link
Member

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file
Page not found · GitHub · GitHub
Skip to content
404 “This is not the web page you are looking for”
@dcodeIO
Copy link
Member

dcodeIO commented Jul 19, 2022

Are these instructions planned in Wasm? Otherwise it seems that these should not look like instructions but using the generic variant is preferred.

@MaxGraey
Copy link
Member Author

No, it's just aliases. At the very least for shuffle I see no reason to have only the generic version, as it violates the general conventions. That is, I see no reason why we should only write v128.shuffle(....) instead of i16x8.shuffle but still have i8x16.shuffle available as alias v128.shuffle(...). This looks very inconsistent.

@dcodeIO
Copy link
Member

dcodeIO commented Jul 19, 2022

I believe i8x16.shuffle is the (only) instruction existing in Wasm, motivating the generic variant (that also provides convenient fillers), while there is no i16x8.shuffle in Wasm. Thought the convention is rather not to add instructions that aren't already there respectively planned hmm.

@MaxGraey
Copy link
Member Author

MaxGraey commented Jul 31, 2022

Well, in Wasm SIMD we have only one i8x16.shuffle but we have generic wrapper for specific scalar type. The main problem with generic wrapper is imprecise size of arguments (which is variable). Specialized aliases restrict signatures to a specific number of arguments, which provide much better experience. Also, code will look much more uniform and easier for refactoring. For example if user used i8x16.shuffle at first time and decided switched to i16x8 he needs refactor it to v128.shuffle<u16> instead i16x8.shuffle which may confused especially for first time

@MaxGraey MaxGraey merged commit e8ed2dd into AssemblyScript:main Aug 15, 2022
@MaxGraey MaxGraey deleted the simd-shuffle-aliases branch August 15, 2022 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants