forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#95961 - RalfJung:gather-scatter, r=workingj…
…ubilee implement SIMD gather/scatter via vector getelementptr Fixes rust-lang/portable-simd#271 However, I don't *really* know what I am doing here... Cc `@workingjubilee` `@calebzulawski` I didn't do anything for cranelift -- `@bjorn3` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
- Loading branch information
Showing
6 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1247,6 +1247,7 @@ symbols! { | |
simd, | ||
simd_add, | ||
simd_and, | ||
simd_arith_offset, | ||
simd_as, | ||
simd_bitmask, | ||
simd_cast, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// compile-flags: -C no-prepopulate-passes | ||
// | ||
|
||
#![crate_type = "lib"] | ||
#![feature(repr_simd, platform_intrinsics)] | ||
|
||
extern "platform-intrinsic" { | ||
pub(crate) fn simd_arith_offset<T, U>(ptrs: T, offsets: U) -> T; | ||
} | ||
|
||
/// A vector of *const T. | ||
#[derive(Debug, Copy, Clone)] | ||
#[repr(simd)] | ||
pub struct SimdConstPtr<T, const LANES: usize>([*const T; LANES]); | ||
|
||
#[derive(Debug, Copy, Clone)] | ||
#[repr(simd)] | ||
pub struct Simd<T, const LANES: usize>([T; LANES]); | ||
|
||
// CHECK-LABEL: smoke | ||
#[no_mangle] | ||
pub fn smoke(ptrs: SimdConstPtr<u8, 8>, offsets: Simd<usize, 8>) -> SimdConstPtr<u8, 8> { | ||
// CHECK: getelementptr i8, <8 x i8*> %_3, <8 x i64> %_4 | ||
unsafe { simd_arith_offset(ptrs, offsets) } | ||
} |