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

Give i32x4 a From impl that uses _mm_set1_epi32 #23

Open
mooman219 opened this issue Jan 26, 2020 · 1 comment
Open

Give i32x4 a From impl that uses _mm_set1_epi32 #23

mooman219 opened this issue Jan 26, 2020 · 1 comment
Assignees

Comments

@mooman219
Copy link

The impl From<i32> for i32x4 uses new(i32, i32, i32, i32) always. There's an intrinsic to not do that.

impl From<i32> for i32x4 {
  #[inline]
  #[must_use]
  fn from(i: i32) -> Self {
   magic( _mm_set1_epi32(i))
  }
}
@Lokathor
Copy link
Owner

@mooman219 Thinking about it some more, I don't think this makes a performance difference either way, but if you can show some benchmarks or something then that's cool.

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

No branches or pull requests

2 participants