Rollup merge of #77504 - Amanieu:select_simd_bitmask, r=ecstatic-morse
Support vectors with fewer than 8 elements for simd_select_bitmask Resolves the issue raised here: https://github.com/rust-lang/stdarch/issues/310#issuecomment-693730094
This commit is contained in:
commit
5bd9ce5cd4
4 changed files with 37 additions and 8 deletions
|
|
@ -49,8 +49,8 @@ fn main() {
|
|||
simd_select(m4, 0u32, 1u32);
|
||||
//~^ ERROR found non-SIMD `u32`
|
||||
|
||||
simd_select_bitmask(0u8, x, x);
|
||||
//~^ ERROR mask length `8` != other vector length `4`
|
||||
simd_select_bitmask(0u16, x, x);
|
||||
//~^ ERROR mask length `16` != other vector length `4`
|
||||
//
|
||||
simd_select_bitmask(0u8, 1u32, 2u32);
|
||||
//~^ ERROR found non-SIMD `u32`
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: expected SIMD
|
|||
LL | simd_select(m4, 0u32, 1u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: mismatched lengths: mask length `8` != other vector length `4`
|
||||
error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: mismatched lengths: mask length `16` != other vector length `4`
|
||||
--> $DIR/simd-intrinsic-generic-select.rs:52:9
|
||||
|
|
||||
LL | simd_select_bitmask(0u8, x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_select_bitmask(0u16, x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: expected SIMD argument type, found non-SIMD `u32`
|
||||
--> $DIR/simd-intrinsic-generic-select.rs:55:9
|
||||
|
|
|
|||
|
|
@ -167,4 +167,29 @@ fn main() {
|
|||
let e = u32x8(8, 9, 10, 11, 4, 5, 6, 7);
|
||||
assert_eq!(r, e);
|
||||
}
|
||||
|
||||
unsafe {
|
||||
let a = u32x4(0, 1, 2, 3);
|
||||
let b = u32x4(4, 5, 6, 7);
|
||||
|
||||
let r: u32x4 = simd_select_bitmask(0u8, a, b);
|
||||
let e = b;
|
||||
assert_eq!(r, e);
|
||||
|
||||
let r: u32x4 = simd_select_bitmask(0xfu8, a, b);
|
||||
let e = a;
|
||||
assert_eq!(r, e);
|
||||
|
||||
let r: u32x4 = simd_select_bitmask(0b0101u8, a, b);
|
||||
let e = u32x4(0, 5, 2, 7);
|
||||
assert_eq!(r, e);
|
||||
|
||||
let r: u32x4 = simd_select_bitmask(0b1010u8, a, b);
|
||||
let e = u32x4(4, 1, 6, 3);
|
||||
assert_eq!(r, e);
|
||||
|
||||
let r: u32x4 = simd_select_bitmask(0b1100u8, a, b);
|
||||
let e = u32x4(4, 5, 2, 3);
|
||||
assert_eq!(r, e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue