-
Notifications
You must be signed in to change notification settings - Fork 278
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
Casting and width promotion #151
Comments
I think it personally makes sense to have all these casts. For any source/target pair I think the we can pretty easily define the semantics of the cast, right? If there's the same number of lanes then the elements are converted lane-wise and otherwise the bit sizes are the same and it's effectively a transmute, right? |
Although now that I say that we may wish to call these two operations different things... For example |
What's the win of implementing all these I am thinking from the POV of writing a high-level wrapper over the SIMD instructions in stable Rust once For that, I need |
AFAIK |
So for the cases that I've tested:
I don't know if For example, we could provide:
As soon as we update this crate on crates.io, I'd like building these functions in a third-party crate. But if they cannot be built from |
I don't think we'll ever provide generic functions, these will always be concrete in the stable surface area of the standard library. This is sort of like generic numeric operations in libstd, we just don't have them and have explicit typed operations instead. |
IIRC, the intent here is for the It seems like we should just use |
Sounds good, I think we should write this down in the docs somewhere. |
So what's the reason that we currently do not provide bitwise transmutes between floating-point and integer vector types ? |
So thinking about how to do this in a form suitable for an RFC. I'd like to do the following. Make |
@gnzlbg SGTM! |
Superseded by https://github.com/gnzlbg/packed_simd/issues/4 |
Currently, we define the following casts with
as_...
methods:simd_cast<T>
can be used to cast between types of different widths, where each lane gets promoted. For example, for some ARM implementations I've needed:@BurntSushi how do you envision these casts? When should we add an
as_...
function? Should we usesimd_cast
in the library internally? Or should we do all the casts using calls to the intrinsics that perform them ?The text was updated successfully, but these errors were encountered: