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

simd sse2: si128/pd casts emitting conversions #55249

Closed
kazcw opened this issue Oct 21, 2018 · 2 comments · Fixed by rust-lang/stdarch#581
Closed

simd sse2: si128/pd casts emitting conversions #55249

kazcw opened this issue Oct 21, 2018 · 2 comments · Fixed by rust-lang/stdarch#581
Labels
A-simd Area: SIMD (Single Instruction Multiple Data)

Comments

@kazcw
Copy link

kazcw commented Oct 21, 2018

_mm_castsi128_pd and _mm_castpd_si128 should be no-op transmutes (as the corresponding intrinsics are in C), but they're emitting some kind of conversion involving cvtsi2sdq and cvttsd2si (respectively) that gives the wrong result. As a workaround I'm currently using mem::transmute to cast between __m128i and __m128d.

Documentation that these casts shouldn't do any conversion: https://msdn.microsoft.com/en-us/library/bb531385(v=vs.120).aspx

Demo of output with conversions: https://rust.godbolt.org/z/p1zG4C

(pinging simd tracker: #27731).

@Centril Centril added the A-simd Area: SIMD (Single Instruction Multiple Data) label Oct 22, 2018
@alexcrichton
Copy link
Member

alexcrichton commented Oct 22, 2018

Thanks for the report! On inspection I wonder if the implementation in stdsimd is simply not right for these intrinsics? It should likely be a simple fix for them in theory!

@kazcw
Copy link
Author

kazcw commented Oct 23, 2018

My first libstd PR!

pietroalbini added a commit to pietroalbini/rust that referenced this issue Oct 23, 2018
kennytm added a commit to kennytm/rust that referenced this issue Oct 25, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this issue Oct 25, 2018
marysaka pushed a commit to sunriseos/rust that referenced this issue Oct 20, 2019
* fix _mm_castsi128_pd and _mm_castpd_si128 impls

The _mm_castX_Y SSE intrinsics are "reinterpreting" casts; LLVM's
simd_cast is a "converting" cast. Replace simd_cast with mem::transmute.
Fixes rust-lang#55249

* Temporarily pin CI

* Fix i686 segfaults

* Fix wasm CI

Output of `wasm2wat` has changed!

* Fix AppVeyor with an older nightly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-simd Area: SIMD (Single Instruction Multiple Data)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants