-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
adds simd_select intrinsic #49141
adds simd_select intrinsic #49141
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
LGTM, though I would have expected a codegen test. But I'll leave the decision whether to add this intrinsic to @alexcrichton since I don't have a good overview over the portable SIMD story that this ties into. |
@rkruppe could you point me to a codegen test ? I'll try to add one. The select intrinsic should generate: https://llvm.org/docs/LangRef.html#select-instruction
|
There's plenty of them in |
@rkruppe I've added a codegen test :) |
@bors r+ |
📌 Commit cca2604 has been approved by |
@bors r- Emscripten does not support the
(Do not rollup this PR in the future.) |
@kennytm i've added an |
@gnzlbg I... don't know a solution besides adding the asmjs/wasm targets in BTW I think you do want to check if this test works on |
It should work there, but that does not mean it will build successfully :/ |
@bors: r+ |
📌 Commit 4eff4d9 has been approved by |
adds simd_select intrinsic The select SIMD intrinsic is used to select elements from two SIMD vectors using a mask: ```rust let mask = b8x4::new(true, false, false, true); let a = f32x4::new(1., 2., 3., 4.); let b = f32x4::new(5., 6., 7., 8.); assert_eq!(simd_select(mask, a, b), f32x4::new(1., 6., 7., 4.)); ``` The number of lanes between the mask and the vectors must match, but the vector width of the mask does not need to match that of the vectors. The mask is required to be a vector of signed integers. Note: this intrinsic will be exposed via `std::simd`'s vector masks - users are not expected to use it directly.
adds simd_select intrinsic The select SIMD intrinsic is used to select elements from two SIMD vectors using a mask: ```rust let mask = b8x4::new(true, false, false, true); let a = f32x4::new(1., 2., 3., 4.); let b = f32x4::new(5., 6., 7., 8.); assert_eq!(simd_select(mask, a, b), f32x4::new(1., 6., 7., 4.)); ``` The number of lanes between the mask and the vectors must match, but the vector width of the mask does not need to match that of the vectors. The mask is required to be a vector of signed integers. Note: this intrinsic will be exposed via `std::simd`'s vector masks - users are not expected to use it directly.
☀️ Test successful - status-appveyor, status-travis |
The select SIMD intrinsic is used to select elements from two SIMD vectors using a mask:
The number of lanes between the mask and the vectors must match, but the vector width of the mask does not need to match that of the vectors. The mask is required to be a vector of signed integers.
Note: this intrinsic will be exposed via
std::simd
's vector masks - users are not expected to use it directly.