Skip to content

Conversation

@programmerjake
Copy link
Member

@programmerjake programmerjake commented Jun 6, 2022

This fixes poor codegen in some circumstances for u16x8::splat on x86_64
https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/Very.20bad.20.60u16x8.3A.3Asplat.60.20codegen.20on.20x86_64

This changes splat to not be const since that now depends on const traits.

This is a workaround for: rust-lang/rust#97804

Fixes: #283

@calebzulawski
Copy link
Member

Regarding the workaround comment, IMO this is still a better way of representing a splat. This is explicitly a vector operation, the other implementation was relying on auto vectorization.

Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

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

🎉

@thomcc
Copy link
Member

thomcc commented Jun 7, 2022

I agree this is totally a reasonable/natural impl. I don't really think it's a workaround -- while it's unfortunate that [T; N] isn't always vectorized, it's better to not rely on that to happen.

@calebzulawski calebzulawski merged commit 0f6399b into rust-lang:master Jun 22, 2022
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.

Very bad u16x8::splat codegen on x86_64

3 participants