Skip to content

Commit afbda63

Browse files
Rollup merge of rust-lang#140034 - RalfJung:simd_select_bitmask-padding, r=workingjubilee
simd_select_bitmask: the 'padding' bits in the mask are just ignored Fixes rust-lang#137942: we documented simd_select_bitmask to require the 'padding' bits in the mask (the mask can sometimes be longer than the vector; I am referring to these extra bits as 'padding' here) to be zero, mostly because nobody felt like doing the research for what should be done when they are non-zero. However, codegen is already perfectly happy just ignoring them, so in practice they can have any value. Some of the intrinsic wrappers in stdarch have trouble ensuring that they are zero. So let's just adjust the docs and Miri to permit non-zero 'padding' bits. Cc ````@Amanieu```` ````@workingjubilee````
2 parents 939bc3f + 2ffa166 commit afbda63

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

core/src/intrinsics/simd.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,9 @@ pub unsafe fn simd_select<M, T>(mask: M, if_true: T, if_false: T) -> T;
577577
/// For each element, if the bit in `mask` is `1`, select the element from
578578
/// `if_true`. If the corresponding bit in `mask` is `0`, select the element from
579579
/// `if_false`.
580+
/// The remaining bits of the mask are ignored.
580581
///
581582
/// The bitmask bit order matches `simd_bitmask`.
582-
///
583-
/// # Safety
584-
/// Padding bits must be all zero.
585583
#[rustc_intrinsic]
586584
#[rustc_nounwind]
587585
pub unsafe fn simd_select_bitmask<M, T>(m: M, yes: T, no: T) -> T;

0 commit comments

Comments
 (0)